Some compilers (like the host gcc on Arch Linux) default to enabling
the stack protector.
This is not something we want in general, so let's disable it unless
we want it (due to the stack canaries)
Background:
When building with picolibc (our default C library),
enabling the stack protector, links the picolibc stackprotector code,
which uses a possible getentropy() if available.
By default Zephyr has CONFIG_POSIX_C_LIB_EXT=y
(due to CONFIG_POSIX_AEP_CHOICE_ZEPHYR), but this provided
getentropy() tries to always use an entropy source even if none
is available, which results in link errors.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
CONFIG_SYS_HEAP_KASAN needs compiler flags that were only set for GCC
and Clang. MWDT's ccac is LLVM-based, so add the Clang-style
-fsanitize=kernel-address flags, plus -fsanitize-recover so ccac
emits the _noabort callbacks the heap KASAN runtime implements.
Leave no_heap_kasan empty because ccac has no -fno-sanitize= form;
instrumentation is opt-in per target.
The heap_kasan test uses setjmp, which minimal libc does not provide.
Skip the default case on arcmwdt and add an arcmwdtlib scenario that
builds with CONFIG_ARCMWDT_LIBC=y.
Signed-off-by: Mohamed Moawad <melhosar@gfoundries.com>
Adds M-mode, S-mode (internal SBI) and U-mode enablement for the RISC-V
Zicfilp (Landing Pad) extension for forward-edge Control Flow Integrity:
- Kconfig: Added RISCV_ISA_EXT_ZICFILP and RISCV_LANDING_PADS options.
- Toolchain: Passed -fcf-protection=branch when Zicfilp is active.
- CSR: Added definitions for MSECCFG_MLPE, MENVCFG_LPE, and SENVCFG_LPE.
- M-Mode: Configured mseccfg.MLPE in arch_kernel_init().
- S-Mode: Configured menvcfg.LPE in reset.S for internal SBI.
- U-Mode: Configured senvcfg.LPE in arch_kernel_init().
Tested against qemu_riscv32 with Zicfilp enabled. Verified that indirect
jumps to assembly routines lacking lpad correctly trigger a CPU trap.
Signed-off-by: Arjun Salunkhe <arjun.salunkhe@proton.me>
Use `<file.ld>` for linker snippet inclusion instead of `"file.ld"` to
ensure files are picked up relative to the `<zephyr_base>/include`
folder and not the linker template currently being pre-processed.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
generate_inc_file_for_target() names the file it embeds only in the
custom command's DEPENDS, so IDEs and the CMake file-based API see a
target with no inputs. Also list it in the custom target's SOURCES.
These are never compiled; a missing input is now reported at configure
time instead of build time.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
gperf is only needed to generate the kernel object hash tables of
CONFIG_USERSPACE builds. Look it up in FindTargetTools, which runs after
Kconfig, and make it required when CONFIG_USERSPACE is enabled, so a
missing gperf is reported at configure time instead of as
"GPERF-NOTFOUND: not found" late in the build.
Tested on frdm_mcxn947 and mps2/an385; not tested on Windows hosts.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Dimitrios Kafetzis <dimitrioskafetzis@gmail.com>
Only generate_inc_file() had a cmake:signature block, so the CMake
reference omitted generate_inc_file_for_target(), which every in-tree
caller uses, and generate_inc_file_for_gen_target(). Document both and
drop the per-parameter comments the signature blocks now duplicate.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within:
- `cmake/linker`
- `cmake/linker_script`
Assisted-by: Claude:claude-sonnet-5-5 codespell
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Replace scripts/kconfig/hardened.csv with a distributed YAML database.
The CSV format could not carry any explanation for its recommendations,
had no validation (a malformed line was silently dropped), no notion of
profiles, no ownership story, and no way to extend it out of tree.
The database now lives where the code lives: the central
scripts/kconfig/hardening.yaml defines the hardening profiles (plus
rules for top-level Kconfig symbols), and per-subsystem hardening.yaml
fragments next to the relevant Kconfig files carry the rules, so each
rule is reviewed by the maintainers of the code it hardens. Every rule
has a required rationale and optional references, supports exact-value
and integer min/max recommendations (STACK_POINTER_RANDOM is now
'>=100' instead of '==100'), and belongs to a profile: 'base' (memory
protection and inherently insecure features) or 'strict' (extends base
with debug/observability feature removal). The default profile is
'strict', matching the rule set the CSV checked.
hardenconfig is restructured around a serializable HardeningReport
model so results can be consumed programmatically, and gains:
- a Rationale column in the report
- profile selection:
west build -t hardenconfig -- -DHARDENCONFIG_PROFILE=base
- HARDENCONFIG_SHOW_ALL to also list PASS/NA results
- HARDENCONFIG_STRICT to exit non-zero on failures, for CI use
- HARDENCONFIG_JSON to write machine-readable results, including which
database file each rule came from
- HARDENCONFIG_EXTRA_SOURCES to layer out-of-tree database files that
may add profiles/rules and override in-tree ones
The EXPERIMENTAL/DEPRECATED/NOT_SECURE marker symbol detection is
preserved unchanged.
Three CSV entries are intentionally not carried over because they were
redundant: BT_CONN_DISABLE_SECURITY and BT_OOB_DATA_FIXED can only be
enabled together with BT_TESTING, and TIMER_RANDOM_GENERATOR together
with TEST_RANDOM_GENERATOR, all of which the database already
recommends disabling for the same profiles.
Behavioral fix: the CSV's DEBUG_COREDUMP line used '=' instead of ','
and was silently ignored, so CONFIG_DEBUG_COREDUMP was never actually
checked; it now is.
Also add tabulate to requirements-base.txt: hardenconfig has always
imported it, but it was only pulled in via other requirements files.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
When the target board cannot be found, we log a first message then call
list_boards.py to make it print some additional stuff, before printing
another message *and only then* calling message(FATAL_ERROR), with a
message saying to "scroll up"...
Instead, call list_boards.py first and capture what it prints, then
build a single string and give it directly to message(FATAL_ERROR) such
that all information is regrouped in a single place. This also makes the
error more readable on terminals with color support because the error
message is displayed with emphasis ("in red") compared to subprocess
output.
This approach also avoids a very unpleasant effect of the previous one:
since the list_boards.py script is somewhat slow, the first print would
be visible, then nothing would happen for a few seconds before the rest
of the message finally appeared and the build halted. Since we build the
message all at once now, this unpleasant delay is avoided: the error is
printed then CMake halts immediately.
A second pitfall it avoids is that the "did you mean" hint message can
be displayed only if list_boards.py actually finds a board for which
a fuzzy match exists, which avoids a small awkwardness in the error
message.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
QEMU rejects -device for NICs built into the emulated machine (lan9118,
stellaris, cadence_gem), so QEMU failed to start on those boards with
networking enabled. Let these drivers select ETH_NIC_MODEL_ONBOARD and
configure such NICs with -nic instead.
Assisted-by: Claude:opus-5.5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Clang's default ARM TLS codegen accesses the TLS block through
TPIDRURO (the per-CPU pointer) instead of TPIDRURW, which Zephyr
uses as the TLS base pointer on Cortex-A/R. This produced corrupted
z_tls_current and other thread-local accesses since the wrong base
was used.
Pass -mtp=soft to force calls through Zephyr's own __aeabi_read_tp,
matching the GCC toolchain's target_arm.cmake and Zephyr's TPIDRURW
based TLS mechanism.
Signed-off-by: Chidvilas Yerramsetti <cyerrams@qti.qualcomm.com>
Introduce ZASSERT, a self-contained assertion facility configured per
source file through a named module rather than the single global
CONFIG_ASSERT switch.
A file selects its module with ZASSERT_MODULE(); the level is resolved
from CONFIG_ASSERT_MODULE_<MODULE>_LEVEL and may be overridden per file.
Modules are defined with the Kconfig.template.assert template, which takes
module/module-str inputs following the logging template convention.
The four levels are:
- Off (compiled out)
- Terse (check only)
- On (check + location only)
- Verbose (Check, location, condition and message)
Since the level is known at compile time, disabled assertions are folded
away by the compiler, and below Verbose the optional message and its
arguments are as well.
zassert provides a set of __weak overridable hooks:
- zassert_fail() - called when an assertion fails
- zassert_vprint() - called to print the assertion failure message
- zassert_post_action() - the terminal action after an assertion failure
CONFIG_ASSERT remains the master switch. The assert Kconfig moves from
subsys/debug to lib/os/zassert, the legacy CONFIG_ASSERT_* symbols are kept
but deprecated (mapped onto the DEFAULT module), and lib/os/assert.c is
removed. The __ASSERT() family is preserved as a thin compatibility shim
over the DEFAULT module, so existing call sites keep working unchanged.
Signed-off-by: Måns Ansgariusson <mansgariusson@gmail.com>
commit a0983a2f91 ("cmake: align board qualifiers in CMake with
Kconfig") dropped the leading '/' from BOARD_QUALIFIERS and changed the
deprecated.cmake lookup key to ${BOARD}/${BOARD_QUALIFIERS}. A board
name given without qualifiers yields the key '<board>/', which never
matches a '<board>_DEPRECATED' entry, so every rename entry without
qualifiers stopped redirecting and the build fails with an invalid
board error.
Use the plain board name as key when no qualifiers are given.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This reverts commit 6d63d4d904.
Parsing support for the legacy "GNU ld version 2.17.50.0.9 20070103"
format was added for the ancient binutils version that accompanied the
legacy GCC 4.1.2 toolchain. With modern binutils versions, this
obsolete regex pattern is no longer required.
Assisted-by: Gemini:gemini-3.8-flash
Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
This reverts commit 46e37b00e7.
Checking whether the GCC version is older than 4.3.0 to find limits.h
in include/ rather than include-fixed/ was added to support legacy GCC
4.1.2. With modern toolchains, this check is no longer required.
Assisted-by: Gemini:gemini-3.8-flash
Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
This reverts commit f2c8a5acc4.
The "-Map <mapfile>" argument was introduced for compatibility with
legacy GNU ld versions predating 2.20 that did not accept
"-Map=<mapfile>". With modern GNU binutils used in current toolchains,
this compatibility workaround is no longer needed.
Assisted-by: Gemini:gemini-3.8-flash
Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
Support for -DKCONFIG_WARNING_AS_ERROR=1 is added, which can be used to
control
that cmake stops in case of any kconfig warning.
Signed-off-by: Thorsten Klein <thorsten.klein@bshg.com>
This commit extends the board alias functionality so that it's possible
to map `<alias_board>/<alias_qualifier>` to `<board>/<qualifier>` in
addition to board name only aliasing.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Add TriCore target configuration for GCC and Clang compilers.
Include target_tricore.cmake for both toolchains with TriCore
specific compiler and linker flags.
GCC and Clang use different -mcpu identifiers for the same
silicon: GCC uses tc39xx/tc4DAx while Clang uses tc3xx/tc4xx.
GCC builds additionally require -mno-eabi-bitfield-limit to
relax the EABI half-word boundary crossing restriction for
bitfields and -fstrict-volatile-bitfields for correct MMIO
register access.
Select lld as the linker for TriCore Clang builds. Enable
TriCore in the host LLVM toolchain Kconfig.
Signed-off-by: Christoph Seitz <christoph.seitz@infineon.com>
Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
Previously, the IAR linker have generated symbols (__ITCM_load_start
and friends) for ITCM and DTCM in upper case. It now also
generates a lower case variants since some tests uses those.
Fixes issue #115901.
Signed-off-by: Lars-Ove Karlsson <lars-ove.karlsson@qt.io>
CMake list handling has special treatment of `[` and `]`.
This means lists containing those characters are treated specially,
which again results in `file(STRINGS <out> <file> ...)` to break when
those characters are present un-paired in the text file.
See CMake issues:
https://gitlab.kitware.com/cmake/cmake/-/work_items/13760https://gitlab.kitware.com/cmake/cmake/-/work_items/19156
This commit updates `import_kconfig` CMake function to use
`file(READ ...)` instead of `file(STRINGS ...)` to avoid the use of
CMake lists in this case.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Some targets run on a QEMU that ships with their toolchain rather than
with the host or the Zephyr SDK, so it is neither on PATH nor found by
the plain find_program() lookup, and CI would have to export
QEMU_BIN_PATH per platform.
Add QEMU_BINARY_HINTS, a list of directories a board.cmake appends to.
They are passed as find_program() HINTS, so they are searched before
PATH. QEMU_BIN_PATH keeps overriding the search entirely.
Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The Hexagon cross-toolchain is an ordinary LLVM installation whose clang
only registers the Hexagon target, so the host/llvm variant already
describes how to drive it. Give it a variant of its own anyway, reading
HEXAGON_TOOLCHAIN_PATH rather than LLVM_TOOLCHAIN_PATH.
The reason is that a build environment commonly holds two LLVMs: a native
one, used for native_sim and other host-compiled targets, and this
Hexagon-only one. A single LLVM_TOOLCHAIN_PATH cannot name both, and
whichever it names wins for the whole run -- Zephyr's own CI sets it to
the distribution LLVM for every builder, so a Hexagon platform sharing
that variable is handed a compiler with no Hexagon runtime and fails at
the link:
ld.lld: error: unable to find library -lclang_rt.builtins
Two variables let one Twister run cover both kinds of platform, and let a
run with no Hexagon toolchain installed filter the board out cleanly
rather than trying to build it with the wrong compiler.
The variant also withdraws TOOLCHAIN_HAS_LIBCXX, which host/llvm declares
unconditionally: the Hexagon toolchain ships libc++ only for
hexagon-unknown-linux-musl, not for the bare-metal
hexagon-unknown-none-elf target Zephyr builds against, so a C++
configuration picked on the strength of that declaration fails at the
first standard header.
Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
Add Hexagon DSP architecture support to Zephyr RTOS, targeting the
Qualcomm Hexagon V67+ ISA running as a guest under the H2 hypervisor.
This includes:
- Architecture scaffolding (Kconfig, CMakeLists, arch selection)
- Public headers (arch.h, thread.h, exception.h, error.h)
- Core runtime: context switch, interrupt/exception handling, idle, TLS
- Memory management stubs for flat-memory H2 guest model
- SoC support for QEMU hexagon virt machine
- CMake/LLVM toolchain integration for hexagon cross-compilation
Hexagon uses H2's GEVB (Guest Event Vector Base) for interrupt dispatch
rather than a traditional function-pointer vector table, so
GEN_IRQ_VECTOR_TABLE is disabled by default.
Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
Add a first-class Espressif QEMU emu platform (probe, merge-bin,
build-dir eFuse images, run/debugserver). Require
ESPRESSIF_QEMU_MCUBOOT_BIN to be absolute because merge runs from
the build tree.
Append PSRAM -m from CONFIG_ESP_SPIRAM_SIZE with discrete-size
validation, S3 octal -global when CONFIG_SPIRAM_MODE_OCT, and
accept colon-separated ESPRESSIF_QEMU_PATH / QEMU_BIN_PATH lists.
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
Build the virtio-blk QEMU device in the emulator fragment, for PCI as well
as MMIO, and let a board point it at its transport through
QEMU_VIRTIO_BLK_TRANSPORT, instead of qemu_cortex_a53 assembling the MMIO
device itself. Boards reaching virtio over MMIO now get the device without
repeating the block size handling.
No functional change.
Assisted-by: Claude:opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Changes the git_describe function to allow calling on files, not just
directories. When called on a file git describe will find the directory
the path is contained in and then run git describe there.
Signed-off-by: Duncan Rhoads <rhoadsduncan@gmail.com>
Signed-off-by: Lucas Lessard <lucasthomaslessard@gmail.com>
Zephyr build system supports the use of CMake variables on command line
invocation for settings such as CONF_FILE, like
`-DCONF_FILE="\${<var>}/foo.conf"`.
However this principle only works for variables existing in the current
CMake scope, for example cache variables or already resolved sysbuild
variables where `zephyr_get(<var>)` has already been called.
This means that when using sysbuild, then the use of
`-D<var>="\${APP_DIR}/file.txt"` results in different behavior depending
on whether `zephyr_get(APP_DIR)` has been called previously in CMake or
not.
Support the use of `${<var>}` for vars already defined through sysbuild
by looking up `<var>` if it haven't been resolved yet.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
The note under board_set_runner() was written as "NOTE:" followed by
lines indented deeper than it, which docutils parses as a definition
list: the whole first sentence became a 66-character definition term,
and the rest its definition.
Use a note directive instead, so it renders as an admonition and reads
as one paragraph.
Assisted-by: Claude:opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Compiler capability probes go through try_compile(), which only sees
CMAKE_REQUIRED_FLAGS; the target flags collected in TOOLCHAIN_C_FLAGS are
applied as target properties and never reach it. CMake propagates
'--target=<triple>' on its own, but the triples set by the LLVM toolchain
only pin the architecture profile, so probes run against clang's default
CPU for that triple: cortex-m3 soft-float for armv7m-none-eabi, generic
soft-float for armv8m.main-none-eabi, and rv32imac/ilp32 for
riscv32-unknown-elf regardless of the configured extensions.
Pass the architecture flags that the triple does not carry, so flag
support is decided for the ISA actually being built. This also makes the
toolchain capability cache key, which is derived from the compiler
signature and CMAKE_REQUIRED_FLAGS, distinguish targets that share the
same clang binary.
Assisted-by: Claude:opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Running 'west topdir' pays for west's whole CLI import chain - argparse
setup, command discovery, west.app.main - only to print one path. Call
west.util.west_topdir() directly instead, which saves around 100 ms per
configure.
The output is unchanged: west's own CLI computes it the same way, and
PurePath().as_posix() reproduces the formatting it applies before
printing. The two failure paths are also untouched - a west version
import failure stays fatal, while a missing topdir stays tolerated so a
tree without a west workspace still configures.
'west build' already passes -DWEST_TOPDIR, so this helps plain cmake
invocations and twister, which configure without it.
Assisted-by: Claude Code:claude-opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
CMake stopped adding -mcpu itself once CMP0123 became NEW, and Zephyr
only passes it through TOOLCHAIN_C_FLAGS, which does not reach
try_compile. Compiler capability probes were therefore evaluated
against armclang's default CPU rather than the one being built for.
Add -mcpu to CMAKE_REQUIRED_FLAGS so probe results match the target.
Assisted-by: Claude:opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The CMake build system targets `flash`, `debug`, `debugserver`, `attach`
and `rtt` were deprecated in Zephyr 4.3 and are removed here as part of
the 4.5 deprecation removal cycle. They were thin wrappers that shelled
out to the corresponding west command, so users must now call `west
flash`, `west debug`, `west debugserver`, `west attach` and `west rtt`
directly. Note that `west build -t <target>` and `ninja <target>` are the
same mechanism, so both spellings are affected.
The generator loop was the only consumer of the `WEST_DIR` lookup and of
cmake/flash/check_runner_dependencies.cmake, so both are removed as well.
The runners.yaml generation in cmake/flash/CMakeLists.txt is kept: it is
what the west commands read, and it is also included directly by the
Nordic UICR helper projects.
The `run`, `run_<emulator>` and emulation `debugserver` targets are
provided by cmake/emu and are not affected.
Documentation that told users to run `ninja flash`, `ninja debug` or
`ninja attach` is updated to the equivalent west command, and the
zephyr-app-commands directive now rejects the removed goals when the
cmake tool is selected, so the docs cannot regress.
The now-unused RUNNERS_DEPS variable and the
check_runner_dependencies.cmake helper, which only existed to serve those
targets, are removed as well.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
CMAKE_<LANG>_INCLUDE_WHAT_YOU_USE and CMAKE_<LANG>_ICSTAT are set the
same way the compiler launchers used to be. Nothing sets a normal
variable of those names today so they are not shadowed, but there is no
reason to keep them in the cache either, where they would also survive a
change of ZEPHYR_SCA_VARIANT.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The dtdoctor wrapper runs the compiler or linker command unmodified and
only annotates its output, so it can share the launcher chain with
ccache instead of displacing it. Keep whatever launcher was already
configured at the end of the chain, giving '<wrapper> -- ccache <cc>'.
This is deliberately left to each tool: an SCA tool that intercepts the
compiler, such as sparse, ECLAIR or Coverity, cannot be combined with
ccache and must keep replacing it.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
SCA tools installed their launchers as cache entries, but since CMP0126
a cache entry no longer removes a normal variable of the same name, so
they ended up shadowed by the launchers FindTargetTools sets for ccache
and the tool silently never ran. This started with a119dbf957, which
bumped the minimum CMake version to 3.28.0 and thereby turned the policy
to NEW.
There is no reason for these to be cache variables: they are INTERNAL
and sca.cmake is re-included on every configure. Setting them as normal
variables in the scope where FindTargetTools sets the ccache ones makes
the SCA launcher take effect again regardless of the policy, and stops
stale entries from surviving a change of ZEPHYR_SCA_VARIANT in an
existing build directory.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Document the CMake modules, variables and target properties exposed by
the Zephyr build system, using the upstream CMake Sphinx domain so that
entities can be cross-referenced from the rest of the documentation
rather than looked up by reading the .cmake sources.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
zephyr_linker_sources() re-read and rewrote a snippet file on every call.
Rewriting a file updates its mtime even when the content is identical,
which dirties every ninja edge depending on it: all 14 snippets-*.ld
files were rewritten on every re-configure with byte-identical content.
Accumulate the lines in global properties instead and write each file
once, from a flush deferred to the end of the configure stage.
file(GENERATE) leaves a file untouched when its content is unchanged, so
a re-configure no longer perturbs the build graph.
The dirtied edges are otherwise masked by the syscalls trigger file being
touched at configure time. With that fixed as well, the rebuild after a
no-change re-configure drops from 0.44 s to 0.04 s for hello_world and
from 0.69 s to 0.05 s for echo_server.
Calling zephyr_linker_sources() after the flush cannot take effect and is
now a fatal error rather than a silently dropped snippet.
Assisted-by: Claude Code:claude-opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The loop that recalculates the checksum after kconfig.py runs is only
consumed inside if(CREATE_NEW_DOTCONFIG). On any configure that does not
regenerate .config its result is discarded, so hashing all 5001 parsed
Kconfig sources is pure waste, measured in isolation at 168 ms.
Move the loop into the block that consumes it. The file(STRINGS) read
above stays where it is, as it also feeds the CMAKE_CONFIGURE_DEPENDS
registration, which must keep running unconditionally.
Assisted-by: Claude Code:claude-opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Accumulate the per-file MD5 checksums with string(APPEND) rather than
set(var "${var}${checksum}"), and register the configure dependencies
in a single set_property() call instead of one call per parsed Kconfig
file, of which there are 5001 for a hello_world build.
This is primarily a readability change; it may also be marginally
faster depending on the CMake version and host.
Assisted-by: Claude Code:claude-opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Stop glob-expanding the entries of a zephyr_code_relocate(FILES ...)
list. Expanding a pattern to several files has been deprecated since
Zephyr 4.2; the supported way is to expand it in CMake with
file(GLOB ...) and pass the resulting file names.
A pattern is now rejected with a named error instead of being silently
accepted, so the failure cannot go unnoticed. Entries without pattern
characters keep their current behaviour, including the "Not found"
warning for a missing file. All in-tree callers already pass explicit
file names.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
Remove the fallback that pulled a board revision Kconfig fragment from
${BOARD_DIR}/<board>_<qualifiers>_<revision>.conf, deprecated since
Zephyr 4.2. Board revision configuration must be placed in
<board>_<revision>_defconfig, which is picked up by the regular
zephyr_file(CONF_FILES ... DEFCONFIG) lookup.
No in-tree board matched the fallback. The two files
boards/olimex/lora_stm32wl_devkit/olimex_lora_stm32wl_devkit_[CD].conf
are named after it but were never loaded: the fallback only ever matched
the fully qualified <board>_<soc>_<revision>.conf name, and these lack
the stm32wle5xx qualifier. They are deleted as dead files, which leaves
the build output unchanged. A board maintainer who does want
CONFIG_REGULATOR=y on that board should add
olimex_lora_stm32wl_devkit_C_defconfig instead; doing it here would be a
behaviour change rather than a deprecation removal.
BOARD_REVISION_CONFIG itself is kept: sysbuild still sets it, and it is
still merged into the final configuration.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
Delete cmake/app/boilerplate.cmake, the backward-compatibility shim for
the pre-2.x "include(.../boilerplate.cmake NO_POLICY_SCOPE)" idiom. It
has warned on every direct inclusion since long before Zephyr 4.2 and
does nothing but forward to find_package(Zephyr).
Applications must use find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
as their first CMakeLists.txt statement. Nothing in-tree referenced the
file.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
Remove CONFIG_PLATFORM_SPECIFIC_INIT and its z_arm_platform_init() hook,
deprecated in favour of CONFIG_SOC_RESET_HOOK / soc_reset_hook() well
before Zephyr 4.2 and therefore due for removal in 4.5.
The option had no reader left: neither cortex_m/reset.S nor
cortex_a_r/reset.S tests it, both only branch to soc_reset_hook(). Its
single in-tree selector, soc/renode/cortex_r8_virtual, is migrated to
select SOC_RESET_HOOK and its hook renamed to soc_reset_hook(); the body
is unchanged. Note that this re-activates the SCTLR.V clear on that SoC,
which had silently been dead code since the reset paths stopped calling
z_arm_platform_init() - the SoC now again selects the low exception
vector base as originally intended. It runs slightly later in the reset
sequence, after the per-mode stack pointers are set up. This should be
smoke-tested under Renode.
The stale z_arm_platform_init mention in the IAR linker script helper
comment is updated to soc_reset_hook.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
GCC 11+ defaults to DWARF v5, and -gdwarf-4 was forced only because
older pyelftools could not parse it. pyelftools has supported DWARF v5
since 0.27, and Zephyr now requires pyelftools>=0.29 (with CI pinned to
0.33), so the workaround is no longer needed. Remove the forced
-gdwarf-4 from both the compiler and linker flags to let GCC emit its
default DWARF version.
Assisted-by: Claude:opus-4.8
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
This allows i.e. non-interactive use and generating JSON reports of given
list of functions with an associated max stack sizes and flexibility to
add any other options.
Relates to #112163
Signed-off-by: Paul Würtz <paulwuertz@posteo.de>
k_sleep(), k_msleep() and k_usleep() are declared in kernel.h today.
Later commits grow that API with a tick based primitive plus inline unit
conversions, which is more than kernel.h ought to carry for a single
service.
Move the three declarations verbatim into a new include/zephyr/sleep.h
and have kernel.h include it, so existing users need no change. The new
header has to be registered with zephyr_syscall_header(), otherwise the
marshalling stubs for k_sleep() and k_usleep() stop being generated and
CONFIG_USERSPACE builds fail to find k_sleep_mrsh.c.
The unit_testing platform fabricates empty stand ins for the generated
syscall headers rather than running the generator, so sleep.h has to be
added to that list too. Without it any unit test reaching kernel.h fails
to find zephyr/syscalls/sleep.h.
The sleep syscalls also have to be excluded from the automatic syscall
tracing in gen_syscalls.py, as kernel.h already is. They carry hand
written trace points in kernel/sleep.c, and without the exclusion the
generated wrapper would wrap every call in a second set.
No functional change. A test application built for nucleo_f030r8 comes
out byte identical, at 10952 bytes of FLASH before and after.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>