mcuboot: Kconfig options for single app slot RAM loading mode
MCUboot has a configuration for single application slot RAM loading, in which the single loader (or a hook thereof) can load an application from an arbitrary flash location to RAM. Applications that are to be loaded in this way need to specify, in their mcuboot header, the load address in RAM they are meant to be loaded. This patch adds a new Kconfig for this mode. The load address used comes from devicetree chosen property "mcuboot,ram-load-dev", if it exists, and if not, "zephyr,sram". Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
This commit is contained in:
parent
f358f9f6e9
commit
c9a18fd487
3 changed files with 31 additions and 1 deletions
|
@ -95,7 +95,8 @@ function(zephyr_mcuboot_tasks)
|
||||||
|
|
||||||
# If single slot mode, or if in firmware updater mode and this is the firmware updater image,
|
# If single slot mode, or if in firmware updater mode and this is the firmware updater image,
|
||||||
# use slot 0 information
|
# use slot 0 information
|
||||||
if(NOT CONFIG_MCUBOOT_BOOTLOADER_MODE_SINGLE_APP AND (NOT CONFIG_MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER OR CONFIG_MCUBOOT_APPLICATION_FIRMWARE_UPDATER))
|
if(NOT CONFIG_MCUBOOT_BOOTLOADER_MODE_SINGLE_APP AND (NOT CONFIG_MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER OR CONFIG_MCUBOOT_APPLICATION_FIRMWARE_UPDATER)
|
||||||
|
AND NOT CONFIG_MCUBOOT_BOOTLOADER_MODE_SINGLE_APP_RAM_LOAD)
|
||||||
# Slot 1 size is used instead of slot 0 size
|
# Slot 1 size is used instead of slot 0 size
|
||||||
set(slot_size)
|
set(slot_size)
|
||||||
dt_nodelabel(slot1_flash NODELABEL "slot1_partition" REQUIRED)
|
dt_nodelabel(slot1_flash NODELABEL "slot1_partition" REQUIRED)
|
||||||
|
@ -138,6 +139,15 @@ function(zephyr_mcuboot_tasks)
|
||||||
set(imgtool_args --align 1 --load-addr ${chosen_ram_address} ${imgtool_args})
|
set(imgtool_args --align 1 --load-addr ${chosen_ram_address} ${imgtool_args})
|
||||||
set(imgtool_args_alt_slot ${imgtool_args} --hex-addr ${slot1_partition_address})
|
set(imgtool_args_alt_slot ${imgtool_args} --hex-addr ${slot1_partition_address})
|
||||||
set(imgtool_args ${imgtool_args} --hex-addr ${slot0_partition_address})
|
set(imgtool_args ${imgtool_args} --hex-addr ${slot0_partition_address})
|
||||||
|
elseif(CONFIG_MCUBOOT_BOOTLOADER_MODE_SINGLE_APP_RAM_LOAD)
|
||||||
|
dt_chosen(ram_load_dev PROPERTY "mcuboot,ram-load-dev")
|
||||||
|
if(DEFINED ram_load_dev)
|
||||||
|
dt_reg_addr(load_address PATH ${ram_load_dev})
|
||||||
|
else()
|
||||||
|
dt_chosen(chosen_ram PROPERTY "zephyr,sram")
|
||||||
|
dt_reg_addr(load_address PATH ${chosen_ram})
|
||||||
|
endif()
|
||||||
|
set(imgtool_args --align 1 --load-addr ${load_address} ${imgtool_args})
|
||||||
else()
|
else()
|
||||||
set(imgtool_args --align ${write_block_size} ${imgtool_args})
|
set(imgtool_args --align ${write_block_size} ${imgtool_args})
|
||||||
endif()
|
endif()
|
||||||
|
|
5
doc/build/dts/api/api.rst
vendored
5
doc/build/dts/api/api.rst
vendored
|
@ -462,3 +462,8 @@ device.
|
||||||
WS2812 GPIO driver
|
WS2812 GPIO driver
|
||||||
* - zephyr,touch
|
* - zephyr,touch
|
||||||
- touchscreen controller device node.
|
- touchscreen controller device node.
|
||||||
|
* - mcuboot,ram-load-dev
|
||||||
|
- When a Zephyr application is built to be loaded to RAM by MCUboot, with
|
||||||
|
:kconfig:option:`CONFIG_MCUBOOT_BOOTLOADER_MODE_SINGLE_APP_RAM_LOAD`,
|
||||||
|
this property is used to tell MCUboot the load address of the image, which
|
||||||
|
will be the ``reg`` of the chosen node.
|
||||||
|
|
|
@ -254,6 +254,21 @@ config MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER
|
||||||
a dedicated firmware updater application used to update the slot0_partition
|
a dedicated firmware updater application used to update the slot0_partition
|
||||||
application.
|
application.
|
||||||
|
|
||||||
|
config MCUBOOT_BOOTLOADER_MODE_SINGLE_APP_RAM_LOAD
|
||||||
|
bool "MCUboot has been configured in single app RAM load mode"
|
||||||
|
select MCUBOOT_BOOTLOADER_MODE_HAS_NO_DOWNGRADE
|
||||||
|
select MCUBOOT_BOOTLOADER_NO_DOWNGRADE
|
||||||
|
help
|
||||||
|
MCUboot can load the image to RAM from an arbitrary location. In this mode,
|
||||||
|
MCUboot will copy the image to RAM and begin execution from there. The image
|
||||||
|
must be linked to execute from RAM, the address that it is copied to is
|
||||||
|
specified using the load-addr argument when running imgtool.
|
||||||
|
Note that while not used directly, a slot0_partition must be defined in the
|
||||||
|
DT, as it is used to get information about size of the image to be loaded.
|
||||||
|
This option automatically selects MCUBOOT_BOOTLOADER_NO_DOWNGRADE as it is
|
||||||
|
not possible to swap back to older version of the application. In fact, none
|
||||||
|
of the swap operations are supported in this mode.
|
||||||
|
|
||||||
endchoice # MCUBOOT_BOOTLOADER_MODE
|
endchoice # MCUBOOT_BOOTLOADER_MODE
|
||||||
|
|
||||||
config MCUBOOT_BOOTLOADER_MODE_HAS_NO_DOWNGRADE
|
config MCUBOOT_BOOTLOADER_MODE_HAS_NO_DOWNGRADE
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue