Commit graph

129 commits

Author SHA1 Message Date
Jamie McCrae
f624525f30 kconfig: Load Kconfig env file better
Loads this file in a better way that means samples and modules
should not have to source the file before referencing Kconfig
module path variables

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-09-12 13:19:56 +02:00
Jamie McCrae
72c4af32d3 cmake: Rename option variable
Renames a variable used in a macro to avoid collisions in picolibc

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-09-05 12:27:19 +02:00
Sylvio Alves
0a339a2d7b mcuboot: kconfig: set default MOVE for Espressif SoCs
Make sure default MOVE option is enabled for Espressif SoCs.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2025-09-05 09:31:37 +02:00
Benjamin Cabé
0132ea07fb doc: fix spelling errors tree-wide
fix some spelling errors in code comments and Kconfig helps

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-09-03 17:04:13 +02:00
Jamie McCrae
4977c5cef9 scripts/kconfig/cmake: Generate/use env file for zephyr module paths
Adds a output env file that lists the paths of zephyr modules
which can be used in Kconfig files and uses this in Kconfig. Also
updates Kconfig doc output to generate and use this

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-09-03 11:03:40 +02:00
Jamie McCrae
db8f991c77 kconfig: Use $(...) instead of ${...} for getting variables
Updates this to comply with the Zephyr Kconfig recommendations

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-08-20 12:05:41 +02:00
Artur Hadasz
b43ce97c6b bootloader: mcuboot: Fix encryption not being selected in bootloader
In some cases this resulted in the device not booting.

Signed-off-by: Artur Hadasz <artur.hadasz@nordicsemi.no>
2025-08-18 10:54:37 +02:00
Artur Hadasz
9a1fe30199 bootloader: mcuboot: Changes needed to support AES256
This commit adds changes which are necessary to support
the AES256 encryption algorithm in mcuboot.

Signed-off-by: Artur Hadasz <artur.hadasz@nordicsemi.no>
2025-08-12 12:35:31 +02:00
Daniel DeGrasse
879d4ce7f3 modules: mcuboot: add Kconfigs for RAMLOAD_WITH_REVERT mode
Add Kconfigs for RAMLOAD_WITH_REVERT mode in MCUBoot. This mode works in
a manner similar to DIRECT_XIP_WITH_REVERT- namely, mcuboot will only
boot an image that is either confirmed or marked as pending. If both
images are confirmed, mcuboot will still select the one with the higher
version, so downgrading is not possible using this mode.

Signed-off-by: Daniel DeGrasse <ddegrasse@tenstorrent.com>
2025-08-05 11:53:58 +01:00
Jamie McCrae
7a76a6238d sysbuild: Default to swap using offset for MCUboot
This swapping method is more efficient than swap using move and
has been available for some time, remove experimental flag and
set it as the default except for stm32 devices which have
partition alignment for swap using move

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-07-30 06:19:53 -04:00
Flavio Ceolin
674fd094aa build: kconfig: Add support for warning insecure features
Add a new promptless Kconfig symbol (INSECURE). This symbols must
be selected by any setting which is used to enable an insecure
feature.

Signed-off-by: Flavio Ceolin <flavio@hubblenetwork.com>
2025-07-10 16:00:26 -05:00
Jamie McCrae
c8d9f4b701 sysbuild: cmake: kconfig: Fix missing sysbuild Kconfig paths
Fixes an issue where external sysbuild Kconfig path variables
were not provided and meant they could not be overwritten

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-07-07 10:14:14 -05:00
Pisit Sawangvonganan
a163f9db61 kconfig: fix typo in (arch, boards, kernel, modules, samples, share)
Utilize a code spell-checking tool to scan for and correct spelling errors
in `Kconfig` files within the `arch`, `boards`, `kernel`, `modules`,
`samples`, and `share` directory.
Additionally, incorporates a fix recommended by the reviewer.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2025-07-01 10:58:54 -10:00
Tomasz Chyrowicz
13a0f0504c sysbuild: Allow to use file suffix DTS overlays
Allow to add an image-specific DTS overlay, that is applied based on the
FILE_SUFFIX.
Up to this point, it was possible to specify such Kconfig files
(sysbuild/<image>_<file_suffix>.conf),
but it did not work with dts overlays
(sysbuild/<image>_<file_suffix>.overlay).
This commit aligns the logic of finding configuration files for both
scenarios mentioned above.

Ref: NCSDK-NONE

