Vorago VA416x0: simplify iram_write/iram_fill (single RMW path)#779
Open
dgarske wants to merge 1 commit into
Open
Vorago VA416x0: simplify iram_write/iram_fill (single RMW path)#779dgarske wants to merge 1 commit into
dgarske wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
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_writeandiram_fill. - Drop alignment snapshot locals and
(uintptr_t)3ucasts. - Update the explanatory comment to reflect the single-path approach.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)