Align with native_simulator's upstream main
14bbf7010dfcde473f11a6ae5674abc1e72aa488
Which includes:
14bbf70: nct: Add function to get thread stack information
Signed-off-by: Scott Shawcroft <scott@adafruit.com>
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Update unit tests to verify YAML-based parameter serialization instead
of CLI arguments. Add tests for twister config file parsing and update
existing tests to check pytest_params object and YAML output.
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
Add comprehensive YAML configuration support for pytest-harness
integration, replacing CLI argument approach with structured
configuration files while maintaining backward compatibility.
Key changes:
- Add --twister-config option to load test parameters from YAML
- Refactor TwisterHarnessConfig to support CLI and YAML configuration
- Move pytest parameter generation from CLI args to config files
This enables more flexible test configuration through structured YAML
files and improves the overall architecture of pytest-twister
integration.
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
in some multi-core platform, `west flash` can not support all cores.
`west debug` is supported to test secondary core, add this to twister
such as with
`--west-flash-cmd=debug` in twister command
or with
`--west-flash-cmd: debug` in hwmap.yaml
and same with pytest
command line setting will overrid the one in hwmap
Signed-off-by: Hake Huang <hake.huang@nxp.com>
Co-authored-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
Make sure that we don't allow bindings which manually
specify any defaults for the #address-cells or #size-cells
properties. See DTSpec 2.3.5.
Signed-off-by: Martí Bolívar <marti.bolivar@oss.qualcomm.com>
The devicetree specification section 2.3.5 says:
The #address-cells and #size-cells properties are not inherited
from ancestors in the devicetree. They shall be explicitly
defined.
A DTSpec-compliant boot program shall supply #address-cells and
#size-cells on all nodes that have children.
If missing, a client program should assume a default value of 2
for #address-cells, and a value of 1 for #size- cells.
We are currently allowing defaults -- and notably, different defaults
from those recommended in the spec -- in the zephyr bindings for these
properties to pass without complaint.
Further, allowing the user to specify a default other than the
recommendations by the spec would be a bad design decision in my
opinion.
Handle this by erroring out explicitly when we try to set these
defaults in a binding. It's fine for people to do things like define
descriptions for these properties in a binding for some specific
compatible, but it's a footgun to allow bindings that would seem to
allow overruling the specification's explicit recommendation.
Signed-off-by: Martí Bolívar <marti.bolivar@oss.qualcomm.com>
It's a pattern that exists in the codebase and makes for much more
readable multi-line `#if defined` statements.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
Removes code duplications and changes uses of Perfetto (viewer) to Trace
Event (format)
Signed-off-by: Maciej Sobkowski <msobkowski@antmicro.com>
Signed-off-by: Krzysztof Sychla <ksychla@antmicro.com>
Signed-off-by: Eryk Szpotanski <eszpotanski@antmicro.com>
When everything goes well, run_cmake() returns the combined stdout+stderr
from CMake. But when CMake fails, it was raising a Python exception with
the barely useful exit status and discarding all messages. Use log.err()
to print CMake outputs on failure.
This issue was reported on Discord: someone had a Python version lower
than the minimum currently required by listsdk.cmake and there was zero
useful message. Running listsdk.cmake directly showed the issue. Error
handling: never tested much.
Fixes commit 31bdad5299 ("west: Implement CMake helpers in
scripts/west_commands")
Signed-off-by: Marc Herbert <marc.herbert@gmail.com>
Simplify the design by removing the `detected` attribute from
HardwareMap class and DUT storage from ProjectBuilder class.
Instead of storing detected DUTs as instance attributes, pass
them as method parameters where needed.
This eliminates data duplication since ProjectBuilder can access DUTs
directly from the environment object, and HardwareMap doesn't need to
maintain its own copy of detected DUTs. The refactoring makes the code
cleaner and reduces the risk of inconsistent state between different
objects storing the same DUT information.
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
Z_HEAP_MIN_SIZE and Z_HEAP_MIN_SIZE_FOR were defined in kernel.h as
hardcoded magic numbers gated by a growing tower of #ifdefs — one
per Kconfig option that happened to affect the heap struct layout.
Every internal change required manually recomputing the constants,
duplicating layout knowledge across files, and praying nobody forgot
to update the #ifdef matrix. This is fragile and unscalable: adding
a single new heap feature (e.g. a chunk canary trailer) would add yet
another dimension to the combinatorial explosion.
Replace this with build-time computation from the actual C structures.
A new lib/heap/heap_constants.c is compiled as part of the offsets
library and uses GEN_ABSOLUTE_SYM to emit the correct values into the
generated offsets.h. Z_HEAP_MIN_SIZE is derived through an iterative
fixed-point expansion (3 rounds, always convergent) that mirrors the
runtime logic in sys_heap_init(). Z_HEAP_MIN_SIZE_FOR overhead and
bucket sizes are also generated, keeping all internal heap layout
knowledge in one place.
Big vs small heap determination uses CONFIG_SYS_HEAP_SMALL_ONLY,
CONFIG_SYS_HEAP_BIG_ONLY, and sizeof(void *), mirroring the
big_heap_chunks() logic in heap.h.
kernel.h picks up the generated values via
__has_include(<zephyr/offsets.h>) so there is no circular dependency
with the offsets compilation itself. The old _Z_HEAP_SIZE manual
sizeof and BUILD_ASSERT scaffolding in heap.c are removed.
gen_offset_header.py is updated to accept multiple input object files
so that the heap constants object can coexist with the per-arch offsets
object in the same offsets library. COMMAND_EXPAND_LISTS is added to
the offsets generation custom command so that CMake correctly expands
the $<TARGET_OBJECTS:> generator expression into separate arguments
when the offsets library contains more than one object file.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
The generate_any_tree function finds all matching nodes when inserting
into the tree, but only actually needs the first match. It also does
this search multiple times for the same node as it traverses the tree.
Optimize this in two ways: first, use an iterator that stops
after the first match, and second, cache matching nodes to avoid
repeat searches.
Signed-off-by: Graham Roff <grahamr@qti.qualcomm.com>
Strip comments from the source files before the parser extracts syscall
and subsystem metadata. The comment removal is performed directly inside
scripts/build/parse_syscalls.py, after which the filtered source is
processed with the existing regular‑expression based parser.
The underlying problem is that metadata for syscalls and subsystem that
has been commented‑out is still extracted and written to the generated
JSON file.
Signed-off-by: Alexey Nikolaev <alexeynikzzz@gmail.com>
Update getting started guide, release notes, CI actions, ruff,
build system, and Python version compliance check to use Python
3.12 as minimum supported version.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
This commit refreshes the pinned versions and SHAs for the
requirements.txt files and requirements-actions.txt files.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The TEST_SHELL config was removed in commit be0dff6844
("test: remove TEST_SHELL") a while ago.
Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
The config options have been renamed in commit 8dc3f85622
("hwmv2: Introduce Hardware model version 2 and convert devices"),
therefore update them in the hardend file.
Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
This part of the regular expression may cause exponential backtracking
on strings containing many repetitions of '\n\r'.
Signed-off-by: Jan Gałda <jan.galda@nordicsemi.no>
Add support for fetching blobs from Git LFS HTTP(s) servers using
the LFS API to discover the blob URL.
This fetcher relies on the `sha256` and `size` fields in the blob
metadata to perform an API request to the LFS API in `url` to
get the download URL for the blob.
Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
Decouple fetcher selection from the URL by adding a new field
`fetcher` to the blob metadata. If not set, fall back to parsing
the schema from the URL.
Add an optional field `size` to declare the size of the blob in
bytes.
Update documentation to cover the new additions. Fix a typo
`uri`->`url` and document the `click-through` field together
with the new fields.
Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
Pass the entire blob context to the fetcher instead of only
the URL to allow for fetchers that require more context than
a single URL.
Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
Expressions will now indent to align with the group they are in example:
Was
```devicetree
dmas = <&dma2 1 0 (STM32_DMA_MODE_NORMAL | STM32_DMA_PRIORITY_HIGH |
STM32_DMA_16BITS) 0>;
```
Now
```devicetree
dmas = <&dma2 1 0 (STM32_DMA_MODE_NORMAL | STM32_DMA_PRIORITY_HIGH |
STM32_DMA_16BITS) 0>;
```
Signed-off-by: Kyle Bonnici <kylebonnici@hotmail.com>
The same symbol may be found multiple times when a function is declared in
a header, which causes anytree.search.find() to throw a CountError.
Catch the exception and ignore duplicate symbols instead of crashing.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
System-wise objdump can select different target for the same zephyr.elf
file depending on e.g. operation system, which can lead to discrepancies
and error in zaru.py script.
Using elftools fixes this problem.
Signed-off-by: Eryk Szpotanski <eszpotanski@antmicro.com>
Add support for ARCH_HDR_VER 3 (RISC-V 32-bit layout) and 4
(RISC-V 64-bit layout), carrying all 33 registers in GDB order
(x0-x31 and pc).
For versions 3/4, map tuple entries directly to GDB register numbers.
Keep ARCH_HDR_VER 1/2 parsing unchanged so existing stored dumps
can be decoded as well.
Signed-off-by: Mirai SHINJO <oss@mshinjo.com>
Moving ZEPHYR_BASE from environment.py to constants.py
allows importing classes like HardwareMap in
pytest-twister-harness module without pulling in unnecessary
dependencies from environment.py.
This refactoring improves module independence and makes selective
imports cleaner across the twister Python package structure.
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
When user only wants to list tests or tags twister should
not clean previous results.
This change improves also performance for listing tests.
Signed-off-by: Lukasz Fundakowski <lukasz.fundakowski@nordicsemi.no>
The undefined Kconfig compliance check may report symbols as
undefined when the corresponding external module is not present.
This results in false positives, since such symbols are provided
only when the module is included in the workspace.
Exclude doc/develop/manifest/external from the grep search used by
the undefined Kconfig check.
This avoids extending UNDEF_KCONFIG_ALLOWLIST for optional external
modules while keeping the check strict for core Zephyr symbols.
Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
Refactored main function for Twister execution.
- Rewrote the main function as a class and divided it into smaller,
more maintainable methods.
- Improved code structure, making it easier
to test with unit and module tests.
- Reduced the amount of code in a single function,
enhancing readability and understanding
Signed-off-by: Lukasz Fundakowski <lukasz.fundakowski@nordicsemi.no>
After the removal of the SOF module from the manifest, we should
no longer assume SOF source is available in the signing script.
If SOF source directory does not exist, we point the rimage
config directory to the support directory inside board directory
so that we can use local file to sign images.
Note that with this change, pulling SOF via Zephyr manifest is
no longer supported. Only SOF pulling in Zephyr via manifest is
supported.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Environment variable RIMAGE_SIGN_KEY can be used to specify
the signing key for rimage. We should check if it points
directly to the key instead of always prefixing it with SOF
path.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Obsolete the bespoke --reset-mode parameter in favor of the new standard
--reset-type parameter.
Signed-off-by: Pete Johanson <pete.johanson@analog.com>
Add support for setting the reset type for the jlink runner, to support
targets that need a non-default reset type for proper `reset halt`, etc.
Signed-off-by: Pete Johanson <pete.johanson@analog.com>
For some devices, the default JLink reset type may not work properly, so
allow overriding the reset type by passing, e.g. --reset-type=12 when
flashing.
Add new field to RunnerCaps to allow runners to specify either a fixed
list of possible types, or True to expose the standard --reset-type
parameter for that runner.
Signed-off-by: Pete Johanson <pete.johanson@analog.com>
boolean_strict_init.cocci would find false positive when a compilation
unit would contain a boolean variable "x" somewhere, and, in a different
scope, another variable "x" of e.g. int type that was assigned a 0 or 1.
See for example drivers/sensor/adi/adxl367/adxl367_stream.c:97 where
fifo_wmark_irq is declared as an int in the scope of the function but
as a bool in adxl367_process_status_cb.
This also adds the patching part to the script so that violations can be
fixed automatically.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Update the Zsh completion script to support newer west extensions and
commands, bringing it closer to feature parity with the Bash completion.
Key changes:
- Add completion support for twister, bindesc, blobs, robot, sdk,
packages, patch, gtags, simulate, and reset
- Improve option completion for build, flash, debug, and runner commands
- Enable dynamic lookup for boards and shields
- Refactor argument handling for better Zsh compliance
Fixes#73129
Signed-off-by: Omkar Nanajkar <nomkar2131@gmail.com>
Commit 58bf2dc0e6 replaced pykwalify with
jsonschema for Zephyr module.yml files. However the west 'packages'
extension uses this module to list Python dependencies for Zephyr and
active Zephyr modules.
Make YAML validation optional using a new argument.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
The coredump parsing script raises an exception as it tries
to format bytes objects as integer (":d").
This is a regression from a recent PR fxing ruff warnings.
Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>