Signed-off-by: Tomasz Chyrowicz <tomasz.chyrowicz@nordicsemi.no>
2025-06-10 12:13:10 +02:00
Grzegorz Swiderski
da197fe9ef sysbuild: Import image devicetrees
Make the image devicetrees available to sysbuild for advanced use cases.

This is done by calling `zephyr_dt_import` on each image target. The DT
target properties are all expected to be prefixed with `DT_`, so there
should be no conflicts.

Thus, the DT contents of a given `<image>` can be retrieved using e.g.:

    dt_nodelabel(<var> NODELABEL <label> TARGET <image>)

as noted in `extensions.cmake`.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2025-05-22 13:44:18 +02:00
Jamie McCrae
a1e66b4952 sysbuild: image_configurations: Add firmware loader dtc overlay file
Adds a devicetree overlay file for the firmware loader image which
sets the code partition to slot 1, which is where the firmware loader
image resides

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-05-16 21:37:01 +02:00
Jamie McCrae
1e73b581c6 sysbuild: Add support for image configuration dtc overlay files
Adds support for using image-specific configuration devicetree
overlay files

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-05-16 21:37:01 +02:00
Jamie McCrae
8a8b91843d 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>
2025-04-25 14:03:34 +02:00
Ederson de Souza
e420b21834 share/sysbuild: Support single app slot RAM load mode
Adds a new Kconfig to support MCUboot single application slot RAM load
mode.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-04-08 16:12:33 +02:00
Jamie McCrae
9f12f8afb2 infrastructure: Remove hwmv1 support
Removes support for the deprecated hardware model version 1

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-03-13 16:53:07 +00:00
Jamie McCrae
29217b48a5 sysbuild: mcuboot: Add support for swap using offset mode
Adds a new Kconfig to allow selecting this newly introduced MCUboot
swapping algorithm

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-02-10 19:05:25 +01:00
Jamie McCrae
55dba488a4 sysbuild: Update MCUboot swap using move Kconfig name
Deprecates the old Kconfig and adds a new one which lines up with
the name of the Kconfig used by MCUboot

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-02-10 19:05:25 +01:00
Torsten Rasmussen
642e9484e3 sysbuild: populate build_info with list of images
Populate the build_info.yml created by sysbuild CMake with list of
images and write the build info file afterwards.

This allows users and external tools to examine which images was
included in the build even if one or more of those images fails CMake
configure or generate stage.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2025-02-10 15:56:52 +00:00
Benjamin Cabé
5b988356ec Revert "sysbuild: populate build_info with list of images"
This reverts commit f67939bf7e.
as it's part of a series of commits causing issues on Windows

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-01-29 09:27:31 +01:00
Torsten Rasmussen
f67939bf7e sysbuild: populate build_info with list of images
Populate the build_info.yml created by sysbuild CMake with list of
images and write the build info file afterwards.

This allows users and external tools to examine which images was
included in the build even if one or more of those images fails CMake
configure or generate stage.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2025-01-27 13:24:23 +01:00
Grzegorz Swiderski
17ba479585 sysbuild: Fix Kconfig symbol SIGNATURE_TYPE
Add missing quotes around string values, so that they won't be
interpreted as undefined symbol names.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2025-01-17 16:35:53 +01:00
Jamie McCrae
aed59d4431 sysbuild: cmake: modules: kconfig: Fix changed CMake API
Fixes a bug which was caused by the CMake function API having
changed in commit 4e29a35b22

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-12-27 10:51:56 +01:00
Jamie McCrae
0711f42e3a sysbuild: Add support for snippets
Adds support for sysbuild loading snippets, these can be included
by using e.g.: cmake ... -DSB_SNIPPET=blah for sysbuild
directly or can be used with an application and sysbuild using
-DSNIPPET. Snippets for sysbuild can use SB_EXTRA_CONF_FILE in the
snippet file to specify an extra Kconfig fragment for sysbuild

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-12-27 07:18:13 +01:00
Jamie McCrae
f277631b60 sysbuild: Add missing option for MCUboot encryption support
Adds a missing 'default y' for the Kconfig option indicating that
encryption is supported with the current configuration

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-10-30 08:54:33 -05:00
Torsten Rasmussen
536d34fa7a cmake: scripts: support board extension
Fixes: #69548

Support extending an existing board with new board variants.

This commit introduces the following changes to allow a board to be
extended out-of-tree.

The board yaml schema is extended to support an extend field which
will be used to identify the board to be extended.

