Commit b588907a authored by Johan Öhman's avatar Johan Öhman Committed by David Brown
Browse files

zephyr: Wrapped the RAM loading mode in Zephyr configs.

The RAM loading mode wasn't wrapped in Zephyr configs like the other boot modes.
Added a config to enable RAM loading as well as two configs to set
IMAGE_EXECUTABLE_RAM_START and IMAGE_EXECUTABLE_RAM_SIZE, respectively. These
two values default to the values from the chosen node sram in the dts.

Signed-off-by: default avatarJohan Öhman <johan.ohman@softube.com>
parent 6093cbb3
Loading
Loading
Loading
Loading
+22 −0
Changes for boot/zephyr/Kconfig: 22 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -234,8 +234,30 @@ config BOOT_DIRECT_XIP
	  images must be linked to be executed from the given image slot. Using this
	  mode results in a simpler code path and smaller code size.

config BOOT_RAM_LOAD
	bool "RAM load"
	help
	  If y, mcuboot selects the newest valid image based on the image version
	  numbers, thereafter the selected image is copied 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.

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
+6 −0
Changes for boot/zephyr/include/mcuboot_config/mcuboot_config.h: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -87,6 +87,12 @@
#define MCUBOOT_DIRECT_XIP_REVERT
#endif

#ifdef CONFIG_BOOT_RAM_LOAD
#define MCUBOOT_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_UPDATEABLE_IMAGE_NUMBER
#define MCUBOOT_IMAGE_NUMBER    CONFIG_UPDATEABLE_IMAGE_NUMBER
#else
+6 −0
Changes for boot/zephyr/ram_load.conf: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
# Enables RAM load mode and specifies 16 MB of memory from 0x80000000
# as a valid location for the firmware to be loaded into.

CONFIG_BOOT_RAM_LOAD=y
CONFIG_BOOT_IMAGE_EXECUTABLE_RAM_START=0x80000000
CONFIG_BOOT_IMAGE_EXECUTABLE_RAM_SIZE=16777216
 No newline at end of file
+6 −0
Changes for boot/zephyr/sample.yaml: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -48,3 +48,9 @@ tests:
    integration_platforms:
      - nrf52840dk_nrf52840
    tags: bootloader_mcuboot
  sample.bootloader.mcuboot.ram_load:
    extra_args: OVERLAY_CONFIG=./ram_load.conf
    tags: bootloader_mcuboot
    platform_allow: mimxrt1020_evk
    integration_platforms:
      - mimxrt1020_evk