sysbuild: Add firmware loader application type support
Adds support for setting up a firmware loader image in a build, which can also optionally automatically configure MCUboot and the application image to be able to boot the firmware loader image using the retention subsystem Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
This commit is contained in:
parent
bf59791aee
commit
8a8b91843d
9 changed files with 99 additions and 5 deletions
|
@ -216,7 +216,7 @@ endfunction()
|
|||
# and debugging.
|
||||
#
|
||||
function(ExternalZephyrProject_Add)
|
||||
set(app_types MAIN BOOTLOADER)
|
||||
set(app_types MAIN BOOTLOADER FIRMWARE_LOADER)
|
||||
cmake_parse_arguments(ZBUILD "" "APPLICATION;BOARD;BOARD_REVISION;SOURCE_DIR;APP_TYPE;BUILD_ONLY" "" ${ARGN})
|
||||
|
||||
if(ZBUILD_UNPARSED_ARGUMENTS)
|
||||
|
|
|
@ -29,10 +29,17 @@ elseif(SB_CONFIG_MCUBOOT_MODE_DIRECT_XIP OR SB_CONFIG_MCUBOOT_MODE_DIRECT_XIP_WI
|
|||
set(bootmode CONFIG_BOOT_DIRECT_XIP)
|
||||
elseif(SB_CONFIG_MCUBOOT_MODE_RAM_LOAD)
|
||||
set(bootmode CONFIG_BOOT_RAM_LOAD)
|
||||
elseif(SB_CONFIG_MCUBOOT_MODE_FIRMWARE_UPDATER)
|
||||
set(bootmode CONFIG_BOOT_FIRMWARE_LOADER)
|
||||
elseif(SB_CONFIG_MCUBOOT_MODE_SINGLE_APP_RAM_LOAD)
|
||||
set(bootmode CONFIG_SINGLE_APPLICATION_SLOT_RAM_LOAD)
|
||||
elseif(SB_CONFIG_MCUBOOT_MODE_FIRMWARE_UPDATER)
|
||||
set(bootmode CONFIG_BOOT_FIRMWARE_LOADER)
|
||||
|
||||
if(SB_CONFIG_MCUBOOT_MODE_FIRMWARE_UPDATER_BOOT_MODE_ENTRANCE)
|
||||
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_RETAINED_MEM y)
|
||||
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_RETENTION y)
|
||||
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_RETENTION_BOOT_MODE y)
|
||||
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_BOOT_FIRMWARE_LOADER_BOOT_MODE y)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
foreach(loopbootmode ${bootmodes})
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
# Copyright (c) 2025 Nordic Semiconductor
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# This sysbuild CMake file sets the sysbuild controlled settings as properties
|
||||
# on a firmware updater image.
|
||||
|
||||
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_BOOTLOADER_MCUBOOT "${SB_CONFIG_BOOTLOADER_MCUBOOT}")
|
||||
set_config_string(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_SIGNATURE_KEY_FILE
|
||||
"${SB_CONFIG_BOOT_SIGNATURE_KEY_FILE}"
|
||||
)
|
||||
set_config_string(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_ENCRYPTION_KEY_FILE
|
||||
"${SB_CONFIG_BOOT_ENCRYPTION_KEY_FILE}"
|
||||
)
|
||||
|
||||
if("${SB_CONFIG_SIGNATURE_TYPE}" STREQUAL "NONE")
|
||||
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_GENERATE_UNSIGNED_IMAGE y)
|
||||
else()
|
||||
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_GENERATE_UNSIGNED_IMAGE n)
|
||||
endif()
|
||||
|
||||
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER y)
|
|
@ -39,9 +39,16 @@ if(SB_CONFIG_BOOTLOADER_MCUBOOT)
|
|||
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD y)
|
||||
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_XIP n)
|
||||
set_config_int(${ZCMAKE_APPLICATION} CONFIG_FLASH_SIZE 0)
|
||||
elseif(SB_CONFIG_MCUBOOT_MODE_FIRMWARE_UPDATER)
|
||||
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER y)
|
||||
elseif(SB_CONFIG_MCUBOOT_MODE_SINGLE_APP_RAM_LOAD)
|
||||
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_BOOTLOADER_MODE_SINGLE_APP_RAM_LOAD y)
|
||||
elseif(SB_CONFIG_MCUBOOT_MODE_FIRMWARE_UPDATER)
|
||||
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER y)
|
||||
|
||||
if(SB_CONFIG_MCUBOOT_MODE_FIRMWARE_UPDATER_BOOT_MODE_ENTRANCE)
|
||||
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_REBOOT y)
|
||||
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_RETAINED_MEM y)
|
||||
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_RETENTION y)
|
||||
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_RETENTION_BOOT_MODE y)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -12,6 +12,7 @@ ExternalZephyrProject_Add(
|
|||
|
||||
# This allows for MCUboot to be included.
|
||||
sysbuild_add_subdirectory(bootloader)
|
||||
sysbuild_add_subdirectory(firmware_loader)
|
||||
|
||||
# Include zephyr modules generated sysbuild CMake file.
|
||||
foreach(SYSBUILD_CURRENT_MODULE_NAME ${SYSBUILD_MODULE_NAMES})
|
||||
|
|
|
@ -3,3 +3,4 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
rsource "bootloader/Kconfig"
|
||||
rsource "firmware_loader/Kconfig"
|
||||
|
|
|
@ -141,6 +141,14 @@ config MCUBOOT_MODE_SINGLE_APP_RAM_LOAD
|
|||
|
||||
endchoice
|
||||
|
||||
config MCUBOOT_MODE_FIRMWARE_UPDATER_BOOT_MODE_ENTRANCE
|
||||
bool "Firmware updater retention boot mode entrance"
|
||||
depends on MCUBOOT_MODE_FIRMWARE_UPDATER
|
||||
help
|
||||
Will enable retained memory, retention and the boot mode module in MCUboot and the main
|
||||
application so that it can be used to force booting the firmware loader application
|
||||
image. This needs the ``zephyr,boot-mode`` chosen node to be correctly configured.
|
||||
|
||||
config SIGNATURE_TYPE
|
||||
string
|
||||
default "NONE" if BOOT_SIGNATURE_TYPE_NONE
|
||||
|
|
11
share/sysbuild/images/firmware_loader/CMakeLists.txt
Normal file
11
share/sysbuild/images/firmware_loader/CMakeLists.txt
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Copyright (c) 2025 Nordic Semiconductor
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
if(SB_CONFIG_FIRMWARE_LOADER_IMAGE_PATH)
|
||||
ExternalZephyrProject_Add(
|
||||
APPLICATION ${SB_CONFIG_FIRMWARE_LOADER_IMAGE_NAME}
|
||||
SOURCE_DIR ${SB_CONFIG_FIRMWARE_LOADER_IMAGE_PATH}
|
||||
APP_TYPE FIRMWARE_LOADER
|
||||
)
|
||||
endif()
|
37
share/sysbuild/images/firmware_loader/Kconfig
Normal file
37
share/sysbuild/images/firmware_loader/Kconfig
Normal file
|
@ -0,0 +1,37 @@
|
|||
# Copyright (c) 2025 Nordic Semiconductor
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
config SUPPORT_FIRMWARE_LOADER_SMP_SVR
|
||||
bool
|
||||
default y
|
||||
|
||||
choice FIRMWARE_LOADER
|
||||
prompt "Firmware loader image"
|
||||
default FIRMWARE_LOADER_IMAGE_NONE
|
||||
depends on MCUBOOT_MODE_FIRMWARE_UPDATER
|
||||
|
||||
config FIRMWARE_LOADER_IMAGE_NONE
|
||||
bool "None"
|
||||
help
|
||||
Do not Include a firmware loader image in the build.
|
||||
|
||||
config FIRMWARE_LOADER_IMAGE_SMP_SVR
|
||||
bool "smp_svr"
|
||||
depends on SUPPORT_FIRMWARE_LOADER_SMP_SVR
|
||||
help
|
||||
Include the MCUmgr ``smp_svr`` sample as the firmware loader image to use.
|
||||
|
||||
endchoice
|
||||
|
||||
config FIRMWARE_LOADER_IMAGE_NAME
|
||||
string
|
||||
default "smp_svr" if FIRMWARE_LOADER_IMAGE_SMP_SVR
|
||||
help
|
||||
Name of firmware loader image.
|
||||
|
||||
config FIRMWARE_LOADER_IMAGE_PATH
|
||||
string
|
||||
default "${ZEPHYR_BASE}/samples/subsys/mgmt/mcumgr/smp_svr" if FIRMWARE_LOADER_IMAGE_SMP_SVR
|
||||
help
|
||||
Source directory of firmware loader image.
|
Loading…
Add table
Add a link
Reference in a new issue