A board 'plank' can be extended like this:
> board:
>   extend: plank
>   variants:
>     - name: ext
>       qualifier: soc1

For the rest of the build system this means that there is no longer a
single board directory.
The existing CMake variable BOARD_DIR is kept and reference the
directory which defines the board.
A new CMake variable BOARD_DIRECTORIES provides a list of all
directories which defines board targets for the board.
This means the directory which defines the board as well as all
directories that extends the board.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-10-26 17:14:06 +02:00
Jamie McCrae
9e1b3bbb65 sysbuild: images: bootloader: kconfig: Limit encryption
Limits selecting the encryption option to MCUboot operating modes
that support it

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-10-23 16:53:05 +02:00
Jamie McCrae
3406515f12 sysbuild: images: bootloader: Add RAM load note
Adds a note about MCUboot RAM requirements for this

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-10-11 13:19:39 -04:00
Jamie McCrae
646f116cca mcuboot: Add support for RAM load mode
Adds supporting code that allows the RAM load mode of MCUboot to
be used and for applications to build successfully with it.
Sysbuild can be used to build images for this mode

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-10-11 13:19:39 -04:00
Jamie McCrae
8774f15bd2 sysbuild: cmake: Add set_config_int() function
Adds a function that will add an integer value to an image

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-10-11 13:19:39 -04:00
Torsten Rasmussen
09faf537dd cmake: support build info in Zephyr
Store informations regarding the current Zephyr build.
The following informations are stored during CMake configure:
- Board information
- Application source directory
- Application configuration directory
- Toolchain information
- Devicetree files
- Kconfig config files
- Zephyr version

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-10-08 17:00:30 +02:00
Jamie McCrae
96c6c7863a sysbuild: cmake: Fix ExternalZephyrProject_Add() revision handling
Fixes an issue with HWMv2 boards whereby the specified board
revision was not applied at the correct place, which would cause
the target image to fail configuration

Fixes #79208

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-10-02 13:43:59 -05:00
Torsten Rasmussen
1bea5fcacb sysbuild: fix extra kconfig targets when using sysbuild
Zephyr provides a feature to hook in custom menuconfig implementations
by setting EXTRA_KCONFIG_TARGETS and then defining the corresponding
command to invoke as EXTRA_KCONFIG_TARGET_COMMAND_FOR_<target>.

This feature is broken with sysbuild because sysbuild will try to create
multiple custom targets with identical names.

This commit fix the sysbuild handling of extra kconfig targets.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-09-16 20:19:09 +02:00
Torsten Rasmussen
105a4b5eb2 cmake: initial version of a CMake yaml module
Initial CMake yaml module to facilitate reading yaml files into CMake,
update yaml settings and write it back to a file.

The yaml module also supports creation of yaml files from scratch.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-08-23 08:02:11 -04:00
Jamie McCrae
9566aa5b00 sysbuild: Add MCUboot operating mode
Adds a sysbuild Kconfig to select the operating mode of MCUboot
which is then propagated to the MCUboot and application images

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-08-12 15:14:45 +02:00
Torsten Rasmussen
6f5b183de7 sysbuild: check for existence of APPLICATION_CONFIG_DIR
Check for existence of APPLICATION_CONFIG_DIR in sysbuild.
sysbuild.conf is an optional file, meaning that sysbuild will not fail
if APPLICATION_CONFIG_DIR points to a non-existing folder.

A normal Zephyr build already fails when passing an invalid
APPLICATION_CONFIG_DIR but only because it cannot find a required
prj.conf in the folder.

Checking the existence of APPLICATION_CONFIG_DIR in sysbuild and fail
the build when a non-existing folder is passed to sysbuild ensures
sysbuild behaves similar to a normal Zephyr build regarding a
non-existing folder, while still allow sysbuild.conf itself to be
optional.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-06-27 10:58:11 -04:00
Torsten Rasmussen
be2993be6e sysbuild: move sysbuild/application to _sysbuild
The sysbuild part of sysbuild/application creates a sysbuild/application
folder under top-level build dir. However, having a sysbuild folder at
this level means that tab completion for sysbuild pre-fixed build
targets will stop after completing just `sysbuild` and then show several
subfolders, making it hard to see important build targets, such as:
`ninja sysbuild_menuconfig`.

As `sysbuild/application` is just a folder name, then move it to
`_sysbuild` instead to avoid impacting tab completion for  ninja and
make.

