Commit graph

1860 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
Jakub Klimczak
fdd4a7bb8e cmake: emu: Add VIRTIO console to QEMU CMake file
Replace the default serial device with a virtconsole if it
is configured in the devicetree. Because of the way -nographic
works, -serial none and -monitor none had to be added as well.
Tested with west build -t run and west build -t debugserver_qemu.

Signed-off-by: Jakub Klimczak <jklimczak@internships.antmicro.com>
2025-09-11 06:26:02 -04:00
Kesavan Yogeswaran
493ce8efa6 cmake: Merge extra Zephyr modules from multiple sources
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>
2025-09-10 22:38:41 -04:00
Aaron Wisner
f7dbf5f800 build-system: Replace ~ when creating library names from path
Bazel likes to use '~` in path of external repos.

Signed-off-by: Aaron Wisner <aaronwisner@gmail.com>
2025-09-10 10:12:16 +02:00
Anas Nashif
25938ec2bf arch: init: rename z_data_copy -> arch_data_copy
Do not use private API prefix and move to architecture interface as
those functions are primarily used across arches and can be defined by
the architecture.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-09-08 15:51:07 -04:00
Appana Durga Kedareswara rao
7542107048 arm64: Add new CPU_CORTEX_A78 configuration for Cortex-A78 support
Introduce a new Kconfig option CPU_CORTEX_A78 to enable support for the
Arm Cortex-A78 CPU architecture within Zephyr. This configuration can be
selected by boards or SoCs that utilize the Cortex-A78 core, enabling
architecture-specific features and optimizations as needed.

Signed-off-by: Appana Durga Kedareswara rao <appana.durga.kedareswara.rao@amd.com>
2025-09-05 16:48:38 -04:00
Pieter De Gendt
aea45b9e56 cmake: reports: Add ram/rom plot targets
Add a plot variant for every ram/rom report target.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-09-04 14:42:52 +02:00
Tomasz Chyrowicz
7c1a74f867 modules: Add VID and CID Kconfigs
Add a possibility to specify VID and CID for each MCUboot image and pass
it to the imgtool.

Signed-off-by: Tomasz Chyrowicz <tomasz.chyrowicz@nordicsemi.no>
2025-09-04 11:28:14 +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
Ilya Tagunov
09a034e8ce toolchain: arcmwdt: override unsuitable default implementations
Provide toolchain-specific implementations for the new functions
added in d77b58a, because the default ones end up with build failures.

As the MWDT toolchain doesn't support different combinations of
compilers and linkers, there's no need to pass any linker properties
from the compiler, at least for the time being. Moreover, the default
implementation of compiler_set_linker_properties() uses the compiler
flag (--print-libgcc-file-name) that doesn't make any sense for MWDT.
Therefore, provide an empty implementation of the function.

The default implementation of toolchain_linker_add_compiler_options()
doesn't cause any issues for now, but it's still better to replace
it with the passthrough implementation borrowed from ld/lld.

Signed-off-by: Ilya Tagunov <Ilya.Tagunov@synopsys.com>
2025-09-01 14:01:46 +02:00
Mikhail Siomin
60a12bd336 cmake: fix build using clang when default and target arch do not match
Use CMAKE_C_COMPILER_TARGET to allow clang to correctly determine
the runtime library for the target architecture.
Otherwise, the default runtime library will be selected.

Signed-off-by: Mikhail Siomin <victorovich.01@mail.ru>
2025-09-01 08:33:00 +02:00
Keith Packard
a4fde2d205 linker/xt-ld: Compute crtbegin/crtend paths in toolchain_linker_finalize
The computation of paths to crtbegin.o and crtend.o must be delayed until
after the compiler_file_path function has been defined. The
toolchain_linker_finalize function is where these are supposed to get set
now.

Signed-off-by: Keith Packard <keithp@keithp.com>
2025-08-28 08:57:17 +02:00
Jamie McCrae
ea9815ff34 scripts: zephyr_module: Add variable with module path
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>
2025-08-20 12:05:41 +02:00
Lars-Ove Karlsson
7ec00e958d toolchain: linker: IAR fix for new linker optimization options
The IAR linker ilink does not have any optimization options, and
with the newly added linker optimization flags that default to
the compiler optimization flags, ilink will fail with an
"illegal command line option" error.
This temporary workaround will use a harmless option instead to
avoid errors, until we can update the linker.

Signed-off-by: Lars-Ove Karlsson <lars-ove.karlsson@iar.com>
2025-08-20 09:29:04 +02:00
Keith Packard
d77b58aacb cmake: Delay computation of linker paths until needed
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>
2025-08-13 22:13:24 -04:00
Ilya Tagunov
d8a1e858a1 arcmwdt: linker: append -Hlld option only for ARC architecture
The option -Hlld of the MWDT linker is relevant only for classic ARC.
It is incompatible with ARC-V platform options like -av5rmx.

