Skip to content

Vorago VA416x0: simplify iram_write/iram_fill (single RMW path)#779

Open
dgarske wants to merge 1 commit into
wolfSSL:masterfrom
dgarske:vorago_iram_2
Open

Vorago VA416x0: simplify iram_write/iram_fill (single RMW path)#779
dgarske wants to merge 1 commit into
wolfSSL:masterfrom
dgarske:vorago_iram_2

Conversation

@dgarske
Copy link
Copy Markdown
Member

@dgarske dgarske commented May 13, 2026

Continuation of #778

Round-2 cleanup on the IRAM shadow helpers:

  • Drop the word-aligned fast path. The volatile uint32_t * RMW path already minimizes word traffic (one ldr + one str per output word through grouped byte merges), and the fast path required BOTH src AND dst aligned -- ext_flash_write/read pass through the caller's source buffer, so an unaligned caller dropped the whole copy to the slow path anyway.

  • Drop the d/s alignment snapshot locals (only fed the fast-path test).

  • Drop the (uintptr_t)3u casts. uintptr_t is 32-bit on Cortex-M4 (same as unsigned int); the casts were defensive portability noise on a hardware-specific helper.

The volatile uint32_t store guarantee from round 1 is retained -- it is the load-bearing part (one STR per store, which the IRAM ECC requires).

Code-size win on wolfboot.elf (ECC384/SHA384 config):
.text 42348 -> 42292 (-56 B)
iram_write 94 -> 64 B (-30 B)
ext_flash_erase (inlined iram_fill) 96 -> 72 B (-24 B)

Verified on EVK hardware (vorago_va416x0.config):
build_test.sh clean -- v1 boots, signature OK, state NEW
build_test.sh update -- v1->v2 swap, signature OK, state TESTING,
"Booting new firmware, marking successful boot"
(5-byte pBOOT confirmation write -- exercises
byte-tail of the RMW loop)

@dgarske dgarske self-assigned this May 13, 2026
Copilot AI review requested due to automatic review settings May 13, 2026 17:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Simplifies the VA416x0 IRAM shadow write/fill helpers by removing the word-aligned fast path and relying solely on the volatile RMW loop, reducing code size.

Changes:

  • Remove word-aligned fast path from iram_write and iram_fill.
  • Drop alignment snapshot locals and (uintptr_t)3u casts.
  • Update the explanatory comment to reflect the single-path approach.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants