Commit graph zephyr/share
Author SHA1 Message Date
Pisit Sawangvonganan
c9c9324090 share: sysbuild: fix typo
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within:
- `share/sysbuild`

Assisted-by: Claude:claude-sonnet-5-5 codespell
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2026-10-06 07:31:14 +02:00
Torsten Rasmussen
d12eedd6d2 Revert "sysbuild: Move sysbuild cmake presets"
This reverts commit 48b74cb08a.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2026-09-28 07:38:57 -04:00
Jamie McCrae
28a5f5f983 kconfig: Error out on deprecated usage when requested
Adds a new Kconfig to both Zephyr and sysbuild,
``DEPRECATED_KCONFIGS_AS_ERRORS`` which, when enabled, will cause
a build to fail if a deprecated Kconfig is enabled. This is being
introduced to ensure API lifecycle policy is being followed when
features are deprecated

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-09-23 19:28:02 +02:00
Benjamin Cabé
59b88a707f sysbuild: document the Kconfig and root modules
Describe sysbuild's own Kconfig tree and the root list conversion, and
add pages for the variables they take as input.

The sysbuild_root header listed five roots but handles six; SNIPPET_ROOT
is now included.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
2026-09-23 19:16:15 +02:00
Benjamin Cabé
be59355ce8 sysbuild: document native simulator extension commands
The three native_simulator_* commands are called from the sysbuild.cmake
of 41 boards and tests, but were only described in comments.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
2026-09-23 19:16:15 +02:00
Benjamin Cabé
2f4487f3d3 sysbuild: document extension commands using the CMake domain
Convert the doc comments of the sysbuild extension commands that
applications and Zephyr modules call from their sysbuild.cmake into
reStructuredText blocks, so they can be rendered and cross-referenced.

set_config_bool(), set_config_string() and set_config_int() had no
documentation at all.

Commands only invoked by sysbuild itself are left as plain comments.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
2026-09-23 19:16:15 +02:00
Sylvio Alves
51ef282b5f sysbuild: espressif: use the generic mcuboot defaults
The Espressif SoC sysbuild fragment forced MCUboot into
overwrite-only mode, which leaves no image to revert to, and the
bootloader Kconfig still preferred the older swap using move for
the family. Remove both so these SoCs get swap using offset like
every other target, and document the change in the migration
guide.

Assisted-by: Claude:opus-5
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-09-09 07:43:41 +02:00
Dan Egnor
5ffee33885 sysbuild: forward Python variables to variant images
Forward WEST_PYTHON and Python3_EXECUTABLE in
ExternalZephyrVariantProject_Add() to match ExternalZephyrProject_Add().

Signed-off-by: Dan Egnor <egnor@ofb.net>
2026-09-07 10:32:26 +02:00
Anas Nashif
49fbfe37f6 sysbuild: forward TC_RUNID to images
twister passes -DTC_RUNID to the top-level build so that
subsys/testsuite/ztest can embed a per-instance run id into the test
image. For sysbuild builds the variable only reached the sysbuild
project itself and was never propagated to the images, where ztest
consumes it at configure time, so test images built with sysbuild
silently lost their RunID markers and twister's run id verification
never ran for them.

Add TC_RUNID to the CMake variables shared with every image.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-09-03 09:42:14 +02:00
Benjamin Cabé
2c1264e73b cmake: remove deprecated ZephyrUnittest CMake package
The ZephyrUnittest package has printed a deprecation warning since
Zephyr 3.1, when it was replaced by the unittest component of the
Zephyr package: find_package(Zephyr COMPONENTS unittest). Remove the
package files, stop registering the package in west zephyr-export, and
drop the compatibility branch from ZephyrConfig.cmake.