Signed-off-by: Ilya Tagunov <Ilya.Tagunov@synopsys.com>
2025-08-12 21:32:18 +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
Fabio Baltieri
2705260b27 cmake: deprecate the flash debug debugserver attach rtt targets
These call west right now, tell the user to call west directly instead.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-08-12 09:55:47 +03:00
Daniel Flodin
a4b66f9214 cmake: assembler optimization options
Commit f499ea0 made it so that the compiler optimization flags are also
passed to the assembler. However, this breaks for the IAR toolchain
since it uses the GNU assembler which does not have the same
optimization flags as the IAR compiler.

This commit separates the compiler and assembler optimizations to make
it possible to specify appropriate flags in a toolchains corresponding
`compiler_flags.cmake`

Signed-off-by: Daniel Flodin <daniel.flodin@iar.com>
2025-08-11 12:49:21 +03:00
Jisheng Zhang
13bdae0ad0 arch: arm: Add initial support for Cortex-M52 Core
Add initial support for the Cortex-M52 Core which is an implementation
of the Armv8.1-M mainline architecture.

The support is based on the Cortex-M55 support that already exists in
Zephyr.

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
2025-08-06 12:15:23 +03:00
Daniel DeGrasse
6439c0c1d7 cmake: mcuboot: prefer confirmed image when one is created
Prefer flashing the confirmed image when one is created with
CONFIG_MCUBOOT_GENERATE_CONFIRMED_IMAGE. This way, the west runner will
flash this image over the signed image if it exists.

Signed-off-by: Daniel DeGrasse <ddegrasse@tenstorrent.com>
2025-08-05 11:53:58 +01:00
Daniel DeGrasse
77e592c68b cmake: mcuboot: respect alignment size when signing for ramload mode
When signing for ramload mode, respect the write alignment size setting.
This is required when creating a confirmed image, as the BOOT_MAGIC
value changes based on the alignment size in use.

Signed-off-by: Daniel DeGrasse <ddegrasse@tenstorrent.com>
2025-08-05 11:53:58 +01: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
Lauren Murphy
69a3ed2753 llext: replace stripping script with call to zephyr sdk strip
Replace custom stripping script with a call to Zephyr SDK strip.

Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
2025-08-01 19:36:59 +01:00
Lauren Murphy
c792d78cb3 llext: add fixes for various tests on mwdt / harvard arch
Adds fixes to get LLEXT tests to work for NSIM VPX on MWDT.

Excludes prelocated extensions for MWDT for now.

Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
2025-08-01 19:36:59 +01:00
Lauren Murphy
92db7bcf11 llext: compile llext with arc mwdt on nsim vpx5
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>
2025-08-01 19:36:59 +01:00
Michal Kozikowski
6c72cd3e65 cmake: mcuboot: SHA512/pure image signing
Update signing script to use proper arguments for imgtool when SHA512
or pure signature is needed.

Signed-off-by: Michal Kozikowski <michal.kozikowski@nordicsemi.no>
2025-07-31 07:34:40 -04:00
Martin Hoff
d5f67d04ee arch: split dynamic interrupt symbol
This commit introduces the SRAM_SW_ISR_TABLE option which is selected by
DYNAMIC_INTERRUPT. It allows splitting the DYNAMIC_INTERRUPT option into
two parts:

 - One for the relocation of the ISR vector table in RAM
 - One for the inclusion of functions needed to install ISRs dynamically

The goal is to later only select the relocation of the ISR vector table in
RAM and not all the associated functions from the dynamic interrupt
mechanism.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-07-30 17:37:43 -04:00
Nick Brook
d7fb46ac04 cmake: Merge in DTS_ROOT from sysbuild
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>
2025-07-30 17:34:39 -04:00
Serhiy Katsyuba
7dbde64738 cmake: llext: Fix llext incremental build
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>
2025-07-30 17:21:53 -04:00
Adrian Bieri
5d42408efa cpp: add kconfig option STD_CPP23 for STD_CPP
to be able to choose c++23 dialect
deprecates c++2b, but we should keep the option c++2b for legacy

Signed-off-by: Adrian Bieri <adrian.bieri@loepfe.com>
2025-07-30 07:27:53 -04:00
Luca Burelli
83b9577f38 west build: display closest matching board names on error
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>
2025-07-30 06:11:09 -04:00
Nicola Vetrini
0de4f8de4a sca: eclair: Make ECLAIR project root configurable.
The project root was set unconditionally as the variable ZEPHYR_BASE,
but users developing a Zephyr application may wish to override the project
root used by ECLAIR as the base directory of their projects, so that
all paths processed by the tool are relative to that directory.

- A new cmake variable ECLAIR_PROJECT_ROOT is introduced;
- additional messages to output this information before the build starts.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
2025-07-27 17:03:02 -04:00
Luis Ubieda
a000acf85b gnss: rtk: Add basic integration
Incorporate the basic RTK API as well as a basic client integration
(serial) as a way to receive and publish the RTK data.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-07-21 09:19:14 -04:00
Stephanos Ioannidis
dc3c9f3560 arch: riscv: Introduce code model options
This commit introduces a new Kconfig choice for configuring the code model
used for compilation.

All three code models specified by the RISC-V ELF psABI specification are
supported: medlow, medany and large.

