-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Zephyr sysbuild / multi image #40555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
b1d1c24
32a28ef
a0665bf
1a71ce8
f655493
86dda45
4ec16a3
b719e15
70e05e2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| # Copyright (c) 2021 Nordic Semiconductor | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| cmake_minimum_required(VERSION 3.20) | ||
|
|
||
| if(NOT DEFINED APP_DIR) | ||
| message(FATAL_ERROR "No main application specified") | ||
| endif() | ||
|
|
||
| # This will update the APP_DIR cache variable to PATH type and apply a comment. | ||
| # If APP_DIR is a relative path, then CMake will adjust to absolute path based | ||
| # on current working dir. | ||
| set(APP_DIR ${APP_DIR} CACHE PATH "Main Application Source Directory") | ||
|
|
||
| # Add sysbuild/cmake/modules to CMAKE_MODULE_PATH which allows us to integrate | ||
| # sysbuild CMake modules with general Zephyr CMake modules. | ||
| list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake/modules) | ||
| # List of Zephyr and sysbuild CMake modules we need for sysbuild. | ||
| # Note: sysbuild_kconfig will internally load kconfig CMake module. | ||
| set(zephyr_modules extensions sysbuild_extensions python west root zephyr_module boards shields sysbuild_kconfig) | ||
|
|
||
| find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} COMPONENTS ${zephyr_modules}) | ||
|
|
||
| project(sysbuild LANGUAGES) | ||
|
|
||
| # Global list of images enabled in this multi image build system. | ||
| set(IMAGES) | ||
|
|
||
| get_filename_component(APP_DIR ${APP_DIR} ABSOLUTE) | ||
| get_filename_component(app_name ${APP_DIR} NAME) | ||
|
|
||
| # This adds the primary application to the build. | ||
| ExternalZephyrProject_Add( | ||
| APPLICATION ${app_name} | ||
| SOURCE_DIR ${APP_DIR} | ||
| MAIN_APP | ||
| ) | ||
|
|
||
| add_subdirectory(bootloader) | ||
|
|
||
| # This allows for board and app specific images to be included. | ||
| include(${BOARD_DIR}/sysbuild.cmake OPTIONAL) | ||
| include(${APP_DIR}/sysbuild.cmake OPTIONAL) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # Copyright (c) 2021 Nordic Semiconductor | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| comment "Sysbuild image configuration" | ||
|
|
||
| osource "$(BOARD_DIR)/Kconfig.sysbuild" | ||
|
|
||
| config EXPERIMENTAL | ||
| bool | ||
| help | ||
| Symbol that must be selected by a feature if it is considered to be | ||
| at an experimental implementation stage. | ||
|
|
||
| config WARN_EXPERIMENTAL | ||
| bool | ||
| prompt "Warn on experimental usage" | ||
| help | ||
| Print a warning when the Kconfig tree is parsed if any experimental | ||
| features are enabled. | ||
|
|
||
| config DEPRECATED | ||
| bool | ||
| help | ||
| Symbol that must be selected by a feature or module if it is | ||
| considered to be deprecated. | ||
|
|
||
| config WARN_DEPRECATED | ||
| bool | ||
| default y | ||
| prompt "Warn on deprecated usage" | ||
| help | ||
| Print a warning when the Kconfig tree is parsed if any deprecated | ||
| features are enabled. | ||
|
|
||
| rsource "bootloader/Kconfig" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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() |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -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 | ||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I understand there is dedicated namespace for these Kconfig properties (and will never merge to with the application properties).
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe the help text can definitely be improved. But whether we should invent two different setting names or have them identical as now depends a lot on how you look at this. The Zephyr setting states: Lines 682 to 686 in 83d73f6
and my view on this is that this is also true for the sysbuild zephyr/share/sysbuild/CMakeLists.txt Lines 33 to 37 in 70e05e2
Of course sysbuild itself does one more thing which the application itself cannot do, and that is building and flashing of MCUboot in addition. I believe having identical name for |
||||||||||||||||||||||
| bool "MCUboot" | ||||||||||||||||||||||
| depends on SUPPORT_BOOTLOADER_MCUBOOT_ZEPHYR | ||||||||||||||||||||||
| help | ||||||||||||||||||||||
| Include MCUboot (Zephyr port) as the bootloader to use | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| endchoice | ||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.