Skip to content

Commit 03f4339

Browse files
committed
cmake: mcuboot: Flash encrypted image when loading to RAM
When both `SB_CONFIG_MCUBOOT_MODE_RAM_LOAD` and `SB_CONFIG_BOOT_ENCRYPTION` are enabled, MCUBoot loads an encrypted image from flash, decrypts it, and then executes it from RAM. Previously, the unencrypted image was being flashed. This caused a boot failure because MCUBoot would attempt to decrypt an unencrypted image. This commit ensures the encrypted image is flashed when this configuration is active, allowing the system to boot correctly. Signed-off-by: Arthur Gay <arthur.gay@marshmallow.kids>
1 parent dbcfb77 commit 03f4339

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cmake/mcuboot.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,9 @@ function(zephyr_mcuboot_tasks)
283283
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands COMMAND
284284
${imgtool_sign} ${imgtool_args} --encrypt "${keyfile_enc}" ${output}.hex
285285
${output}.signed.encrypted.hex)
286+
if (CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD)
287+
zephyr_runner_file(hex ${output}.signed.encrypted.hex)
288+
endif()
286289
endif()
287290

288291
if(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD OR CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD_WITH_REVERT)

0 commit comments

Comments
 (0)