For RV32, the `medlow` code model is always selected.
For RV64, the `large` code model is selected if the SRAM or kernel VM base
address is greater than or equal to 4 GiB; otherwise, the `medany` code
model is selected.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2025-07-19 15:43:09 -04:00
Stephanos Ioannidis
f5000936a8 arch: riscv: Add Zicntr extension support
This commit introduces the support for the standard Zicntr extension, which
provides hardware counters.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2025-07-19 15:42:57 -04:00
Stephanos Ioannidis
58a6a696a0 arch: riscv: Add Zc* compressed instruction extension support
This commit adds the support for the following new Zc* series compressed
instruction extensions:

  Zca  - Subset of the C extension without FP loads and stores
  Zcb  - "Simple" instructions
  Zcd  - Double-precision floating-point instructions
  Zcf  - Single-precision floating-point instructions
  Zcmp - "Complex" instructions for embedded CPUs
  Zcmt - Table jump instructions for embedded CPUs

With the introduction of the Zc* extensions, the C extension now implies
the following Zc* extensions:

  * Zca, always
  * Zcf if F is specified (RV32 only)
  * Zcd if D is specified

The Zc* extensions that are implied by the C extension are not specified in
the GCC `-march` flag because they are redundant and can interfere with the
resolution of the correct multi-lib for the selected architecture unless
the the alternate mappings for the redundant forms are manually specified.

All the implementation details in this commit are based on the Zc* v1.0.0
specification, which is the ratified version.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2025-07-19 15:32:35 -04:00
Anas Nashif
91cf77f013 Revert "cmake: Add service section to commo-rom linker generator"
This reverts commit 49a96f67a2.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-07-16 16:39:36 -05:00
Lars-Ove Karlsson
2a9be50c29 toolchain: compiler: IAR does not allow vla with C++
Fixed a problem where the command line option --vla was used
with C++ causing a command line error in the IAR ICCARM compiler.

Signed-off-by: Lars-Ove Karlsson <lars-ove.karlsson@iar.com>
2025-07-11 08:14:12 -10:00
Fin Maaß
809c855a62 mcuboot: cmake: only set write_block_size when needed
only set write_block_size when needed and don't output
a warning, when it's not needed

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-07-08 18:35:44 -05:00
Joakim Andersson
12fdde6694 cmake: kconfig: Add APP_DIR to kconfig environment
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>
2025-07-08 13:40:34 -05:00
Fin Maaß
c3e4ed7e91 libc: remove POSIX_TIMERS dep from COMMON_LIBC_TIME
remove POSIX_TIMERS dependency from
COMMON_LIBC_TIME, as it is no longer
needed.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-07-08 13:38:11 -05:00
Gerson Fernando Budke
b478cd8f37 linker_script: Remove some remaining SUBALIGN in iterable sections
The #91219 miss some entries when doing the clean-up. This removes
some of remaining SUBALIGN entries in the iterable sections. It do
not consider SECTION_PROLOGUE and zephyr_linker_section entries.

Fixes #92349

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2025-07-07 10:07:56 -05:00
Benjamin Cabé
f672cb72d4 Revert "doc: ci: Zephyr now requires Python 3.12 or higher"
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>
2025-07-04 15:50:06 -05:00
Benjamin Cabé
33d6061fe7 Revert "doc: correct python minimum required"
This reverts commit c68d0b9630.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-07-04 15:50:06 -05:00
Jérôme Pouiller
e7fdc84696 cmake: Fix support for "ninja flash"
By default west looks at the parents directory to find Zephyr base
directory. However, in the case the build directory is not a subdirectory
of zephyr base and the user run "ninja flash" directly from the build
directory, west fails to detect Zephyr base.

So, this patch explicitly add ZEPHYR_BASE in the environment.

Implementation notes:
  * ZEPHYR_BASE is already set for ninja menuconfig in
    cmake/modules/kconfig.cmake:201
  * ZEPHYR_BASE seems better than --zephyr-base since the environment in
    inherited
  * BTW, --zephyr-base seems to not have any impact and seems broken

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
2025-07-02 03:55:49 -10:00
Stephanos Ioannidis
d0bded3c8c arch: riscv: Fix incorrect Zalrsc extension name
`Zlrsc` is not a thing and the correct name for it is `Zalrsc`.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2025-07-01 10:18:19 -05:00
Stephanos Ioannidis
1b3534d627 cmake: gcc: Fix code formatting of target_riscv.cmake
This commit fixes the incorrect code formatting used by target_riscv.cmake
by changing the 4-space indent to 2-space and removing the space between if
keyword and parenthesis.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2025-07-01 10:18:19 -05:00
Anas Nashif
67caf3bb09 sca: eclair: use MISRA C:2012 Amendment 2
Use MISRA C:2012 Amendment 2 instead of 'MISRA C:2012 Amendment 2' in
all configuration files consistently.

Also fix a typo in one of the deviations.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-06-30 15:20:13 -05:00
Robin Kastberg
1601a7d696 iar: linker_script: zero-init BSS
CONFIG_IAR_DATA_INIT did inadvertently not initialize BSS.

Signed-off-by: Robin Kastberg <robin.kastberg@iar.com>
2025-06-30 15:18:30 -05:00