Skip to content

Commit 7ddde9c

Browse files
committed
sysbuild: Add updateable application type
Add a new external application type that will be configured in a way to produce signed update candidate. Ref: NCSDK-33316 Signed-off-by: Tomasz Chyrowicz <[email protected]>
1 parent 684fe9d commit 7ddde9c

File tree

2 files changed

+47
-2
lines changed

2 files changed

+47
-2
lines changed

share/sysbuild/cmake/modules/sysbuild_extensions.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,19 +204,21 @@ endfunction()
204204
# BOARD <board>: Use <board> for application build instead user defined BOARD.
205205
# BOARD_REVISION <revision>: Use <revision> of <board> for application (only valid if
206206
# <board> is also supplied).
207-
# APP_TYPE <MAIN|BOOTLOADER>: Application type.
207+
# APP_TYPE <MAIN|BOOTLOADER|UPDATEABLE>: Application type.
208208
# MAIN indicates this application is the main application
209209
# and where user defined settings should be passed on as-is
210210
# except for multi image build flags.
211211
# For example, -DCONF_FILES=<files> will be passed on to the
212212
# MAIN_APP unmodified.
213213
# BOOTLOADER indicates this app is a bootloader
214+
# UPDATEABLE indicates this app is updateable and the bootloader
215+
# settings should be passed on.
214216
# BUILD_ONLY <bool>: Mark the application as build-only. If <bool> evaluates to
215217
# true, then this application will be excluded from flashing
216218
# and debugging.
217219
#
218220
function(ExternalZephyrProject_Add)
219-
set(app_types MAIN BOOTLOADER FIRMWARE_LOADER)
221+
set(app_types MAIN BOOTLOADER FIRMWARE_LOADER UPDATEABLE)
220222
cmake_parse_arguments(ZBUILD "" "APPLICATION;BOARD;BOARD_REVISION;SOURCE_DIR;APP_TYPE;BUILD_ONLY" "" ${ARGN})
221223

222224
if(ZBUILD_UNPARSED_ARGUMENTS)
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Copyright (c) 2024 Nordic Semiconductor
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
# This sysbuild CMake file sets the sysbuild controlled settings as properties
6+
# on all images.
7+
8+
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_BOOTLOADER_MCUBOOT "${SB_CONFIG_BOOTLOADER_MCUBOOT}")
9+
set_config_string(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_SIGNATURE_KEY_FILE
10+
"${SB_CONFIG_BOOT_SIGNATURE_KEY_FILE}"
11+
)
12+
set_config_string(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_ENCRYPTION_KEY_FILE
13+
"${SB_CONFIG_BOOT_ENCRYPTION_KEY_FILE}"
14+
)
15+
16+
if(SB_CONFIG_BOOTLOADER_MCUBOOT)
17+
if("${SB_CONFIG_SIGNATURE_TYPE}" STREQUAL "NONE")
18+
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_GENERATE_UNSIGNED_IMAGE y)
19+
else()
20+
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_GENERATE_UNSIGNED_IMAGE n)
21+
endif()
22+
23+
if(SB_CONFIG_MCUBOOT_MODE_SINGLE_APP)
24+
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_BOOTLOADER_MODE_SINGLE_APP y)
25+
elseif(SB_CONFIG_MCUBOOT_MODE_SWAP_WITHOUT_SCRATCH)
26+
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_BOOTLOADER_MODE_SWAP_WITHOUT_SCRATCH y)
27+
elseif(SB_CONFIG_MCUBOOT_MODE_SWAP_SCRATCH)
28+
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_BOOTLOADER_MODE_SWAP_SCRATCH y)
29+
elseif(SB_CONFIG_MCUBOOT_MODE_OVERWRITE_ONLY)
30+
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_BOOTLOADER_MODE_OVERWRITE_ONLY y)
31+
elseif(SB_CONFIG_MCUBOOT_MODE_DIRECT_XIP)
32+
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP y)
33+
elseif(SB_CONFIG_MCUBOOT_MODE_DIRECT_XIP_WITH_REVERT)
34+
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT y)
35+
elseif(SB_CONFIG_MCUBOOT_MODE_RAM_LOAD)
36+
# RAM load mode requires XIP be disabled and flash size be set to 0
37+
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD y)
38+
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_XIP n)
39+
set_config_int(${ZCMAKE_APPLICATION} CONFIG_FLASH_SIZE 0)
40+
elseif(SB_CONFIG_MCUBOOT_MODE_FIRMWARE_UPDATER)
41+
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER y)
42+
endif()
43+
endif()

0 commit comments

Comments
 (0)