Commit graph

1,889 commits

Author SHA1 Message Date
Jiafei Pan
04baf84eaf cmake: toolchain: cross_compile: check newlib and picolibc
Add support to check whether Cross Compile toolchain support newlib and
picolibc or not.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2025-10-30 18:37:44 -04:00
Joel Schaller
ba5b5debc8 linker_script: Remove some remaining SUBALIGN in iterable/linker sections
The zephyrproject-rtos#91219 missed some entries when doing the clean-up.
This removes some of remaining SUBALIGN entries in the iterable sections.
Fixes CMake Warning:
zephyr_linker_section(NAME ...) given unknown arguments: SUBALIGN 4

Signed-off-by: Joel Schaller <joel.schaller16@gmail.com>
2025-10-29 13:48:01 +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
Robin Kastberg
aebc427540 iar: linker_script: Parse LD style INPUT specifications
Add support for LD-style file specifications in the
IAR generator for
`zephyr_linker_section_configure(INPUT`

Signed-off-by: Robin Kastberg <robin.kastberg@iar.com>
2025-10-25 10:46:18 +03:00
Roy Jamil
42e899d06a scripts: puncover: Fix compatibility with v0.6.0
Signed-off-by: Roy Jamil <roy.jamil@ac6.fr>

Puncover v0.6.0 renamed the command-line argument
`--gcc_tools_base` to `--gcc-tools-base`.

Fixes compatibility error when running `west build -t puncover`
with puncover v0.6.0 or newer.
2025-10-22 18:06:41 -04:00
Luca Burelli
e4fa6a8f61 traceconfig: add target to export value origin traces to Markdown
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>
2025-10-22 18:34:49 +03:00
Alberto Dalibor Rodda
2b5d0faa53 cmake: mcuboot: Fix build with RAM load and encryption
Fix wrong byproduct name for the unencrypted slot 1 image, avoiding
conflicts with the encrypted image.

Signed-off-by: Alberto Dalibor Rodda <fiabarod@proton.me>
2025-10-21 17:22:16 +03:00
Jukka Rissanen
5795b51ece cmake: extensions: Fix compliance errors
Change "if ()" to "if()" so that CI compliance checker passes.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-10-16 12:15:47 -04:00
Afonso Oliveira
1c52f45aec cmake: arcmwdt: riscv: derive ccac flags from Kconfig
Add arcmwdt RISC-V core/ISA mapping in target_riscv.cmake to
automatically derive compiler flags from Kconfig settings.

- Select series core flag from SoC Kconfig: -av5rmx/-av5rhx
- Map RISC-V Kconfig to ccac -Z flags (M/A/C/Zicsr/Zifencei/Zicntr)
- Handle compressed logic correctly: -Zc or individual Zc* sub-extensions
- Add F/D and compressed FPU (-Zf/-Zd, -Zcf/-Zcd)
- Add -Zmmul when M is not selected and ZMMUL is enabled
- Use OPTIONAL include to allow for arch-specific target files

Keep early compiler checks stable by not pushing -Z flags into
CMAKE_REQUIRED_FLAGS.

Co-authored-by: Torsten Tejlmand Rasmussen <torsten.rasmussen@nordicsemi.no>
Signed-off-by: Afonso Oliveira <afonsoo@synopsys.com>
Signed-off-by: Afonso Oliveira <afonso.oliveira707@gmail.com>
Signed-off-by: Torsten Tejlmand Rasmussen <torsten.rasmussen@nordicsemi.no>
2025-10-14 18:51:25 +02:00
Torsten Rasmussen
428279ef41 cmake: define linker argument for undefined symbol
Specifying undefined symbol on linker invocation requests the linker to
search and include the symbol.
This ensures the symbol will be present in final output.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2025-10-09 22:56:09 +03:00
Daniel Leung
e8a66d57db linker: add a way to add snippets to text section
This adds a way to add to the text section via
zephyr_linker_sources(TEXT_SECTIONS <...>).

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-10-06 20:16:31 -04:00
Gustavo Romero
d569a17286 cmake: emu: Allow QEMU to serve serial on a TCP/IP port
This commit enables users to pass -DQEMU_SOCKET=y for 'west' when
selecting to run the build on a QEMU VM. This allows the target's serial
port to be served to the host via a TCP/IP port for convenience, easing
communication with the target from the external world.

Signed-off-by: Erik Schilling <erik.schilling@linaro.org>
Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
2025-10-05 06:18:25 -04:00
Kevin Townsend
03fcfcd0f2 cmake: compiler: Add func_instrumentation flag
Adds a new compiler flag to enable function instrumentation injection
at compile time for compilers that support it.

Adds support for this flag to GCC when `CONFIG_INSTRUMENTATION` is
enabled, setting the `-finstrument-functions` flag during compilation.

Signed-off-by: Kevin Townsend <kevin.townsend@linaro.org>
Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
Signed-off-by: Maciej Sobkowski <msobkowski@antmicro.com>
2025-10-05 06:18:25 -04:00
Torsten Rasmussen
e662d77bf1 cmake: add net_socket_service_desc to common-rom.cmake
Commit eff5d02872 added
`net_socket_service_desc` to common-rom ld snippet but not to common-rom
CMake linker generator equivalent.

