Skip to content

Commit b71f220

Browse files
edersondisouzateburd
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]>
1 parent b81f3a3 commit b71f220

File tree

3 files changed

+33
-17
lines changed

3 files changed

+33
-17
lines changed

boot/zephyr/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ zephyr_library_sources(
127127
)
128128
endif()
129129

130-
if(CONFIG_SINGLE_APPLICATION_SLOT)
130+
if(CONFIG_SINGLE_APPLICATION_SLOT OR CONFIG_SINGLE_APPLICATION_SLOT_RAM_LOAD)
131131
zephyr_library_sources(
132132
${BOOT_DIR}/zephyr/single_loader.c
133133
)
@@ -147,7 +147,7 @@ zephyr_library_sources(
147147
)
148148
endif()
149149

150-
if(CONFIG_BOOT_RAM_LOAD)
150+
if(CONFIG_BOOT_RAM_LOAD OR CONFIG_SINGLE_APPLICATION_SLOT_RAM_LOAD)
151151
zephyr_library_sources(
152152
${BOOT_DIR}/bootutil/src/ram_load.c
153153
)
@@ -400,7 +400,7 @@ if(CONFIG_BOOT_MAX_IMG_SECTORS_AUTO)
400400
math(EXPR slot_min_sectors "${slot0_size} / ${erase_size_slot0}")
401401
endif()
402402

403-
if(NOT CONFIG_SINGLE_APPLICATION_SLOT)
403+
if(NOT CONFIG_SINGLE_APPLICATION_SLOT AND NOT CONFIG_SINGLE_APPLICATION_SLOT_RAM_LOAD)
404404
dt_nodelabel(slot1_flash NODELABEL "slot1_partition")
405405
dt_prop(slot1_size PATH "${slot1_flash}" PROPERTY "reg" INDEX 1)
406406
dt_get_parent(slot1_flash)

boot/zephyr/Kconfig

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

328328
endchoice
329329

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

377364
endif # !SINGLE_APPLICATION_SLOT
378365

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

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)