Skip to content

Commit 249a71d

Browse files
edersondisouzanvlsianpu
authored andcommitted
boot/zephyr: Add CONFIG_SINGLE_APPLICATION_SLOT_RAM_LOAD
This option basically enables MCUBOOT_RAM_LOAD in a single slot configuration, meaning the image on slot0 will be loaded into RAM. Signed-off-by: Ederson de Souza <[email protected]> Signed-off-by: Tom Burdick <[email protected]>
1 parent 5c67fb9 commit 249a71d

File tree

3 files changed

+34
-18
lines changed

3 files changed

+34
-18
lines changed

boot/zephyr/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ zephyr_library_sources(
123123
)
124124
endif()
125125

126-
if(CONFIG_SINGLE_APPLICATION_SLOT)
126+
if(CONFIG_SINGLE_APPLICATION_SLOT OR CONFIG_SINGLE_APPLICATION_SLOT_RAM_LOAD)
127127
zephyr_library_sources(
128128
${BOOT_DIR}/zephyr/single_loader.c
129129
)
@@ -143,7 +143,7 @@ zephyr_library_sources(
143143
)
144144
endif()
145145

146-
if(CONFIG_BOOT_RAM_LOAD)
146+
if(CONFIG_BOOT_RAM_LOAD OR CONFIG_SINGLE_APPLICATION_SLOT_RAM_LOAD)
147147
zephyr_library_sources(
148148
${BOOT_DIR}/bootutil/src/ram_load.c
149149
)
@@ -398,7 +398,7 @@ if(CONFIG_BOOT_SWAP_USING_MOVE)
398398
endif()
399399
endif()
400400

401-
if(NOT CONFIG_SINGLE_APPLICATION_SLOT)
401+
if(NOT CONFIG_SINGLE_APPLICATION_SLOT AND NOT CONFIG_SINGLE_APPLICATION_SLOT_RAM_LOAD)
402402
dt_nodelabel(slot1_flash NODELABEL "slot1_partition")
403403
dt_prop(slot1_size PATH "${slot1_flash}" PROPERTY "reg" INDEX 1)
404404
dt_get_parent(slot1_flash)
@@ -426,7 +426,7 @@ if(CONFIG_BOOT_MAX_IMG_SECTORS_AUTO)
426426
math(EXPR slot_min_sectors "${slot0_size} / ${erase_size_slot0}")
427427
endif()
428428

429-
if(NOT CONFIG_SINGLE_APPLICATION_SLOT)
429+
if(NOT CONFIG_SINGLE_APPLICATION_SLOT AND NOT CONFIG_SINGLE_APPLICATION_SLOT_RAM_LOAD)
430430
if(NOT DEFINED slot1_size)
431431
message(WARNING "Unable to determine size of slot1 partition, cannot calculate minimum sector usage")
432432
elseif(NOT DEFINED erase_size_slot1)

boot/zephyr/Kconfig

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -326,19 +326,6 @@ config BOOT_FIRMWARE_LOADER
326326

327327
endchoice
328328

329-
# Workaround for not being able to have commas in macro arguments
330-
DT_CHOSEN_Z_SRAM := zephyr,sram
331-
332-
if BOOT_RAM_LOAD
333-
config BOOT_IMAGE_EXECUTABLE_RAM_START
334-
hex "Boot image executable ram start"
335-
default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_SRAM))
336-
337-
config BOOT_IMAGE_EXECUTABLE_RAM_SIZE
338-
int "Boot image executable base size"
339-
default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_SRAM),0)
340-
endif
341-
342329
config BOOT_DIRECT_XIP_REVERT
343330
bool "Enable the revert mechanism in direct-xip mode"
344331
depends on BOOT_DIRECT_XIP
@@ -375,6 +362,27 @@ config BOOT_SWAP_SAVE_ENCTLV
375362

376363
endif # !SINGLE_APPLICATION_SLOT
377364

365+
config SINGLE_APPLICATION_SLOT_RAM_LOAD
366+
bool "RAM load for single application slot"
367+
help
368+
If y, the image is loaded to RAM and executed from there. For this reason,
369+
the image has to be linked to be executed from RAM. The address that the
370+
image is copied to is specified using the load-addr argument to the
371+
imgtool.py script which writes it to the image header.
372+
373+
# Workaround for not being able to have commas in macro arguments
374+
DT_CHOSEN_Z_SRAM := zephyr,sram
375+
376+
if BOOT_RAM_LOAD || SINGLE_APPLICATION_SLOT_RAM_LOAD
377+
config BOOT_IMAGE_EXECUTABLE_RAM_START
378+
hex "Boot image executable ram start"
379+
default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_SRAM))
380+
381+
config BOOT_IMAGE_EXECUTABLE_RAM_SIZE
382+
int "Boot image executable base size"
383+
default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_SRAM),0)
384+
endif
385+
378386
config BOOT_ENCRYPTION_SUPPORT
379387
bool
380388
help
@@ -683,7 +691,7 @@ config BOOT_INTR_VEC_RELOC
683691
config UPDATEABLE_IMAGE_NUMBER
684692
int "Number of updateable images"
685693
default 1
686-
range 1 1 if SINGLE_APPLICATION_SLOT
694+
range 1 1 if SINGLE_APPLICATION_SLOT || SINGLE_APPLICATION_SLOT_RAM_LOAD
687695
help
688696
Enables support of multi image update.
689697

boot/zephyr/include/mcuboot_config/mcuboot_config.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,14 @@
118118

119119
#endif /* CONFIG_SINGLE_APPLICATION_SLOT */
120120

121+
#ifdef CONFIG_SINGLE_APPLICATION_SLOT_RAM_LOAD
122+
#define MCUBOOT_RAM_LOAD 1
123+
#define MCUBOOT_IMAGE_NUMBER 1
124+
#define MCUBOOT_SINGLE_APPLICATION_SLOT_RAM_LOAD 1
125+
#define IMAGE_EXECUTABLE_RAM_START CONFIG_BOOT_IMAGE_EXECUTABLE_RAM_START
126+
#define IMAGE_EXECUTABLE_RAM_SIZE CONFIG_BOOT_IMAGE_EXECUTABLE_RAM_SIZE
127+
#endif
128+
121129
#ifdef CONFIG_LOG
122130
#define MCUBOOT_HAVE_LOGGING 1
123131
#endif

0 commit comments

Comments
 (0)