From e420b21834e9286399f16c28cbc871f3d95d694c Mon Sep 17 00:00:00 2001 From: Ederson de Souza Date: Mon, 7 Apr 2025 09:12:49 -0700 Subject: [PATCH] share/sysbuild: Support single app slot RAM load mode Adds a new Kconfig to support MCUboot single application slot RAM load mode. Signed-off-by: Ederson de Souza --- scripts/ci/check_compliance.py | 1 + .../BOOTLOADER_image_default.cmake | 5 ++++- .../image_configurations/MAIN_image_default.cmake | 2 ++ share/sysbuild/images/bootloader/Kconfig | 13 +++++++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 661f3ce6f1d..be2f99cee9c 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1101,6 +1101,7 @@ flagged. "SEL", "SHIFT", "SINGLE_APPLICATION_SLOT", # Used in sysbuild for MCUboot configuration + "SINGLE_APPLICATION_SLOT_RAM_LOAD", # Used in sysbuild for MCUboot configuration "SOC_SERIES_", # Used as regex in scripts/utils/board_v1_to_v2.py "SOC_WATCH", # Issue 13749 "SOME_BOOL", diff --git a/share/sysbuild/image_configurations/BOOTLOADER_image_default.cmake b/share/sysbuild/image_configurations/BOOTLOADER_image_default.cmake index 422fdb83030..75b0bc3668a 100644 --- a/share/sysbuild/image_configurations/BOOTLOADER_image_default.cmake +++ b/share/sysbuild/image_configurations/BOOTLOADER_image_default.cmake @@ -12,7 +12,8 @@ set(bootmodes CONFIG_SINGLE_APPLICATION_SLOT CONFIG_BOOT_SWAP_USING_MOVE CONFIG_BOOT_DIRECT_XIP CONFIG_BOOT_RAM_LOAD - CONFIG_BOOT_FIRMWARE_LOADER) + CONFIG_BOOT_FIRMWARE_LOADER + CONFIG_SINGLE_APPLICATION_SLOT_RAM_LOAD) if(SB_CONFIG_MCUBOOT_MODE_SINGLE_APP) set(bootmode CONFIG_SINGLE_APPLICATION_SLOT) @@ -30,6 +31,8 @@ elseif(SB_CONFIG_MCUBOOT_MODE_RAM_LOAD) set(bootmode CONFIG_BOOT_RAM_LOAD) elseif(SB_CONFIG_MCUBOOT_MODE_FIRMWARE_UPDATER) set(bootmode CONFIG_BOOT_FIRMWARE_LOADER) +elseif(SB_CONFIG_MCUBOOT_MODE_SINGLE_APP_RAM_LOAD) + set(bootmode CONFIG_SINGLE_APPLICATION_SLOT_RAM_LOAD) endif() foreach(loopbootmode ${bootmodes}) diff --git a/share/sysbuild/image_configurations/MAIN_image_default.cmake b/share/sysbuild/image_configurations/MAIN_image_default.cmake index 28dd6d0aacb..653f7328892 100644 --- a/share/sysbuild/image_configurations/MAIN_image_default.cmake +++ b/share/sysbuild/image_configurations/MAIN_image_default.cmake @@ -41,5 +41,7 @@ if(SB_CONFIG_BOOTLOADER_MCUBOOT) set_config_int(${ZCMAKE_APPLICATION} CONFIG_FLASH_SIZE 0) elseif(SB_CONFIG_MCUBOOT_MODE_FIRMWARE_UPDATER) set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER y) + elseif(SB_CONFIG_MCUBOOT_MODE_SINGLE_APP_RAM_LOAD) + set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_BOOTLOADER_MODE_SINGLE_APP_RAM_LOAD y) endif() endif() diff --git a/share/sysbuild/images/bootloader/Kconfig b/share/sysbuild/images/bootloader/Kconfig index 1b5cdec41ea..54e429fcc97 100644 --- a/share/sysbuild/images/bootloader/Kconfig +++ b/share/sysbuild/images/bootloader/Kconfig @@ -126,6 +126,19 @@ config MCUBOOT_MODE_FIRMWARE_UPDATER mechanism defined for entering the slot1_partition which is a dedicated firmware updater application used to update the slot0_partition application. +config MCUBOOT_MODE_SINGLE_APP_RAM_LOAD + bool "Single app RAM load mode" + help + MCUboot can load the image to RAM from an arbitrary location. In this mode, + MCUboot will copy the image to RAM and begin execution from there. The image + must be linked to execute from RAM, the address that it is copied to is + specified using the load-addr argument when running imgtool. + Note that while not used directly, a slot0_partition must be defined in the + DT, as it is used to get information about size of the image to be loaded. + This option automatically selects MCUBOOT_BOOTLOADER_NO_DOWNGRADE as it is + not possible to swap back to older version of the application. In fact, none + of the swap operations are supported in this mode. + endchoice config SIGNATURE_TYPE