Stale ZephyrUnittest entries in the CMake user package registry are
harmless: find_package(ZephyrUnittest) now simply fails to locate a
usable package instead of loading the compatibility shim.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-31 07:00:13 -04:00
Betronic fvdij
48b74cb08a sysbuild: Move sysbuild cmake presets
Move the sysbuild (root process) included presets
to the sysbuild configuration folder.
Reusing the app's cmake presets will generate
unused variable warnings for sysbuild configuration
vars when compiling the app.

Signed-off-by: Betronic fvdij <betronic-fvdij@proton.me>
2026-08-20 10:50:25 +02:00
Benjamin Cabé
dfafa1f4f9 build: cmake: deprecate zephyr_file_copy()
zephyr_file_copy() only existed because file(COPY_FILE ...) was not
available with CMake 3.20. With the minimum required CMake version now
being 3.28.3, call the native command directly everywhere in-tree and
deprecate the wrapper, which is kept for out-of-tree users.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-03 15:03:35 -04:00
Benjamin Cabé
a119dbf957 build: bump minimum CMake version to 3.28.0
Raise the minimum required CMake version from 3.20.0 (documented as
3.20.5) to 3.28.0, which is satisfied by the CMake 3.28.3 package
shipped in the Ubuntu 24.04 LTS repositories. Ubuntu 24.04 is the
current Ubuntu LTS release targeted by the Zephyr getting started
guide, and by the time of the next Zephyr release, Ubuntu 22.04 will be
within months of its end of standard support. Users of distributions
shipping an older CMake can use the Kitware APT repository or a
pip-installed CMake, as the documentation already suggests.

Raising the floor to 3.28 unlocks a range of modern CMake features for
the build system, among which the cmake_file_api() command (3.27),
file(COPY_FILE) (3.21), block()/endblock() (3.25), and allows removal
of several version-conditional workarounds.

The tree-wide cmake_minimum_required() occurrences in samples, tests
and boards are updated accordingly, together with the documentation
and the sysbuild CMake presets. The IAR C-STAT integration keeps its
own higher requirement (4.1.0).

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-03 15:03:35 -04:00
JP Hutchins
e8c5edf405 mcuboot: support multiple signing keys
SB_CONFIG_BOOT_SIGNATURE_KEY_FILE now accepts a comma-separated list of
PEM paths in addition to a single path. When a list is given, the MCUboot
bootloader embeds the public half of every key and accepts an image
signed with any of them. The first entry is also the key the application
is signed with; every entry past the first must be a public-only PEM of
the same signature type (MCUboot enforces this at build time with
'imgtool keyinfo --require public'). A common use is a development
bootloader that boots both development- and production-signed images
while never holding the production private key.

The keys the bootloader embeds and the single key the application is
signed with are both derived from this one list through the sysbuild
helpers sysbuild_mcuboot_resolve_signature_key_files() and
sysbuild_mcuboot_application_signature_key_file(). Entries are forwarded
verbatim for each image to resolve, so a single-key value behaves exactly
as before and no previously working configuration breaks.

The feature is exercised at runtime by tests/boot/mcuboot_multiple_keys,
which builds a two-key bootloader on the mps2/an385 QEMU machine and
boots an application signed with either embedded key, asserting MCUboot
validates it against the matching key (key_id 0 and key_id 1). The two
keys are MCUboot's own ed25519 test keys: a development key (key_id 0)
and a production key embedded by its public half only (key_id 1). The
application is signed at build time with the development key; the second
scenario re-signs the built image with the production key afterwards,
the way a production custodian signs a release binary out-of-band, so
the production private key never enters the build configuration.

Signed-off-by: JP Hutchins <jp@intercreate.io>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 14:45:45 -05:00
Torsten Rasmussen
5014a35c51 sysbuild: pass ZEPHYR_BASE to images
Ensure same ZEPHYR_BASE is used by sysbuild and Zephyr images.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2026-06-19 22:40:01 +02:00
Daniel DeGrasse
bd9225dd0f sysbuild: support CONFIG_MCUBOOT_MODE_RAM_LOAD with CONFIG_XIP=y
For some use cases (such as Harvard architectures with code and data
memory), it may be desirable to link an application to SRAM with
CONFIG_XIP=y so that the application will utilize a different SRAM
region for execution than it does for data.

