Skip to content

Commit 189a552

Browse files
boot/zephyr: Move RAM load Kconfigs outside !SINGLE_APPLICATION_SLOT
Now that RAM load code is not dependent on bootutil/loader.c, it can be used independently of !SINGLE_APPLICATION_SLOT configurations. Move the related Kconfigs accordingly, so that applications configured to use single loader can do RAM loading. Signed-off-by: Ederson de Souza <[email protected]>
1 parent 7cf448d commit 189a552

File tree

2 files changed

+35
-28
lines changed

2 files changed

+35
-28
lines changed

boot/zephyr/Kconfig

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ config BOOT_PREFER_SWAP_MOVE
211211
if !SINGLE_APPLICATION_SLOT
212212
choice BOOT_IMAGE_UPGRADE_MODE
213213
prompt "Image upgrade modes"
214+
default BOOT_NO_UPGRADE if BOOT_RAM_LOAD
214215
default BOOT_SWAP_USING_MOVE if BOOT_PREFER_SWAP_MOVE
215216
default BOOT_SWAP_USING_SCRATCH
216217

@@ -248,15 +249,6 @@ config BOOT_DIRECT_XIP
248249
images must be linked to be executed from the given image slot. Using this
249250
mode results in a simpler code path and smaller code size.
250251

251-
config BOOT_RAM_LOAD
252-
bool "RAM load"
253-
help
254-
If y, mcuboot selects the newest valid image based on the image version
255-
numbers, thereafter the selected image is copied to RAM and executed from
256-
there. For this reason, the image has to be linked to be executed from RAM.
257-
The address that the image is copied to is specified using the load-addr
258-
argument to the imgtool.py script which writes it to the image header.
259-
260252
config BOOT_FIRMWARE_LOADER
261253
bool "Firmware loader"
262254
help
@@ -269,20 +261,13 @@ config BOOT_FIRMWARE_LOADER
269261
Note: The firmware loader image must be signed with the same signing
270262
key as the primary image.
271263

272-
endchoice
273-
274-
# Workaround for not being able to have commas in macro arguments
275-
DT_CHOSEN_Z_SRAM := zephyr,sram
276-
277-
if BOOT_RAM_LOAD
278-
config BOOT_IMAGE_EXECUTABLE_RAM_START
279-
hex "Boot image executable ram start"
280-
default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_SRAM))
264+
config BOOT_NO_UPGRADE
265+
bool "No upgrade"
266+
help
267+
No upgrade is performed - usually, this option will be used in
268+
conjunction with BOOT_RAM_LOAD.
281269

282-
config BOOT_IMAGE_EXECUTABLE_RAM_SIZE
283-
int "Boot image executable base size"
284-
default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_SRAM),0)
285-
endif
270+
endchoice
286271

287272
config BOOT_DIRECT_XIP_REVERT
288273
bool "Enable the revert mechanism in direct-xip mode"
@@ -320,6 +305,28 @@ config BOOT_SWAP_SAVE_ENCTLV
320305

321306
endif # !SINGLE_APPLICATION_SLOT
322307

308+
config BOOT_RAM_LOAD
309+
bool "RAM load"
310+
help
311+
If y, mcuboot selects the newest valid image based on the image version
312+
numbers, thereafter the selected image is copied to RAM and executed from
313+
there. For this reason, the image has to be linked to be executed from RAM.
314+
The address that the image is copied to is specified using the load-addr
315+
argument to the imgtool.py script which writes it to the image header.
316+
317+
# Workaround for not being able to have commas in macro arguments
318+
DT_CHOSEN_Z_SRAM := zephyr,sram
319+
320+
if BOOT_RAM_LOAD
321+
config BOOT_IMAGE_EXECUTABLE_RAM_START
322+
hex "Boot image executable ram start"
323+
default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_SRAM))
324+
325+
config BOOT_IMAGE_EXECUTABLE_RAM_SIZE
326+
int "Boot image executable base size"
327+
default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_SRAM),0)
328+
endif
329+
323330
config BOOT_ENCRYPTION_SUPPORT
324331
bool
325332
help

boot/zephyr/include/mcuboot_config/mcuboot_config.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,6 @@
8282
#define MCUBOOT_DIRECT_XIP_REVERT
8383
#endif
8484

85-
#ifdef CONFIG_BOOT_RAM_LOAD
86-
#define MCUBOOT_RAM_LOAD 1
87-
#define IMAGE_EXECUTABLE_RAM_START CONFIG_BOOT_IMAGE_EXECUTABLE_RAM_START
88-
#define IMAGE_EXECUTABLE_RAM_SIZE CONFIG_BOOT_IMAGE_EXECUTABLE_RAM_SIZE
89-
#endif
90-
9185
#ifdef CONFIG_BOOT_FIRMWARE_LOADER
9286
#define MCUBOOT_FIRMWARE_LOADER
9387
#endif
@@ -108,6 +102,12 @@
108102

109103
#endif /* CONFIG_SINGLE_APPLICATION_SLOT */
110104

105+
#ifdef CONFIG_BOOT_RAM_LOAD
106+
#define MCUBOOT_RAM_LOAD 1
107+
#define IMAGE_EXECUTABLE_RAM_START CONFIG_BOOT_IMAGE_EXECUTABLE_RAM_START
108+
#define IMAGE_EXECUTABLE_RAM_SIZE CONFIG_BOOT_IMAGE_EXECUTABLE_RAM_SIZE
109+
#endif
110+
111111
#ifdef CONFIG_LOG
112112
#define MCUBOOT_HAVE_LOGGING 1
113113
#endif

0 commit comments

Comments
 (0)