Bring common-rom.cmake up-to-date to ensure `net_socket_service_desc`
works correctly with the linker generator.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2025-10-03 12:49:25 +03:00
Torsten Rasmussen
ddb9e3fae6 cmake: use zephyr_file_copy(...) instead of file(COPY_FILE ...)
`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>
2025-10-02 21:58:40 +02:00
Pierrick Guillaume
b7eec0fe24 cmake: linker: separate toolchain_ld_options() calls for grouped flags
Fixes #91045

Adding NO_SPLIT in the TOOLCHAIN_LD_FLAGS list caused every flags in the
list to be checked together by the linker. This caused issues where
incompatible flags was passed together, and the result was that none was
propagated to the linker.

By using separate variables, we can achieve the initial goal of NO_SPLIT to
only group a sub-set of flags.

Signed-off-by: Pierrick Guillaume <pguillaume@fymyte.com>
2025-09-30 19:36:37 +02:00
Felipe Torrezan
74380310de cmake: sca: iar: Add IAR C-STAT
This commit adds support for IAR C-STAT Static Analysis
in the Zephyr's SCA Framework.

By specifying -DZEPHYR_SCA_VARIANT=iar_c_stat in west, a SQLite
database file will be generated under build/sca/iar_c_stat.

Signed-off-by: Felipe Torrezan <felipe.torrezan@iar.com>
2025-09-29 12:37:25 -04:00
Fabio Baltieri
3232354456 cmake: unittest: set -Wshadow
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>
2025-09-26 13:24:30 +02:00
Robin Kastberg
d1e5c34ccc iar: toolchain: Cortex-M85 support
Add support in IAR build system for Cortex-M85.

Signed-off-by: Robin Kastberg <robin.kastberg@iar.com>
2025-09-26 13:22:38 +02:00
Vladislav Pejic
1d02d57413 driver: adc: Added stream APIs for ADC
Introduce a streaming APIs for ADC devices.
Two new APIs are added to the adc_driver_api: submit and get_decoder.
Added decoder following APIs: get_frame_count, get_size_info, decode,
has_trigger.

Supported triggers are:
- ADC_TRIG_DATA_READY
- ADC_TRIG_FIFO_WATERMARK
- ADC_TRIG_FIFO_FULL
Supported operations to be done on trigger:
- include - whatever data is associated with the trigger
- nop - do nothing with data associated with the trigger
- drop - clear data associated with the trigger

Some changes to the linker scripts were needed to add decoder APIs.

Signed-off-by: Vladislav Pejic <vladislav.pejic@orioninc.com>
2025-09-23 17:50:25 -04:00
Maureen Helm
909bd5e6f9 cmake: emu: Don't require ARMFVP_BIN_PATH environment variable
Enhance the armfvp emulator cmake handling to allow additional options
for setting ARMFVP_BIN_PATH, relaxing the previous requirement to set in
an environment variable. This makes it possible to run twister with
multiple armfvp platforms located in different paths.

Signed-off-by: Maureen Helm <maureen.helm@analog.com>
2025-09-23 12:05:30 -04:00
Jamie McCrae
dc56fb2e69 cmake: Use temp. for edt pickle CMake output
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>
2025-09-23 09:41:28 +01:00
Benjamin Cabé
59bf4e7895 cmake: clang: set no_track_macro_expansion properly
Compiler property no_track_macro_expansion is controlled by
CONFIG_COMPILER_TRACK_MACRO_EXPANSION.
When that Kconfig is set to Y, clang fails with the following error
message:

   unknown argument: '-ftrack-macro-expansion=0'

This commit modifies clang/compiler_flags.cmake so that there is a
proper clang compiler option for this flag.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-09-22 11:17:34 +02:00
Erwan Gouriou
d20e15f651 cmake: mcuboot: ramload: Expect write-block_size only in revert case
Since we're not yet at a consensus on where 'write-block-size' should be
set, make the adjustable alignment expected only in the revert case
to restore functionality on the 'normal' case.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2025-09-19 08:32:22 -04:00
Benjamin Cabé
635e7c7261 sca: add DT diagnostic tool
implemented as an SCA for now but might benefit from being baked into
the build system so that it's always available.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-09-18 15:42:42 +01:00
Jamie McCrae
271dbb4015 cmake: mcuboot: Add dependency to keys
Adds a dependency that causes CMake to re-configure if the input
key files for MCUboot signing/encryption have changed

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-09-15 13:59:11 -04:00
Jaagup Averin
c96dbf48ed llvm: Export CMAKE_GDB during configuration.
Appears that llvm was forgotten when other toolchains
got their CMAKE_GDB export.

Signed-off-by: Jaagup Averin <jaagup.averin@gmail.com>
2025-09-13 18:14:04 -04:00
Jaagup Averin
ac0387448e llvm: Remove "-Wno-volatile" from clang compiler args.
-Wno-volatile is set by gcc/compiler_flags.cmake,
but is not supported by clang and generated warnings.

Signed-off-by: Jaagup Averin <jaagup.averin@gmail.com>
2025-09-13 18:14:04 -04:00
Jaagup Averin
a2c55e01a8 llvm: Reorganize clang/compiler_flags.cmake
Since this overrides values from gcc/compiler_flags.cmake,
they should ideally have the same structure and order.

Signed-off-by: Jaagup Averin <jaagup.averin@gmail.com>
2025-09-13 18:14:04 -04: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
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