To support this with MCUBoot, add CONFIG_MCUBOOT_RAMLOAD_ALLOW_XIP

Signed-off-by: Daniel DeGrasse <daniel.degrasse@analog.com>
2026-06-16 12:55:26 -05:00
Jamie McCrae
08e1d5c2be sysbuild: Fix merged hex output
Fixes some issues with merged hex output, parses images to get the
hex files that are flashed then uses that as the input for the
merged hex output. Also allows sysbuild modules to add custom
dependencies to the merged hex output if they generate the images

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-05-21 06:31:53 -04:00
Guðni Már Gilbert
400411f261 cmake: modules: remove temporary file
Remove the temporary file once its no longer needed.

Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
2026-05-12 09:04:53 +02:00
Grzegorz Swiderski
ab9ce931fd cmake: kconfig: Skip creating Kconfig target on a variant image
This replaces a workaround in `ExternalZephyrVariantProject_Add()` -
setting KCONFIG_TARGETS-NOTFOUND - which turned out to be incomplete.
For example, it had no way of accounting for EXTRA_KCONFIG_TARGETS
(which could be set on the command line or through something like
`ZephyrBuildConfig.cmake`).

Instead, the creation of `menuconfig` and friends can be gated on
KCONFIG_VARIANT_SOURCE, which is the variable sysbuild uses to forward
the source configuration to the variant image. This way, both lists of
Kconfig targets are excluded reliably.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2026-05-11 13:41:35 +02:00
Jamie McCrae
730b44f422 sysbuild: Add variant image CMake module file
Adds variant image handling CMake code which re-uses parts of the
original dts CMake module code but applies variant-specific parts

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-04-27 14:14:35 +02:00
Jamie McCrae
dfa6c9562d share: zephyr-package: cmake: Append zephyr base module dir
Changes prepend to append to allow for things to override modules
e.g. sysbuild

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-04-27 14:14:35 +02:00
Jamie McCrae
01cf5768a0 sysbuild: cmake: Use supplied image for variant source image
Fixes wrongly using the default image instead of the supplied
user image in the variant image function

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-03-16 19:06:50 -05:00
Torsten Rasmussen
f6aff5b460 cmake: align SNIPPET_ROOT with other Zephyr '<type>_ROOT' lists
Zephyr `<type>_ROOT`s, such as `BOARD_ROOT`, `DTS_ROOT`, `SCA_ROOT`,
are initialed by ROOT settings provided through CMake variable
`<type>_ROOT`, Zephyr base, and root settings specified in Zephyr
module's `zephyr/module.yml` file.

`SNIPPET_ROOT` didn't follow the same pattern as it also included
application source dir.

This commit aligns `SNIPPET_ROOT` to follow same principle for
constructing other Zephyr `<type>_ROOT` lists.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2026-02-03 13:08:20 +01:00
Torsten Rasmussen
3a31002dd7 sysbuild: use ZEPHYR_SHARED_TARGETS instead of hard-coded targets
Remove the hard-coded target knowledge of menuconfig, hardenconfig, and
guiconfig and instead use the ZEPHYR_SHARED_TARGETS provided by the
Zephyr image.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2026-01-27 08:39:52 -05:00
Torsten Rasmussen
a0983a2f91 cmake: align board qualifiers in CMake with Kconfig
The value os board qualifiers in CMake and Kconfig differs.
CMake has a leading '/', as example:
CMake:   BOARD_QUALIFIERS=/nrf52840
Kconfig: BOARD_QUALIFIERS=nrf52840

This was also discussed in
https://github.com/zephyrproject-rtos/zephyr/pull/69740

