-
Notifications
You must be signed in to change notification settings - Fork 7.2k
modules: mcuboot: enable support for RAMLOAD mode with revert #85254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
modules: mcuboot: enable support for RAMLOAD mode with revert #85254
Conversation
The following west manifest projects have changed revision in this Pull Request:
Additional metadata changed:
⛔ DNM label due to: 1 project with PR revision and 1 project with metadata changes Note: This message is automatically posted and updated by the Manifest GitHub Action. |
Note: this PR requires mcu-tools/mcuboot#2197 from MCUBoot. It also contains commits from #85096, because I validated this support on the RT1050-EVK |
f2f96f5
to
59da498
Compare
59da498
to
f1d2151
Compare
This is not working. Do a build with sysbuild and flash using
This state is invalid as when you reboot, it boots slot 0 again. You also cannot erase the update slot or transfer a new image because it thinks an upgrade is in progress when it is not |
f1d2151
to
cb05a8b
Compare
How are you testing this? The sequence I'm using is the following:
|
Seems I did not do recover between tests, reproduction is build and flash, then upload the slot1 image without changing version, upgrade is bricked as image flag does nothing, new image is not booted, application cannot erase image because it is persistently marked as test |
Then after, if you actually do erase the flash of the upgrade slot header, MCUboot shows no secondary image - good, MCUmgr shows no secondary image - good, and try to upload, it fails to upload because of "There is no free slot to place the image" ??? Assuming this is because the flags are still set in the main image but this also bricks updates |
Actually a bit confused why a slot1 bin file is generated since the slot0 and slot1 bin files would be exactly the same for RAM load, hex makes sense but don't need the bin for slot1, something for me to look into why I did that |
MCUMgr ram load support was hardcoding the overlay file for the nrf52840dk. To make this support generic, move the _ram_load overlay file to the MCUBoot repository, as part of the mcuboot application. Signed-off-by: Daniel DeGrasse <[email protected]>
MCUBoot RAMLOAD mode relies on CONFIG_XIP=n, but FLASH_MCUX_FLEXSPI_XIP y-selects this symbol. Disable CONFIG_FLASH_MCUX_FLEXSPI_XIP for the case where we are using MCUBoot ramload mode. Signed-off-by: Daniel DeGrasse <[email protected]>
Add support for using the ramload mode of MCUBoot on the mimxrt1050_evk Signed-off-by: Daniel DeGrasse <[email protected]>
Add Kconfigs for RAMLOAD_WITH_REVERT mode in MCUBoot. This mode works in a manner similar to DIRECT_XIP_WITH_REVERT- namely, mcuboot will only boot an image that is either confirmed or marked as pending. If both images are confirmed, mcuboot will still select the one with the higher version, so downgrading is not possible using this mode. Signed-off-by: Daniel DeGrasse <[email protected]>
Add BOOT_RAM_LOAD_REVERT as a defined Kconfig to the whitelist Signed-off-by: Daniel DeGrasse <[email protected]>
When signing for ramload mode, respect the write alignment size setting. This is required when creating a confirmed image, as the BOOT_MAGIC value changes based on the alignment size in use. Signed-off-by: Daniel DeGrasse <[email protected]>
Prefer flashing the confirmed image when one is created with CONFIG_MCUBOOT_GENERATE_CONFIRMED_IMAGE. This way, the west runner will flash this image over the signed image if it exists. Signed-off-by: Daniel DeGrasse <[email protected]>
…cies CONFIG_FLASH_MCUX_FLEXSPI_XIP should also be disabled when using MCUBoot ramload mode with revert support. Signed-off-by: Daniel DeGrasse <[email protected]>
Much like in RAMLOAD mode, RAMLOAD_WITH_REVERT requires that mcuboot subsystem fetch bootloader information via the retention subsystem. Signed-off-by: Daniel DeGrasse <[email protected]>
Update mcuboot revision to include ramload support. This commit can be dropped once ramload support is present within Zephyr's revision of MCUBoot. Signed-off-by: Daniel DeGrasse <[email protected]>
boot_fetch_active_slot needs to map the slot number to a flash ID, as this is what the DFU subsystem expects when interacting with the flash partition. Signed-off-by: Daniel DeGrasse <[email protected]>
Add testcase to build mcuboot and smp_svr application using ramload with revert mode Signed-off-by: Daniel DeGrasse <[email protected]>
Trying to reproduce this on my end- the RT1050 build only has bin files, so I'm doing something like the following:
Are these reproduction steps right? Not sure if I'm missing something here |
cb05a8b
to
becc630
Compare
Build and flash, use a program to upload the secondary image without changing version (not jlink, upload using MCUmgr), mark it as test/confirmed, reboot, device state is stuck |
This PR adds support for RAMLOAD mode with revert in MCUBoot, and enables a testcase for it with the mcumgr subsystem. RAMLOAD mode with revert functions similar to the direct xip mode with revert- MCUBoot will not ramload an image that is not confirmed or marked pending.
This PR also modifies the method of getting the active slot number when using ramload modes- we need to query the flash area ID, not the active boot slot for use with mcuboot boot utilities