diff --git a/boot/zephyr/CMakeLists.txt b/boot/zephyr/CMakeLists.txt index ba62d2bc8..2741ad100 100644 --- a/boot/zephyr/CMakeLists.txt +++ b/boot/zephyr/CMakeLists.txt @@ -123,7 +123,7 @@ zephyr_library_sources( ) endif() -if(CONFIG_SINGLE_APPLICATION_SLOT) +if(CONFIG_SINGLE_APPLICATION_SLOT OR CONFIG_SINGLE_APPLICATION_SLOT_RAM_LOAD) zephyr_library_sources( ${BOOT_DIR}/zephyr/single_loader.c ) @@ -143,7 +143,7 @@ zephyr_library_sources( ) endif() -if(CONFIG_BOOT_RAM_LOAD) +if(CONFIG_BOOT_RAM_LOAD OR CONFIG_SINGLE_APPLICATION_SLOT_RAM_LOAD) zephyr_library_sources( ${BOOT_DIR}/bootutil/src/ram_load.c ) @@ -398,7 +398,7 @@ if(CONFIG_BOOT_SWAP_USING_MOVE) endif() endif() -if(NOT CONFIG_SINGLE_APPLICATION_SLOT) +if(NOT CONFIG_SINGLE_APPLICATION_SLOT AND NOT CONFIG_SINGLE_APPLICATION_SLOT_RAM_LOAD) dt_nodelabel(slot1_flash NODELABEL "slot1_partition") dt_prop(slot1_size PATH "${slot1_flash}" PROPERTY "reg" INDEX 1) dt_get_parent(slot1_flash) @@ -426,7 +426,7 @@ if(CONFIG_BOOT_MAX_IMG_SECTORS_AUTO) math(EXPR slot_min_sectors "${slot0_size} / ${erase_size_slot0}") endif() - if(NOT CONFIG_SINGLE_APPLICATION_SLOT) + if(NOT CONFIG_SINGLE_APPLICATION_SLOT AND NOT CONFIG_SINGLE_APPLICATION_SLOT_RAM_LOAD) if(NOT DEFINED slot1_size) message(WARNING "Unable to determine size of slot1 partition, cannot calculate minimum sector usage") elseif(NOT DEFINED erase_size_slot1) diff --git a/boot/zephyr/Kconfig b/boot/zephyr/Kconfig index 197f44918..7ff11ee90 100644 --- a/boot/zephyr/Kconfig +++ b/boot/zephyr/Kconfig @@ -326,19 +326,6 @@ config BOOT_FIRMWARE_LOADER endchoice -# Workaround for not being able to have commas in macro arguments -DT_CHOSEN_Z_SRAM := zephyr,sram - -if BOOT_RAM_LOAD -config BOOT_IMAGE_EXECUTABLE_RAM_START - hex "Boot image executable ram start" - default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_SRAM)) - -config BOOT_IMAGE_EXECUTABLE_RAM_SIZE - int "Boot image executable base size" - default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_SRAM),0) -endif - config BOOT_DIRECT_XIP_REVERT bool "Enable the revert mechanism in direct-xip mode" depends on BOOT_DIRECT_XIP @@ -375,6 +362,27 @@ config BOOT_SWAP_SAVE_ENCTLV endif # !SINGLE_APPLICATION_SLOT +config SINGLE_APPLICATION_SLOT_RAM_LOAD + bool "RAM load for single application slot" + help + If y, the image is loaded to RAM and executed from there. For this reason, + the image has to be linked to be executed from RAM. The address that the + image is copied to is specified using the load-addr argument to the + imgtool.py script which writes it to the image header. + +# Workaround for not being able to have commas in macro arguments +DT_CHOSEN_Z_SRAM := zephyr,sram + +if BOOT_RAM_LOAD || SINGLE_APPLICATION_SLOT_RAM_LOAD +config BOOT_IMAGE_EXECUTABLE_RAM_START + hex "Boot image executable ram start" + default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_SRAM)) + +config BOOT_IMAGE_EXECUTABLE_RAM_SIZE + int "Boot image executable base size" + default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_SRAM),0) +endif + config BOOT_ENCRYPTION_SUPPORT bool help @@ -683,7 +691,7 @@ config BOOT_INTR_VEC_RELOC config UPDATEABLE_IMAGE_NUMBER int "Number of updateable images" default 1 - range 1 1 if SINGLE_APPLICATION_SLOT + range 1 1 if SINGLE_APPLICATION_SLOT || SINGLE_APPLICATION_SLOT_RAM_LOAD help Enables support of multi image update. diff --git a/boot/zephyr/include/mcuboot_config/mcuboot_config.h b/boot/zephyr/include/mcuboot_config/mcuboot_config.h index 8d479ced7..573155b39 100644 --- a/boot/zephyr/include/mcuboot_config/mcuboot_config.h +++ b/boot/zephyr/include/mcuboot_config/mcuboot_config.h @@ -118,6 +118,14 @@ #endif /* CONFIG_SINGLE_APPLICATION_SLOT */ +#ifdef CONFIG_SINGLE_APPLICATION_SLOT_RAM_LOAD +#define MCUBOOT_RAM_LOAD 1 +#define MCUBOOT_IMAGE_NUMBER 1 +#define MCUBOOT_SINGLE_APPLICATION_SLOT_RAM_LOAD 1 +#define IMAGE_EXECUTABLE_RAM_START CONFIG_BOOT_IMAGE_EXECUTABLE_RAM_START +#define IMAGE_EXECUTABLE_RAM_SIZE CONFIG_BOOT_IMAGE_EXECUTABLE_RAM_SIZE +#endif + #ifdef CONFIG_LOG #define MCUBOOT_HAVE_LOGGING 1 #endif