fix(core): fix image size alignment on f4 devices
What changed, and why it matters
This commit adjusts memory layout alignment settings in the linker script used for Trezor's STM32F4 hardware wallet firmware. It moves a 512-byte alignment boundary from the end of one flash section to the end of another. The change is described by the vendor as fixing image size alignment on F4 devices. There is no explicit security claim in the commit, and the diff alone does not demonstrate a vulnerability or exploit path. It could plausibly relate to ensuring correct firmware image boundaries for secure boot or flashing, but that is speculative.
Treat as a routine firmware build fix unless additional context emerges. Review whether misaligned firmware images could have caused failed updates, partial writes, or verification mismatches on STM32F4 devices. If the device relies on image-size checks for secure boot or downgrade protection, validate that the new alignment satisfies those requirements. No immediate security response is indicated by the commit alone.
Security signals we found
Linker script change affects firmware image layout and alignment
512-byte alignment is consistent with STM32F4 flash page/sector constraints
No explicit security language in commit message or diff
No references to vulnerabilities, CVEs, researchers, or security reports
Change is small and localized to a single linker script
Evidence from the diff
The patch modifies core/embed/sys/linker/stm32f4/firmware.ld. It changes the .flash section’s trailing alignment from ALIGN(512) to ALIGN(4), and changes the .flash2 section’s trailing alignment from ALIGN(4) to ALIGN(512). The .flash2 section is itself aligned to 512 bytes at its start. This effectively relocates the 512-byte boundary requirement to the end of .flash2, likely so that the total firmware image size is a multiple of the flash erase/program page size (512 bytes) for STM32F4 devices. The commit title says this fixes image size alignment on F4 devices and carries [no changelog].
Changed components
core/embed/sys/linker/stm32f4/firmware.ldTrezor Core firmware builds for STM32F4 devicesInspect captured patch +2 / −2
### core/embed/sys/linker/stm32f4/firmware.ld
@@ -40,15 +40,15 @@ SECTIONS {
. = ALIGN(4);
KEEP(*(.bootloader));
*(.bootloader*);
- . = ALIGN(512);
+ . = ALIGN(4);
} >FLASH AT>FLASH
.flash2 : ALIGN(512) {
. = ALIGN(4);
*(.text*);
. = ALIGN(4);
*(.rodata*);
- . = ALIGN(4);
+ . = ALIGN(512);
} >FLASH2 AT>FLASH2
.stack : ALIGN(8) {Why this scored 27/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.