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>
This code was deprecated and removed from the documentation many
releases ago, remove the feature from the code
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
The CMake extensions module depends on the yaml module, but extensions did
not explicitly include yaml.
When using find_package(Zephyr ...) with no components specified this
issue is not seen as zephyr_default is included which includes many other
modules, including yaml and extensions.
However, when find_package(Zephyr ... COMPONENTS ...) is used only the
components specified are included, which can result in a build error. For
example, using find_package(Zephyr ... COMPONENTS FindHostTools ...)
includes FindHostTools, which includes extensions, which depends on yaml
but doesn't include it.
This issue is fixed by including yaml in extensions.
Signed-off-by: Ben Marsh <ben.marsh@helvar.com>
Skips updating files if the output already matches the file
contents, this prevents a random occurance whereby sysbuild
reconfigures itself after a reconfiguration for no known
discernable reason
Signed-off-by: Jamie McCrae <spam@helper3000.net>
Replace inefficient string parsing loop with CMake list iteration for
processing list_hardware.py output. The previous implementation used
repeated string operations on the entire output string for each line,
which is increasingly slow as hardware list grows.
Local tests show hwmv2.cmake module loading in ~350 ms instead of
540 ms on my machine.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
This check is meant to be easier on users so they do not need to bother
setting ZEPHYR_TOOLCHAIN_VARIANT to "host" when building for
native_simulator based targets, so we default in that case to it.
But when somebody has actively set it to "cross-compile" we should not
override it.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
The `add_dependencies` command in CMake is used to specify dependencies
between targets - here it was used to specify a dependency on a folder,
which is not valid (and causes failures on CMake 4.2 when using
the cmake-file-api).
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Quotes around `"SUBALIGN ${SUBALIGN}"` results in the parameters to
become a text string with a space, and therefore will give the warning
> CMake Warning at /.../extensions.cmake:5197 (message):
> zephyr_linker_section(NAME ...) given unknown arguments: SUBALIGN 4
> Call Stack (most recent call first):
> /.../extensions.cmake:5333 (zephyr_linker_section)
> /.../CMakeLists.txt:x (zephyr_iterable_section)
Remove the quotes so that `SUBALIGN` and the value are correctly treated
as argument name and value.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Fixes checking for board folders that have moved by checking if
the BOARD_DIR variable is already set (i.e. loaded from cache)
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Will throw an error showing what the issue with the VERSION file
is if a required field is missing
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Removes checks for HWMv1 as the code for HWMv1 was removed from
Zephyr some time ago and these checks are not needed
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
The new 'traceconfig' target generates a Markdown file listing all
configuration symbols, their values, and where those values originated
(user assignment, default, selection, implication, or unset).
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
`file(COPY_FILE ...)` is from CMake 3.21.
Zephyr still supports CMake 3.20, so use zephyr_file_copy(...)
instead of `file(COPY_FILE ...)`.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Set -Wshadow when compiling unit tests, this way we can test macro
combinations and ensure they don't generate shadowed variables, which
would generate a warning by default in normal Zephyr builds.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This potentially fixes an issues whereby when sysbuild projects
import dts configuration from images and images are reconfigured,
that sysbuild will needlessly rerun even if the output has not
changed by using a temporary output file and then only updating
the actual file if the contents have changed
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
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>
Extra Zephyr modules can be provided via the EXTRA_ZEPHYR_MODULES CMake
list variable. Previously, if this variable were set in multiple places
(e.g. local CMake variable, cache variable set via -D, environment
variable), Zephyr will pick one source based on zephyr_get's documented
hierarchy and ignore the others.
Add the MERGE keyword when EXTRA_ZEPHYR_MODULES is read so that the list
of Zephyr modules is merged from all sources if this variable is set in
multiple places.
An example where this can be useful is when integrating additional Zephyr
modules with a vendor's Zephyr-based application whose build system already
contains usage of EXTRA_ZEPHYR_MODULES.
Signed-off-by: Kesavan Yogeswaran <hikes@google.com>
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>
Adds a variable that has the path of the module directory, this
is supplied as an argument when running cmake normally but is
not supplied when running the check compliance script, this
addition allows checks to be ran that use such syntax in Kconfig
files. This is then removed from cmake as the python file handles
it instead
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
With inclusion of the optimization flag into the multilib selection
process, we cannot compute the compiler library path when the compiler's
target.cmake is processed as LINKER_OPTIMIZATION_FLAG is not computed until
much later.
Instead, add a function (compiler_file_path) which can be used to locate
the appropriate crtbegin.o and crtend.o files.
Delay computation of lib_include_dir and rt_library until after all
compiler flags have been computed by adding compiler_set_linker_properties
and calling that just before toolchain_linker_finalize is invoked.
Place default implementations of both of these functions in a new file,
cmake/compiler/target_template.cmake, where we assume the compiler works
like gcc or clang and handlers the --print-file-name and
--print-libgcc-file-name options. Compilers needing alternate
implementations can override these functions in their target.cmake files.
These implementations require that no generator expressions are necessary
for the compiler to compute the right library paths.
This mechanism is also used to take any additional compiler options by
adding a new (optional) linker function,
toolchain_linker_add_compiler_options, which maps compiler options to
equivalent linker options, discarding any that aren't applicable.
Signed-off-by: Keith Packard <keithp@keithp.com>
Allow users to compile LLEXTs with the MetaWare Design Toolchain.
Provides utility to dramatically shrink bloated extensions by removing
unused section names left behind by MWDT strip. Test extensions will
not fit in NSIM VPX5 memory otherwise; each is reduced from ~16k to ~1k.
Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
Merging in DTS_ROOT from sysbuild allows applications to specify a custom
DTS_ROOT path for the application via sysbuild.
Signed-off-by: Nick Brook <nrbrook@gmail.com>
Before this commit, building llext packages with a `POST_BUILD` step added
via `add_llext_command()` only worked for from-scratch builds (tested with
Ninja).
When the client CMake script called `add_llext_command()` to add a custom
`POST_BUILD` step, `has_post_build_cmds` was set to 1, and a `true` (do
nothing) command was executed instead of `copy` for the `llext_pkg_input`
target. Consequently, the timestamp of `llext_pkg_input` was not updated.
Before executing `llext_proc_target`, Ninja seems to check the timestamp
of `llext_pkg_input`. When the custom command added by
`add_llext_command()` generated a new `llext_pkg_input`, Ninja was unaware
that `llext_pkg_input` had been updated, and the dependent
`llext_pkg_output` was not executed. Building only worked if
`llext_pkg_input` was missing, i.e., only for from-scratch builds.
The fix replaces dependencies so the command for `llext_pkg_input` is
executed after `llext_proc_target` (after `llext_proc_target` may generate
a new `llext_pkg_input`).
Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
This commit modifies the 'west build' command to display the closest
matching boards when an invalid board is specified, making it easier
for users to find a typo in the used board name.
The user is also instructed to run 'west boards' if he wants to get
the full list of available boards.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Add APP_DIR as a kconfig environment variable.
This is useful in cases where you want to set a config path relative to
the directory of the application.
An example of this is how many sysbuild.cmake files sets the source
directory like this:
ExternalZephyrProject_Add(
APPLICATION remote
SOURCE_DIR ${APP_DIR}/remote
BOARD ${SB_CONFIG_REMOTE_BOARD}
)
The same however cannot be done in Kconfig.sysbuild:
config NETCORE_IMAGE_PATH
default "${APP_DIR}/<image_path>" if NETCORE_ABC
Instead they must use ZEPHYR_MY_MODULE_MODULE_DIR, however not all
applications are part of a zephyr module.
Signed-off-by: Joakim Andersson <joerchan@gmail.com>
This reverts commit 043bb58488.
Note that scripts/requirements-actions.txt might not be 100% the same
as what was pinned prior to the revert due to it being difficult to
restore previous versions while also accounting for the new dependencies
that were added in the meantime.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Fixes#92059
Update getting started guide, migration-guide and
python.cmake to use Python 3.12.1 as minimum supported
version
Signed-off-by: Tu Nguyen Van <tu.nguyenvan@nxp.com>
The zephyr_library macro does not expect any arguments, add a check for
that and similar for zephyr_library_named for no unexpected additional
arguments.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Add zephyr_check_no_arguments that macros and functions can call to check
that no arguments are given.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
.xtensa.info section isn't large so it was ignored in the beginning,
but its contents can differ depending on the build platform even if
the sources and the toolchain are the same. Strip the section to
restore binary reproducibility.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Update getting started guide, release notes, CI actions and
Python version compliance check to use Python 3.12 as
minimum supported version.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The existing logic caused a regeneration when any of the .conf files
changed, but modifying the Kconfig files can also cause the .config file
to become out of date e.g. by adding a new config option or by changing
the default value of a config option (when that default is not
overridden by a .conf).
Without this change, an incremental build wouldn't pick up the new value
and would require the user to notice that and manually do a clean build.
Signed-off-by: Richard Hughes <rhughes@xilinx.com>
Most uses of this macro should *not* include SUBALIGN as that can reduce
the alignment requirement for data and cause unaligned access faults in
the processor. Leave support for this in place in case there are
still uses for it.
Signed-off-by: Keith Packard <keithp@keithp.com>
zephyr_append_cmake_library attempts to warn the user if a user calls it
to create a Zephyr library while the build is in application mode. At
that stage of the build, the list of Zephyr libraries has already been
processed so the function is effectively a no-op.
This heuristic used to determine if the build was in kernel mode or
application mode checked for the presence of the zephyr_prebuilt target.
This check was broken by a previous commit that renamed this target.
This commit fixes the heuristic by checking for the zephyr_pre0 target.
This was tested by calling zephyr_append_cmake_library from some
application build files, building the application, and seeing the
warning only for the call I added. No warnings were printed for any
Zephyr internal libraries.
Link: https://github.com/zephyrproject-rtos/zephyr/pull/35887
Link: https://github.com/zephyrproject-rtos/zephyr/pull/39959
Signed-off-by: Kesavan Yogeswaran <hikes@google.com>
This fixes the invocation of the 'elfconvert' and 'slid_inject' commands
in the `add_llext_target` function by ensuring that the arguments are
expanded correctly before passing them to the shell.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Add cmake linker generator things for .last_section.
Follow up to #88970. Fixes bug #89719, for gcc/ld & iar
Signed-off-by: Björn Bergman <bjorn.bergman@iar.com>
The logic to "guess" shield names/dirs was duplicated between
list_shields.py (which is used by e.g. west shields) and shields.cmake.
This commit moves the logic to list_shields.py, and updates
shields.cmake to call the script and process its JSON output.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
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>
The CMake dt_* API is backed by target properties. By default, it uses
the target named `devicetree_target` that is initialized in `dts.cmake`.
We should be able to customize this, now that we have a function for
loading those properties into a different target. For example:
zephyr_dt_import(EDT_PICKLE_FILE /path/to/edt.pickle TARGET target)
dt_nodelabel(node NODELABEL label TARGET target)
This would make it possible to reference multiple devicetrees in the
same build system, particularly sysbuild.
Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
Extract the part of `dts.cmake` that invokes `gen_dts_cmake.py`, then
generalize it into a CMake extension, which can be reused by sysbuild.
The Python script itself is also updated, so that the generated CMake
file can accept an input variable DEVICETREE_TARGET, which comes from
the `zephyr_dt_import(TARGET ...)` argument.
Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>