Commit graph

2,014 commits

Author SHA1 Message Date
Wilfried Chauveau
27fdf98638 cmake: package_helper: Remove an empty elseif
Cmake complains about this.

Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
2026-01-08 19:16:40 +01:00
Thinh Le Cong
b90df06299 cmake: compiler: iar: skip GCC-specific lib detection
Avoid calling flag print-liggcc-file-name when using IAR

Signed-off-by: Thinh Le Cong <thinh.le.xr@bp.renesas.com>
2026-01-08 12:00:29 +00:00
Jamie McCrae
1bbbb286b3 cmake: Remove old deprecated code
Removes code that was deprecated in Zephyr 4.0

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-01-08 09:50:19 +01:00
Jamie McCrae
c02c6add10 cmake: modules: boards: Remove deprecated HWMv1 extension handling
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>
2026-01-08 09:49:56 +01:00
Ben Marsh
9476c62c80 cmake: Fix extensions module's implicit dependency on yaml module
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>
2026-01-07 14:08:00 +01:00
Thinh Le Cong
76e8d2b8fc linker: ld: correct GNU linker generator output for block linking
Fix the issue that occurs when building with GNU and
CONFIG_LINKER_GENERATOR=y.

Currently, the GROUP {region} directive does not function properly
with GNU. The input section cannot link to the memory group
defined by "zephyr,memory-region" in the final output linker
script.

This commit updates the GNU section name parser script, allowing
it to look up both group and region for output block generation
in the final output linker script.

Signed-off-by: Thinh Le Cong <thinh.le.xr@bp.renesas.com>
Signed-off-by: The Nguyen <the.nguyen.yf@renesas.com>
2025-12-23 15:14:16 +01:00
Jamie McCrae
ecd8a4bc7c cmake: modules: hwm_v2: Skip writing output on no change
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>
2025-12-18 23:38:25 +01:00
Benjamin Cabé
2bfd150128 cmake: hwmv2: optimize hardware list parsing with CMake lists
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>
2025-12-18 14:51:29 +00:00
Mathieu Choplain
681db7c1cc cmake: linker_script: arm: place IDT_LIST where ld linker script does
Instead of mirroring the ld linker script, the CMake Linker Generator for
ARM was placing the IDT_LIST region right after the Zephyr SRAM. While this
may work fine in most cases, this scheme leads to build errors on some SoCs
such as STM32WBxx, where there are multiple RAM banks that are contiguous
but split over multiple `zephyr,memory-region`s: in such scenarios, the
IDT_LIST region will overlap with one of these `zephyr,memory-region` and
cause a build failure.

Mimic the IDT_LIST placement found in ld linker script to avoid this issue,
except that the region start address is aligned: 0xFFFF8000 instead of
0xFFFF7FFF. This is required by `gen_isr_tables.py` which otherwise errors
out due to finding one more byte than expected in the .intList section.
(The exact reason is not clear, but aligning the region fixes the issue)

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2025-12-06 11:37:31 -05:00
Alberto Escolar Piedras
654535bea3 cmake: FindHostTools: Do not override cross-compile for native builds
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>
2025-12-05 13:38:48 +02:00
Yves Wang
9dafe6e67e cmake: usage: add ram/rom plot and traceconfig in usage
Added missing ram/rom plot and traceconfig targets in usage.cmake.

Signed-off-by: Yves Wang <zhengjia.wang@nxp.com>
2025-12-02 11:35:05 +01:00
Carles Cufi
d0547b67cd toolchain: gcc: Add a new LTO_SINGLE_THREADED option for LTO
As described in this issue:
https://github.com/zephyrproject-rtos/sdk-ng/issues/1038
`-flto=auto` fails on some (slower) Windows machines due to an issue with
the Zephyr SDK's GCC toolchain for Windows.
In order to allow users to work around this issue, introduce a new
CONFIG_LTO_SINGLE_THREADED option that switches to `-flto=1`, which
enforces a single thread when processing LTO.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2025-11-28 09:50:04 +00:00
Benjamin Cabé
8349a01b13 cmake: extensions: remove invalid add_dependencies
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>
2025-11-27 14:46:50 +01:00
Rico van Dongen
e55bf93d5d cmake: allow spaces in install path of GNU Arm Embedded linker
This commit fixes bug #95402. When the GNU toolchain is installed
in its default path the library include dir will contain spaces.
By encasulating the library path in quotes the linker works again.

