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 <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
Torsten Rasmussen 2022-06-22 11:19:05 +02:00 committed by Carles Cufí
commit 3d520dde2b
4 changed files with 44 additions and 0 deletions

View file

@ -37,6 +37,8 @@ ExternalZephyrProject_Add(
MAIN_APP MAIN_APP
) )
add_subdirectory(bootloader)
# This allows for board and app specific images to be included. # This allows for board and app specific images to be included.
include(${BOARD_DIR}/sysbuild.cmake OPTIONAL) include(${BOARD_DIR}/sysbuild.cmake OPTIONAL)
include(${APP_DIR}/sysbuild.cmake OPTIONAL) include(${APP_DIR}/sysbuild.cmake OPTIONAL)

View file

@ -32,3 +32,5 @@ config WARN_DEPRECATED
help help
Print a warning when the Kconfig tree is parsed if any deprecated Print a warning when the Kconfig tree is parsed if any deprecated
features are enabled. features are enabled.
rsource "bootloader/Kconfig"

View file

@ -0,0 +1,11 @@
# Copyright (c) 2022 Nordic Semiconductor
#
# SPDX-License-Identifier: Apache-2.0
# Include MCUboot if enabled.
if(SB_CONFIG_BOOTLOADER_MCUBOOT)
ExternalZephyrProject_Add(
APPLICATION mcuboot
SOURCE_DIR ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr/
)
endif()

View file

@ -0,0 +1,29 @@
# Copyright (c) 2022 Nordic Semiconductor
#
# SPDX-License-Identifier: Apache-2.0
config SUPPORT_BOOTLOADER
bool
default y
config SUPPORT_BOOTLOADER_MCUBOOT_ZEPHYR
bool
default y
choice BOOTLOADER
prompt "Bootloader support"
default BOOTLOADER_NONE
depends on SUPPORT_BOOTLOADER
config BOOTLOADER_NONE
bool "None"
help
Do not Include a bootloader in the build
config BOOTLOADER_MCUBOOT
bool "MCUboot"
depends on SUPPORT_BOOTLOADER_MCUBOOT_ZEPHYR
help
Include MCUboot (Zephyr port) as the bootloader to use
endchoice