Repository navigation
boot/mcuboot: Update commit version - #3894
Conversation
Update the MCUboot version to include the fix for flash_area_get_sector() in the NuttX port (mcu-tools/mcuboot#2908). The function looked up the flash device by fa_off + off, which only succeeded for off == 0. For any other offset it returned 0 without filling the sector, so the caller used uninitialized stack values. With MCUBOOT_SWAP_USING_MOVE this made the loader erase pages in a loop and left the primary slot corrupted. Assisted-by: Claude Code:claude-sonnet-5-5 Signed-off-by: Daniel P. Carvalho <[email protected]>
cederom
left a comment
There was a problem hiding this comment.
Thank you @daniel-p-carvalho for fixing the issue directly on the upstream project! :-)
|
@daniel-p-carvalho need reduce the firmware size: |
|
The overflow comes from the size of the new MCUboot (about 370 bytes more) on a configuration that already uses 99.7% of its flash, not from this change. I sent apache/nuttx#20909, which enables LTO in same70-qmtech:mcuboot-loader as same70-xplained already does, and lists other ways to save flash. Once it is merged this CI check should pass on a re-run. |
The same70-qmtech:mcuboot-loader target fills its 128 KB flash to near capacity (99.7%, about 440 bytes free), so any growth of the image breaks the CI build. Updating MCUboot (apache/nuttx-apps#3894) adds about 370 bytes and fails with: arm-none-eabi-ld: nuttx section `.ramfunc' will not fit in region `flash' arm-none-eabi-ld: region `flash' overflowed by 120 bytes Following the precedent in commit 8f3060e for same70-xplained:mcuboot-loader and commit ef87bdf for the stm32g4 cansock configurations, enable CONFIG_LTO_FULL=y. This drops flash usage to about 85-87% (about 17 KB of headroom) without dropping any application or feature. Only the build was checked, the board is not available to run the loader. Assisted-by: Claude Code:claude-sonnet-5-5 Signed-off-by: Daniel P. Carvalho <[email protected]>
|
@xiaoxiang781216 apache/nuttx#20909 (LTO in same70-qmtech:mcuboot-loader) is now merged, so the flash overflow that failed Linux (arm-07) should be gone. Could you please restart the CI for this PR? Re-running only the failed jobs will not help, since the nuttx tree used by the build is fixed when the run starts. If the new run is green, could you merge it as well? Thanks. |
Summary
Update
CONFIG_MCUBOOT_VERSIONtod6267bdb7f60a00f068b750f9efa2b6cb36bf47e, which includes mcu-tools/mcuboot#2908.The NuttX port of
flash_area_get_sector()looked the flash device up byfa_off + off, which only succeeds foroff == 0. For any other offset it returned-errno(0) without filling the sector, and MCUboot used uninitialized stack values as the erase offset and size. WithMCUBOOT_SWAP_USING_MOVEthe loader then erased pages in a loop and left the primary slot corrupted, with no error and no reset. The fix looks the device up by flash area id and returns an offset relative to the area.Impact
Users of
boot/mcubootget the MCUboot revision with the fixedflash_area_get_sector(). Without it,MCUBOOT_SWAP_USING_MOVEdoes not work on the NuttX port. No change to Kconfig symbols or the build process; only the default of the version string changes. Users who pin their ownMCUBOOT_VERSIONare not affected.Testing
Host: Linux x86_64,
arm-none-eabi-gcc15.2.1.Target: custom STM32G474RE board (out-of-tree,
CONFIG_ARCH_BOARD_CUSTOM), MCUboot loader withMCUBOOT_SWAP_USING_MOVE, 2 x 192 KB slots, based on nuttx7e652be44dand apps2d68f38f7.Before: the loader erased pages in a loop and the primary slot was corrupted (
flash_area_erase: ID:1 offset:134271849 length:536870996in the MCUboot log).After, without any local patch:
mcuboot_confirmand reset: v2 stays, no new swap.