Signed-off-by: Rico van Dongen <rdongen@ziggo.nl>
2025-11-27 11:32:19 +01:00
Torsten Rasmussen
18594c217c cmake: remove quotes around SUBALIGN
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>
2025-11-24 17:31:51 +01:00
Nicolas Pitre
ffd08f5385 arch: arm64: Implement SVE context switching for ARMv9-A
Implement Scalable Vector Extension (SVE) context switching support,
enabling threads to use SVE and SVE2 instructions with lazy context
preservation across task switches.

The implementation is incremental: if only FPU instructions are used
then only the NEON access is granted and preserved to minimize context
switching overhead. If SVE is used then the NEON context is upgraded to
SVE and then full SVE access is granted and preserved from that point
onwards.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2025-11-18 17:49:40 -05:00
Nicolas Pitre
80a6ead8c9 cmake: fix style conformance that makes CI fail
This fixes the following:

CMakeStyle File:cmake/gcc-m-cpu.cmake Line:7
Column:Remove space before '(' in if() statements
CMakeStyle File:cmake/gcc-m-cpu.cmake Line:22
Column:Remove space before '(' in if() statements
CMakeStyle File:cmake/gcc-m-cpu.cmake Line:28
Column:Remove space before '(' in if() statements
CMakeStyle File:cmake/gcc-m-cpu.cmake Line:38
Column:Remove space before '(' in if() statements
CMakeStyle File:cmake/gcc-m-cpu.cmake Line:48
Column:Remove space before '(' in if() statements

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2025-11-18 17:49:40 -05:00
Nicolas Pitre
051623c808 boards: arm: fvp: Add Cortex-A320 board variant support
Add Cortex-A320 support to the unified FVP board structure with ARMv9.2-A
specific configuration parameters.

New board target:
- fvp_base_revc_2xaem/a320

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2025-11-18 17:49:40 -05:00
Nicolas Pitre
2aef4fbe5b arch: arm64: Add ARMv9-A architecture and Cortex-A510 CPU support
Add ARMv9-A architecture support with Cortex-A510 CPU as the default
processor for generic ARMv9-A targets.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2025-11-18 17:49:40 -05:00
Jamie McCrae
cebdb0d1ec cmake: modules: boards: Fix board moved check
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>
2025-11-18 08:09:49 -05:00
Josuah Demangeon
bf9c3b150d style: cmake: apply coding style on CMakeLists.txt files
Apply the CMake style guidelines to all CMakeList.txt files in cmake/.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-11-17 13:48:03 -05:00
Jordan Yates
b4a8035433 llext: option to preserve EDK folder
Add an option to preserve the EDK folder, instead of deleting it after
creating the archive. This can simplify test scripting which can now
avoid immediately uncompressing the archive when compiling an
extension.

If this option is enabled, default to the much faster `.tar.Z` archive
format, since the compression ratio of the archive is not important.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-11-17 09:21:56 -05:00
Arthur Gay
68e1e50089 cmake: mcuboot: Flash encrypted image when loading to RAM
When both `SB_CONFIG_MCUBOOT_MODE_RAM_LOAD` and `SB_CONFIG_BOOT_ENCRYPTION`
are enabled, MCUBoot loads an encrypted image from flash, decrypts it,
and then executes it from RAM.

Previously, the unencrypted image was being flashed. This caused a boot
failure because MCUBoot would attempt to decrypt an unencrypted image.

This commit ensures the encrypted image is flashed when this
configuration is active, allowing the system to boot correctly.

Signed-off-by: Arthur Gay <arthur.gay@marshmallow.kids>
2025-11-17 09:18:54 -05:00
Jamie McCrae
2b52c91c06 cmake: modules: version: Check that required fields are present
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>
2025-11-13 23:16:02 +02:00
Jamie McCrae
6be751a2ed cmake: Remove HWMv1 checks
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>
2025-11-13 23:09:55 +02:00
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