Add optional min/max properties to edtlib spec to specify a valid range for
int or array type values.
Assisted-by: Claude:claude-sonnet-4.6
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
In the latest release of STM32CubeProgrammer for Apple Silicon macs, the
path to 'STM32_Programmer_CLI' executable has moved.
Signed-off-by: Alex Fabre <alex.fabre@rtone.fr>
Add a test case verifying that a parenthesized expression evaluating to
a negative value (e.g. `(4 - 6)`) is preserved as signed when decoded
via to_num(signed_aware=True) and to_nums(signed_aware=True), extending
the existing coverage for negative literals like `(-1)`.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Linter not ensures that > and ] have no white spaces when these are
preceded with a block comment.
Signed-off-by: Kyle Bonnici <kylebonnici@hotmail.com>
Security:
- Update dependency to address CWE-1333, CWE-407
Changed:
- `#includes` are no longer indented to match the depth of the node they
are in.
Added:
- Formatting: removes lines ending with `\` when this is not required.
- Formatting: node names are formatted to not have `0x` and `ULL`
Fixed:
- Formatting: Remove extra space between `>` or `]` when token before is
from some comment
Signed-off-by: Kyle Bonnici <kylebonnici@hotmail.com>
The --flash-timeout and --base-timeout options in plugin.py had
hardcoded defaults of 60. This breaks the 'or' fallback chain at
twister_harness_config.py:140-141 since 60 is truthy and always
wins over values from the YAML config file.
Result: Command line timeout options were completely ignored when
config file values were present.
Changes:
- Set plugin.py defaults to None so the fallback chain works correctly
- Add explicit 60 fallback at the end of the chain in
twister_harness_config.py to preserve default behavior
- Update test to use non-default value (120s) to verify config values
Signed-off-by: Jeremy Truttmann <jetstreeam.code@outlook.com>
The Manifest.path property is deprecated. Use manifest.abspath
instead, which returns the absolute path to the manifest file.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Change stm32cubeprogrammer runner to request a system reset ('-rst'
argument instead of STM32_Programmer_CLI) instead of starting execution
from flash base address ('--start' with sub-options) unless a specific
start address and/or start address modifiers argument are passed
Update stm32n6570_dk and nucleo_n657x0_q boards, adding '--no-reset'
option when programming flash since the board cannot boot after flash
programming unless boot pins (boards physical jumpers) are modified
as described in the related Zephyr board documentation.
This change allows to default start execution on TF-M based devices,
where TF-M entry point is already programmed on device (refer to
use of regression.sh script in related ST boards 'ns' variants)
while other boards will boot from their default boot address
as already supported.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Add reset capability to stm32cubeprogrammer. Upon --reset option
passed to runner, the target device starts execution.
Note that 'west flash' command always passes '--reset' option to
the runner (here stm32cubeprogrammer) unless '--no-reset' is passed
to the 'west flash' command, or there are multiple images/boards to
program should should not execute once the whole setup is programmed.
See the details in scripts/west_commands/run_common.py or commit
a0267d2f48 ("west: runners: Add run once commands and deferred reset").
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Add generated macros for counting nodes on a specific bus under a bus
controller:
- DT_(INST_)DESCENDANT_NUM_ON_BUS()
- DT_(INST_)DESCENDANT_NUM_ON_BUS_STATUS_OKAY()
The count intentionally walks descendants instead of only direct children.
This covers common devicetree structures where helper/container nodes sit
between a controller and the actual on-bus device nodes.
Traversal stops at child bus-controller nodes, so devices behind sub-buses
are not counted in the parent controller's result.
Also add edtlib Node.on_bus resolution, validated against the parent bus
controller bus types, so generation uses the resolved on-bus value.
Signed-off-by: Swift Tian <swift.tian@ambiq.com>
The memory type (RAM or ROM) in the top-ten symbol size table is not
styled correctly and just shows up as normal text following the symbol
name. Fix this to match the style used in the main table (right-
aligned and smaller).
Signed-off-by: Graham Roff <grahamr@qti.qualcomm.com>
Add scripts/ci/undef_kconfig_files_allowlist.txt, a new configuration
file that lists source files to skip entirely during the undefined
Kconfig symbol check (check_no_undef_outside_kconfig). All CONFIG_
references found in a listed file are ignored, avoiding the need to
add each symbol individually to undef_kconfig_allowlist.txt when an
entire file is known to be a false-positive source (e.g. generated
files or documentation referencing out-of-tree symbols).
The file list is loaded from the default path at run time, and can be
extended via the UNDEF_KCONFIG_FILES_ALLOWLIST_FILE environment
variable, consistent with the existing UNDEF_KCONFIG_OUTSIDE_ALLOWLIST_FILE
mechanism.
Assisted-by: Claude:claude-sonnet-4.6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Three related bugs caused symbols in memory regions starting at address
0x0 (e.g. ITCM on Cortex-M7) to be mis-attributed to unrelated source
files in the size report.
1. Functions at address 0 silently dropped in do_simple_name_matching
The guard `if DW_AT_low_pc != 0` was intended to skip weak or
garbage-collected functions whose linker address was never resolved.
However it also discards legitimate functions whose VMA is 0x0, such
as the first function in an ITCM section that starts at address 0.
Fix: when DW_AT_low_pc is 0, validate against the ELF symbol table
before deciding whether to skip the DIE.
2. TLS variables not decoded in get_die_mapped_address
get_die_mapped_address() only recognised DW_OP_addr location
expressions. TLS variables compiled with the local-exec model use
a different expression, which was not parsed, leaving every TLS
variable unmatched.
Fix: add a DT_TLS_LOCATION regex that extracts the TLS section
offset from this expression form.
3. Phantom DWARF DIEs capturing unrelated symbols in
do_address_range_matching
Concrete instances of inlined functions inside garbage-collected
outer functions retain DW_AT_low_pc == 0 and a non-trivial
DW_AT_high_pc in the DWARF, producing address ranges of the form
[0, N] that overlap every symbol at a low address. These phantom
DIEs were consuming unmatched symbols (TLS variables, linker-
generated veneers) and attributing them to unrelated source files.
Fix: if no non-TLS, unmatched function symbols exist at address
zero then skip all zero-address DIEs in do_address_range_matching(),
as they cannot correspond to code in the current binary.
Signed-off-by: Graham Roff <grahamr@qti.qualcomm.com>
reuse>=6.0.0 pulls in python-magic, which requires libmagic.dll on
Windows. python-magic-bin bundles it under <magic_pkg>/libmagic/ but
python-magic's loader.py only searches PATH and cwd.
Signed-off-by: Yves Wang <zhengjia.wang@nxp.com>
Remove no-name-in-module lint, which we attempt to disable but keeps
coming back with no easy way to subpress.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Rename test fixture files from test_sample.yaml to test_data.yaml and
update all references across twister unit and blackbox tests to use
test_data.yaml.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Update the CI test plan script to search for all supported test
definition filenames (tests.yaml, tests.yml, sample.yaml, testcase.yaml)
when detecting affected tests.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Update `west build -T` help text and `_parse_test_item()` to search for
tests.yaml and tests.yml before falling back to the legacy sample.yaml
and testcase.yaml files.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Now use tests.yaml or tests.yml as the test definition file, sample.yaml
and testcase.yaml are deprecated but will still work for a while while
we transition.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This change enables per thread stack canary for RISC-V.
RISC-V GCC accesses the stack canary via a fixed offset from the
thread pointer (tp) when -mstack-protector-guard=tls is used. The
compiler emits code equivalent to:
lw t0, 0(tp) # load canary from tp+0
Additionally, tp is zeroed in arch_kernel_init() when TLS is enabled,
which means any C function called before thread setup completes (such
as z_early_rand_get or data_copy_xip_relocation) would fault trying
to access the canary.
Introduce STACK_CANARIES_TLS_PREPEND, which places the
.stack_chk.guard section at offset 0 of the TLS block, before .tdata
and .tbss. The compiler flags -mstack-protector-guard-reg=tp and
-mstack-protector-guard-offset=0 are passed so GCC generates the
correct canary access.
With STACK_CANARIES_TLS_PREPEND the per-thread TLS block layout is:
tp --> +------------------+ offset 0
| .stack_chk.guard | (__stack_chk_guard)
+------------------+
| .tdata | (initialized TLS data)
+------------------+
| .tbss | (zero-initialized TLS data)
+------------------+
The RISC-V reset path is extended to initialize tp before any C code
runs by allocating a TLS area on the boot stack and calling
arch_riscv_early_tls_stack_update(). Early boot functions that run
before tp is set up (z_early_rand_get, data_copy_xip_relocation) are
marked FUNC_NO_STACK_PROTECTOR to avoid canary access before tp is
valid.
Signed-off-by: Mayur Salve <msalve@qti.qualcomm.com>
As in PR #106778, using check_call to start up the gdb server doesn't
ignore SIGINT meaning it will exit the debug session without cleaning
up. Using check_call_ignore_sigint fixes the issue.
Signed-off-by: William Jeffreys <wjeffreys96@gmail.com>
Make sure we cover different types of signed_aware parsing. Negative
literals like (-1) or a hex value like 0xFFFFFFFF should result in
different values.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Add negative and negative-array properties to the test binding and
test DTS to verify that signed integer literals are correctly
propagated through edtlib as negative Python integers.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Track the byte offsets of cells parsed from negative literals
(e.g. (-1)) in a new _signed_cell_offsets set on Property. Expose
this via a signed_aware parameter on to_num() and to_nums(): when
True, each cell is interpreted as signed only if it was written as a
negative literal, leaving positive and hex values unsigned.
Update edtlib to pass signed_aware=True when reading "int" and "array"
typed properties so binding values reflect the sign as written in the DTS
source.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Rework the sysbuild artifact relocation approach based on
reviewer feedback: instead of rewriting domains.yaml with
relative paths at package time, keep the original absolute
paths and rebase them transparently in Domains.from_file()
when the file has been moved to a different location.
This makes the fix generic - it works for any consumer of
Domains.from_file() (west flash, twister, pytest-twister-
harness), not just the --package-artifacts path.
Changes:
- domains.py: update from_file() to detect when build_dir
stored in domains.yaml differs from the file's actual
directory and rebase all domain paths accordingly.
Remove the now-unused _resolve_build_dir() helper and
get_domains_with_build_dirs_relative_to() method.
- runner.py: remove _sanitize_domains_file() and its call
site; path fixup is now handled by Domains.from_file().
- test_domains.py: replace the mocked __init__ approach
with end-to-end assertions; add a 'relocated artifacts'
test case that exercises the new rebasing logic.
- test_runner.py: remove test_projectbuilder_sanitize_
domains_file() and references to the deleted method.
Signed-off-by: Hake Huang <hake.huang@nxp.com>
Introduce a Script harness base class to enable running
shell-script-based tests through Twister, primarily
targeting BabbleSim test scenarios. The class provides
subprocess execution, output streaming, and log handling
that Pytest, Ctest, and Bsim now share through inheritance.
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
Add dt_label_compat_enabled() to filter targets that embed a node
label matching a target compatible string.
This helper function will be useful to consider zephyr,mapped-partition
compatible nodes that are now used instead of fixed-partition compatible
nodes for memory mapped flash partitions.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
The gen_shell_aliases.py is used to generate a file that can
be included to the shell to implement aliases support.
Assisted-by: Copilot:claude-sonnet-4.6
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Treat repeated exports of the same symbol/address pair as duplicates
rather than hash collisions when preparing the llext export table.
Log a warning and continue processing so valid duplicates do not
fail preparation.
Also raise a RuntimeError when preparation returns a non-zero status to
surface failures instead of silently continuing.
Signed-off-by: Jun Lai <jun.lai@dolby.com>
Adds support for using the chosen SRAM node for getting the RAM
start address instead of having to rely on Kconfigs
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Create a helper function to decode ULEB128 and replace two hand-rolled
implementations.
Assisted-by: Claude:claude-sonnet-4.6
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Fixed big-endian address decoding in find_kobjects to use struct.unpack
with elf.little_endian.
Assisted-by: Claude:claude-sonnet-4.6
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Instead of writing one item for each set_target_properties()
set_target_properties(${DEVICETREE_TARGET} PROPERTIES <item1>)
set_target_properties(${DEVICETREE_TARGET} PROPERTIES <item2>)
...
set_target_properties(${DEVICETREE_TARGET} PROPERTIES <itemN>)
Write one set_target_properties which contains all items:
set_target_properties(${DEVICETREE_TARGET}
PROPERTIES
<item1>
<item2>
...
<itemN>
)
Later when edt.pickle.cmake is included in extensions.cmake
via include(${gen_dts_cmake_output})
CMake will process the file much faster.
Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
The current implementation of the LLEXT EDK exports only a partial set
of compiler settings to the EDK build system, specifically only the ones
defined by the Zephyr core (the 'zephyr_interface' target). Extending
this to include application and module-specific settings (from the 'app'
target and its dependencies) is tricky, because:
- while evaluating the main CMakeLists.txt, the 'app' target is not
fully configured yet, and
- using generator expressions is not possible due to CMake not allowing
expansion of $<COMPILE_LANGUAGE:...> outside of a proper compile
context.
To work around this, this change introduces a new CMake subdirectory
(misc/llext_edk) that creates a dummy target which imports the build
configuration from 'app', but overrides the C compile rules to simply
output the resulting properties (defines, include directories, flags)
to text files. The EDK generation script then reads those text files
to get the full set of build properties, and includes them in the EDK
tarball.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
This changes the LLEXT EDK flag filtering to be done after the main
Zephyr build is completed. Instead of filtering the flags via genexes,
the full set is passed to the script along with the set of filters to be
applied, and the filter is applied later.
No functional change is intended.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
The DW_OP_plus_uconst offset in DWARF location expressions is
ULEB128-encoded, but the script reads only a single byte. This
silently truncates offsets >= 128, registering kernel objects at
wrong addresses in the kobject hash table.
Clang triggers this because it emits DW_OP_addr + DW_OP_plus_uconst
for variables within structs, while GCC emits a direct DW_OP_addr.
Signed-off-by: Adarsha Regmi <aregmi@qti.qualcomm.com>
parse_syscalls.py scans thousands of headers and source files during a
pristine build. DEVICE_API_EXTENDS is only present in a few files, but the
new API inheritance handling ran api_extends_regex over every file body.
Assisted-by: Codex:gpt-5 hyperfine cProfile
Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
Fixes#105743
The build_dir path is not passed as a command-line argument but
through the YAML config file exchanged between Twister and the
pytest harness. Read build_dir from dut.device_config instead
of request.config.getoption.
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
Some device driver APIs embed and extend other ones (e.g. I3C extends I2C).
Introduce DEVICE_API_EXTENDS to declare parent-child relationships between
device API classes, and update DEVICE_API_IS to use a new _ext_end linker
symbol as the upper bound of its range check.
All device API entries are placed in a single output section
(device_api_area). Child class entries are placed after their parent's
entries using a depth-first walk, and an _ext_end symbol is emitted after
all descendants. This makes DEVICE_API_IS(parent_class, dev) return true
for devices with a child API, and naturally supports multi-level
inheritance.
Example linker output for parent i2c with child i3c:
SECTION_PROLOGUE(device_api_area, ,) {
Z_LINK_ITERABLE(i2c_driver_api);
Z_LINK_ITERABLE(i3c_driver_api);
_i3c_driver_api_ext_end = .;
_i2c_driver_api_ext_end = .;
}
Assisted-by: Claude:claude-opus-4.6
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Allow multi-DUT test scenarios to run on native_sim simulator.
For non-device handlers, create placeholder reserved_duts entries
using CompoundHardwareData so pytest harness can find DUT configs.
Multi-DUT on native_sim is only allowed when all required devices
use the same platform (no cross-platform multi-DUT in simulation).
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
Replace plain dict usage for required_application elements with
a typed RequiredApplication dataclass for improved type safety
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
Add support for flashing a different application to a required
DUT in multi-DUT testing. When a required_device entry specifies
an 'application' field, twister matches it against the
required_applications build dirs and assigns the correct
build_dir to the reserved DUT before flashing.
Move the required applications readiness check from
process_tasks() into ProjectBuilder.process() at the 'run'
stage. This ensures that building is not blocked by the
required_applications mechanism. Mutual
dependencies between instances is also allowed.
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>