This commit aligns the value of the CMake variable BOARD_QUALIFIERS to
the value of BOARD_QUALIFIERS (CONFIG_BOARD_QUALIFIERS) in Kconfig.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2026-01-27 10:52:37 +00:00
Jamie McCrae
ec19a0d649 sysbuild: Only load Kconfig/dts image files if they exist
If they do not exist, do not load them

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-01-26 10:15:13 -06:00
Jamie McCrae
5ccfb179f0 sysbuild: Link MCUboot output with main app configuration
Links the output from the default MCUboot build with the estimated
size of the overhead with the main image. This also allowes used
to remove the linkage between them, if they so wish

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-01-26 14:17:06 +01:00
Jamie McCrae
8312b20ca9 sysbuild: Add ability to generate slot 1 variant image
Adds a new experimental Kconfig option to sysbuild which allows
generating a variant image to use with MCUboot in direct-xip mode.
It also includes base sysbuild infrastructure for creating
additional variant images in future (including out-of-tree),
whereby they use the base configuration of an existing image but
modify it, without creating the default zephyr extra targets for
images (e.g. menuconfig) to prevent changing configuration that
should not be changed.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-01-20 15:31:06 +00:00
Wilfried Chauveau
b25ecfd358 cmake: sysbuild: propagate WEST_PYTHON & Python3_EXECUTABLE
Without this, the parent CMake and the sub-processes may use different
Python environment.

Co-authored-by: Torsten Tejlmand Rasmussen <torsten.rasmussen@nordicsemi.no>
Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
2026-01-19 12:20:01 +01:00
Jamie McCrae
feadf2e8ef sysbuild: Add optional output merged hex file support
Adds support for generated merged hex file output, one hex file
per unique board target. This feature can be enabled with
SB_CONFIG_MERGED_HEX_FILES

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-01-12 11:52:58 +01:00
Fabrice DJIATSA
b152f71aaa modules: kconfig: mcuboot: make SWAP_USING_OFFSET the default for STM32
Update MCUboot configuration so that STM32 no longer defaults to
SWAP_USING_MOVE. Instead, SWAP_USING_OFFSET becomes the default mode
for STM32 boards.

Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
2025-12-15 17:08:14 +00:00
Jamie McCrae
356f992f68 sysbuild: cmake: Only touch empty conf file if it does not exist
Prevents a random occurance whereby sysbuild reconfigures itself
after a reconfiguration for no known discernable reason

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2025-12-06 11:38:41 -05:00
Josuah Demangeon
0c4ab40921 style: share: apply coding style on CMakeLists.txt files
Apply the CMake style guidelines to CMakeList.txt files in share/.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-11-17 13:48:03 -05:00
Torsten Rasmussen
f26d245914 sysbuild: exclude APPLICATION_SOURCE_DIR from sysbuild image cache file
APPLICATION_SOURCE_DIR is image specific and the value inside sysbuild
points to sysbuild itself.

This gives wrong results when a sample uses
`zephyr_get(APPLICATION_SOURCE_DIR)` as it will fetch the sysbuild value
and not its own value.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2025-11-13 23:15:45 +02:00
Jamie McCrae
e341b0e481 sysbuild: bootloader: Remove deprecated Kconfig
Removes the previously deprecated
SB_CONFIG_MCUBOOT_MODE_SWAP_WITHOUT_SCRATCH sysbuild Kconfig

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-11-13 23:09:55 +02:00
Anas Nashif
303af992e5 style: fix 'if (' usage in cmake files
Replace with 'if(' and 'else(' per the cmake style guidelines.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-10-29 11:44:13 +02:00
Torsten Rasmussen
b88e615339 sysbuild: support application CMakePresets.json files with sysbuild
This commit provides a CMakePresets.json which includes the sample's
CMakePresets.json file.

`west build` is extended to set `APP_DIR` in environment when sysbuild
is used. This allows sysbuild's CMakePresets.json to include the
sample's presets file.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2025-10-03 12:51:01 +03:00
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