[rescue] Avoid large rodata initializer for dfu_ctx_t#30169
Merged
Conversation
The `dfu_ctx_t` struct has a large buffer allocated for rescue transfers. Using a designated initializer for this struct produces a large, mostly zero-filled initializer in `rodata`, consuming approximately 2.5K of ROM_EXT flash space. To reclaim this space, this change replaces the designated initializer with manual field-by-field initialization, eliminating the bloated `rodata` payload. Change-Id: Ifbbdc4977104cc980677af2b8ca61507d592f1a3 Signed-off-by: Yi-Hsuan Deng <yhdeng@google.com>
cfrantz
approved these changes
May 21, 2026
cfrantz
left a comment
Contributor
There was a problem hiding this comment.
Great find... especially since I've complained about this in the past and I think I'm responsible for this one.
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.
The
dfu_ctx_tstruct has a large buffer allocated for rescue transfers inrescue_state_t.Using a designated initializer for this struct produces a large, mostly zero-filled initializer in
rodata, consuming approximately 2.5KB of ROM_EXT flash space.opentitan/sw/device/silicon_creator/lib/rescue/rescue.h
Lines 108 to 110 in 81739c5
To reclaim this space, this change replaces the designated initializer with manual field-by-field initialization, eliminating the bloated
rodatapayload.