Also strip the `application` part in the process, as the extra folder
doesn't provide any extra benefit, but is just one more level to enter
when browsing the build folder structure.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-06-17 12:10:43 -04:00
Torsten Rasmussen
a54c117223 sysbuild: set APPLICATION_BINARY_DIR to sysbuild CMake folder
If not defined by caller, then set APPLICATION_BINARY_DIR to
CMAKE_CURRENT_BINARY_DIR. This is normally be done by
`find_package(Zephyr)`, but due to the indirection introduced with
fc1884ecf5 to allow applications to
provide their own sysbuild entry point, then the APPLICATION_BINARY_DIR
is unexpectedly set to the bin dir of the entry point.

Restore the old behavior so that APPLICATION_BINARY_DIR per default
again points to top-level sysbuild binary dir.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-06-17 12:10:43 -04:00
Torsten Rasmussen
5722576186 sysbuild: clear local scope EXTRA_CONF_FILE variable
Sysbuild sets the EXTRA_CONF_FILE before loading kconfig.cmake.
This hides any user defined EXTRA_CONF_FILE added to the sysbuild cache.

Clear the local sysbuild EXTRA_CONF_FILE so that the hidden cache
variable re-enters current scope.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-06-13 17:51:14 +02:00
Jamie McCrae
4fcde701ec sysbuild: Use UTF-8 encoding for cache
Fixes an issue whereby strings are placed in UTF-8 format but the
application doesn't read them in when configured using sysbuild
and another issue whereby sysbuild then reads the application's
cache and did not treat them as UTF-8

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-06-13 05:31:50 -04:00
Torsten Rasmussen
24acc7d43d sysbuild: introduce sysbuild_root for root adjustment
Fixes: #73066

Introduce sysbuild_root CMake module similar to the Zephyr root CMake
module. The sysbuild_root CMake module works similar to existing root
module, but with the difference that root paths are adjusted relative to
APP_DIR which is the main image, instead of relative to sysbuild.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-05-30 11:55:01 +01:00
Torsten Rasmussen
f7d2cc2d43 cmake: use zephyr_get() and zephyr_file() for APPLICATION_CONFIG_DIR
Fixes: #73065

Update APPLICATION_CONFIG_DIR is Zephyr CMake and sysbuild to follow
the common principle in Zephyr for relative paths.

This means that relative paths are taken from the application source
directory when specified on command line, and require local scoped
defined APPLICATION_CONFIG_DIR to be given as absolute, for example by
using CMAKE_CURRENT_LIST_DIR.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-05-30 08:59:25 +02:00
Torsten Rasmussen
2b427f19d5 sysbuild: add support for APPLICATION_CONFIG_DIR in sysbuild
APPLICATION_CONFIG_DIR is supported in Zephyr and allows to adjust the
location from which prj.conf and friends are picked up.

This also works for images when using sysbuild, however sysbuild itself
ignores the value of APPLICATION_CONFIG_DIR, meaning that sysbuild only
accepts sysbuild.conf located directly in the sample folder.

Extend sysbuild to support APPLICATION_CONFIG_DIR so sysbuild follows
regular Zephyr CMake behavior.

Introduce SB_APPLICATION_CONFIG_DIR to allow changing the location
for sysbuild only, without propagating the value to images.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-05-27 14:05:38 +01:00
Torsten Rasmussen
fc1884ecf5 sysbuild: support sysbuild/CMakeLists.txt as entry point for samples
This commit refactors sysbuild entry code by creating a CMake sysbuild
module for image processing and place sysbuild entry code in a
<app>/sysbuild/CMakeLists.txt file.

A template/CMakeLists.txt file will be use as template for applications
which doesn't provide their own entry file.

An application may create a sysbuild/CMakeLists.txt file.
The sysbuild/CMakeLists.txt file is similar in nature to the
toplevel CMakeLists.txt file but intended to used by sysbuild.
This allows application developers to adjust how an application is
built with sysbuild.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-05-27 14:05:38 +01:00
Torsten Rasmussen
e65c6328ce sysbuild: use ARGN instead of ARGV1
Use of ARGV1 is undefined when number of arguments to function is less
than 2. Therefore switch to ARGN which holds arguments beyond required
arguments.
If there are no optional arguments, then ARGN is just an empty list,
thus making it safe to use.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-05-27 14:05:38 +01:00
Håkon Amundsen
9a47ee00fa sysbuild: cmake: fix incorrect function name in error message
The name in the error message does not match the function name.

Signed-off-by: Håkon Amundsen <haakon.amundsen@nordicsemi.no>
2024-05-04 12:59:51 +03:00