Skip to content

Commit f655493

Browse files
committed
cmake: support MCUBoot bootloader natively with SYSBuild
This commit adds CMake and Kconfig files needed to build MCUboot as an extra image using SYSBuild. Building an application with MCUBoot using SYSBuild allows users to build both images using a single build. Signed-off-by: Torsten Rasmussen <[email protected]>
1 parent 1a71ce8 commit f655493

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

share/sysbuild/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ ExternalZephyrProject_Add(
3737
MAIN_APP
3838
)
3939

40+
add_subdirectory(bootloader)
41+
4042
# This allows for board and app specific images to be included.
4143
include(${BOARD_DIR}/sysbuild.cmake OPTIONAL)
4244
include(${APP_DIR}/sysbuild.cmake OPTIONAL)

share/sysbuild/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,5 @@ config WARN_DEPRECATED
3232
help
3333
Print a warning when the Kconfig tree is parsed if any deprecated
3434
features are enabled.
35+
36+
rsource "bootloader/Kconfig"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright (c) 2022 Nordic Semiconductor
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
# Include MCUboot if enabled.
6+
if(SB_CONFIG_BOOTLOADER_MCUBOOT)
7+
ExternalZephyrProject_Add(
8+
APPLICATION mcuboot
9+
SOURCE_DIR ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr/
10+
)
11+
endif()

share/sysbuild/bootloader/Kconfig

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright (c) 2022 Nordic Semiconductor
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
config SUPPORT_BOOTLOADER
6+
bool
7+
default y
8+
9+
config SUPPORT_BOOTLOADER_MCUBOOT_ZEPHYR
10+
bool
11+
default y
12+
13+
choice BOOTLOADER
14+
prompt "Bootloader support"
15+
default BOOTLOADER_NONE
16+
depends on SUPPORT_BOOTLOADER
17+
18+
config BOOTLOADER_NONE
19+
bool "None"
20+
help
21+
Do not Include a bootloader in the build
22+
23+
config BOOTLOADER_MCUBOOT
24+
bool "MCUboot"
25+
depends on SUPPORT_BOOTLOADER_MCUBOOT_ZEPHYR
26+
help
27+
Include MCUboot (Zephyr port) as the bootloader to use
28+
29+
endchoice

0 commit comments

Comments
 (0)