Commit graph zephyr/scripts
Author SHA1 Message Date
Dev Joshi
638c6a1f0b scripts: dts: reorder devicetree test fixture
Order reg and ranges before address and size cell properties in the
devicetree test fixture. Reorder CPU properties and the power-states node
to match the devicetree linter's ordering rules.

The linter checks the entire fixture when it changes, so existing
ordering issues also prevent the compliance workflow from passing.

Verified with all compliance checks and 110 python-devicetree tests.
Compliance reports only existing license-header warnings and the disabled
DeviceMmioCheck.

Assisted-by: opencode:gpt-6.1-sol
Signed-off-by: Dev Joshi <devbhave@qti.qualcomm.com>
2026-10-30 12:48:52 -04:00
Dev Joshi
ef6e1f0569 scripts: dts: edtlib: add edt.cpus and cpu.yaml fallback binding
Add three related pieces to edtlib:

1. edt.cpus: a new public list[Node] attribute on EDT, populated in
   _init_nodes() with every /cpus/cpu@N node in DTS source order.
   Identification is structural (child of /cpus whose name without unit
   address is "cpu", per DT spec v0.4 section 3.8) so it works regardless
   of whether the node has a compatible property.

2. cpu.yaml fallback: EDT._cpu_fallback_binding() locates cpu.yaml in
   the already-built _binding_fname2path map and loads it as a Binding
   with require_compatible=False. The result is cached in a per-EDT
   self._cpu_binding instance attribute (lazily on first call). Any
   /cpus/cpu@N node that has no compatible and no parent child-binding
   receives this binding instead of None, giving it typed properties
   (including the device_type: "cpu" default) without requiring a
   compatible string. Each EDT instance has its own cache, so two EDT
   objects with different bindings_dirs are fully independent.

3. _is_cpu_node() helper: a module-level predicate encoding the same
   structural check used by both _init_nodes() and the fallback hook in
   Node._init_binding().

Add edtlib tests for edt.cpus, the cpu.yaml fallback, and the CPU
binding type consistency check.

This fixes Infineon cat1b CPU nodes in dts/arm/infineon/ that have no
compatible property and previously had _binding = None, leaving their
properties untyped and inaccessible to edtlib consumers.

Assisted-by: Claude:claude-sonnet-5.5
Signed-off-by: Dev Joshi <devbhave@qti.qualcomm.com>
2026-10-30 12:48:52 -04:00
Dev Joshi
2f0eb60b12 scripts: dts: edtlib: add var-uint64 property type
Add a new property type to the Zephyr binding system. A var-uint64
property accepts 1 cell (32-bit) or 2 cells (64-bit, high word first)
in DTS, assembles them into a single Python int, and emits a plain
integer literal for DT_PROP, identical in shape to type: int.

This is the prerequisite for supporting both 32-bit and 64-bit encodings
of clock-frequency and timebase-frequency in cpu.yaml. The existing
type: int only accepts a single 32-bit cell, while modeling these
properties as type: array would break all existing scalar DT_PROP call
sites.

Key properties of the new type:
- 1-cell DTS value <N>: val = N (32-bit integer)
- 2-cell DTS value <hi lo>: val = (hi << 32) | lo (64-bit integer)
- 3+ cells: EDTError naming the property and cell count
- const:, default:, min:, max: constraints all work on the assembled
  integer value
- min-len:/max-len: are rejected (var-uint64 is a scalar,
  not an array)
- DT_PROP emits a plain integer literal (no braces, no array)
- DT_PROP_LEN is not generated

Changes:
- edtlib.py: add var-uint64 to ok_types, const_types, min/max allowed
  types, ok_default(); add _prop_val() assembly branch
- gen_defines.py: add var-uint64 branch in prop2value()
- test-bindings/var-uint64.yaml: new test binding
- test.dts: add var-uint64-node exercising all constraint types
- test_edtlib.py: 4 new tests (value assembly, 3-cell error, min
  violation, binding validator rejection of min-len)
- bindings-syntax.rst: add var-uint64 to schema template
  and type table
- kconfigfunctions.py: dt_node_int_prop_int/hex accept property types
  whose value is a single integer (int, var-uint64)
- preprocessor-functions.rst: document accepted types for the two
  functions
- release-notes-draft.rst: document the new binding property type

Assisted-by: Claude:claude-sonnet-5.5
Signed-off-by: Dev Joshi <devbhave@qti.qualcomm.com>
2026-10-30 12:48:52 -04:00
Petr Vorel
7db88b7c9a checkpatch: allow passing config directory
checkpatch.pl searches for .checkpatch.conf in $CWD, $HOME and
$CWD/.scripts.  Allow passing a single directory via CHECKPATCH_CONFIG_DIR
environment variable (empty value is ignored).  This allows to directly
use project configuration file for projects which vendored checkpatch.pl
(e.g.  LTP or u-boot).

Although it'd be more convenient for user to have --conf-dir option
(instead of using environment variable), code would get ugly because
options from the configuration file needs to be read before processing
command line options with Getopt::Long.

While at it, document directories and environment variable in -h help
and HTML doc.

Link: https://lore.kernel.org/20260421211408.383972-1-pvorel@suse.cz
Signed-off-by: Petr Vorel <pvorel@suse.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Perches <joe@perches.com>
Cc: Dwaipayan Ray <dwaipayanray1@gmail.com>
Cc: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
[aric: drop Documentation/dev-tools/checkpatch.rst hunk, not in Zephyr]
(cherry picked from commit 2ddfdfe1ad31ba5be5a1c3b4b2b950cf6b6d7c35)
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Aric Radzin <aric.radzin@gmail.com>
2026-10-29 15:46:03 -04:00
Bill Waters
d4335806a4 twister: reset testcase results when retrying a test suite
With --retry-failed, add_tasks_to_queue() resets the status of a failed
instance before queueing it again, but leaves the per-testcase statuses
from the failed attempt in place.

When the first attempt fails before any output is seen (for example
"Timeout during flashing" on a hardware target), every testcase is
marked blocked. On the retry, only cases that print a result are
updated. Cases that never report, such as ztest cases compiled out of
the image for the current configuration, keep the stale blocked status
and reason, so twister.json shows blocked testcases inside a suite whose
final status is passed. A clean run without a retry reports no status
for those same cases.

Clear the status, reason, duration and output of every testcase after
removing the previous attempt from the status counts, so a retried run
reports the same testcase results as a run that passed first time.

Assisted-by: AI (GitHub Copilot)
Signed-off-by: Bill Waters <bill.waters@infineon.com>
2026-10-28 22:54:35 -04:00
Aric Radzin
08449cc988 scripts: ci: check_compliance: allow empty undefined-symbol grep
check_no_undef_outside_kconfig() runs git grep on the repository being
checked without ignore_non_zero=True. git grep exits 1 when nothing
matches, so on a repository without SB_CONFIG_ references, such as a
downstream application, git() calls sys.exit() and SysbuildKconfig
fails with an exception traceback instead of passing.

Pass ignore_non_zero=True, as the other git grep calls on module and
downstream trees already do. Empty output means no references, which is
already handled.

Fixes #123546

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Aric Radzin <aric.radzin@gmail.com>
2026-10-28 22:52:33 -04:00
Chao Liu
97a3a76636 scripts: pytest: stop QEMU before closing its console FIFO
The QEMU adapter closes the console FIFO while its reader thread can
still be blocked in read(). On macOS this hangs pytest teardown, even
after the test itself has passed.

Stop QEMU first so that its end of the FIFO closes and the reader
returns. Only then release the handles.

Fixes: 1b7810f0cb ("scripts: twister: Support multiple ports in
pytest-twister-harness")

Signed-off-by: Chao Liu <chao.liu@processmission.com>
2026-10-28 22:51:43 -04:00
Emil Gydesen
3f726f007e scripts: ci: set_assignees: request review from whole changed area
When MAINTAINERS.yml changes, only the maintainers of each changed area
were added as reviewers, looked up in the checked-out MAINTAINERS.yml.
Collaborators were skipped, as were people added by the PR and members
of areas that only exist in the PR's version of the file.

Add every maintainer and collaborator of each changed area, taken from
both the base and the updated MAINTAINERS.yml, so the whole area is
notified, including people being added or removed.

Tested with pytest scripts/tests/ci/test_set_assignees.py.

Assisted-by: Copilot:claude-opus-5.5
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-10-28 22:50:40 -04:00
Johan Hedberg
f0ae3ca607 twister: Find static ZTEST test cases in the source scan
A test case can be declared static ZTEST(), which makes its statistics
object static too; many Bluetooth tests do so. The source scan matches
only lines that start with ZTEST, so it misses those cases: --list-tests
leaves them out, --sub-test cannot select them, and they are known only
from the runtime output. On main this concerns 369 test cases in 22 test
directories.

Accept an optional static before the macro in both test case patterns.

Tested with the twister unit tests and with --list-tests over
tests/bluetooth.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-10-28 22:46:01 -04:00
Daniel DeGrasse
3c3c78736b scripts: footprint: size_report: add support for detecting symbol gaps
Add logic to detect gaps between symbols in an object file. These gaps
correspond to data that does not have an associated symbol (often RODATA
like strings). Map these gaps to custom nodes in the rom or ram report,
which show up under the (no paths) node with names like
"gap in symbols at 0x<addr>"

This can help users determine what data is in these hidden ranges if
they then dump their binary at the provided offsets.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@analog.com>
2026-10-28 22:40:57 -04:00
Vinh Dao
0976d9b9c8 scripts: west: runners: Add --dry-run support for RFP
Support dry_run capability in the rfp runner and pass the
--dry-run flag to the runner instance. With --dry-run, the partition
(--rpd-file) and flash rfp-cli commands are printed instead of being
executed, and the check for an installed rfp-cli is skipped so the
commands can be generated on a host without the tool.

Tested with pytest scripts/west_commands/tests/test_rfp.py.

Fixes #122157

Signed-off-by: Vinh Dao <vinh.dao.wr@renesas.com>
2026-10-28 22:40:30 -04:00
Vinh Dao
35eaaaa208 scripts: west: runners: Add --tool-opt support for RFP
Add the common --tool-opt option to the rfp runner so rfp-cli options
without a dedicated runner argument, such as -osc or -auth, can be
passed through west flash. The options are added to both the
partition (--rpd-file) and the flash invocations of rfp-cli.

Tested with pytest scripts/west_commands/tests/test_rfp.py.

Fixes #122157

Signed-off-by: Vinh Dao <vinh.dao.wr@renesas.com>
2026-10-28 22:40:30 -04:00
Jukka Rissanen
9a92a97fdb tests: net: conformance: Add the MLD listener suite
The suite lives in net-tools under ttcn3/suites/mld and plays the
multicast router on the link, checking what Zephyr does as a Multicast
Listener Discovery listener against RFC 3810 and RFC 2710: the report a
join produces and its repeat, the answers to General and Multicast
Address Specific Queries, the silence for a query without Router Alert,
with the wrong hop limit or from a global source, the leave, and the
move to MLDv1 compatibility mode when an MLDv1 querier is heard.

Everything the suite looks at is what the stack does on its own, so the
application here only joins one address, keeps it for a while, leaves it,
waits and starts again for as long as it runs, and a test that wants to
see a join or a leave waits for the next one. It joins once the
link-local address is usable, so that what the suite sees is the
ordinary report and not the re-report that follows Duplicate Address
Detection. It works below IP on zethL2 like the arp and ndp suites, and
needs root for the same reason.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-10-28 22:39:35 -04:00
Jukka Rissanen
a6f50a0ad4 tests: net: conformance: Add the IGMP host suite
The suite lives in net-tools under ttcn3/suites/igmp and plays the
multicast router on the link, checking what Zephyr does as an IGMP host
against RFC 3376 and RFC 2236: the report a join produces and its
repeat, the answers to General and Group-Specific Queries, the silence
for a query without Router Alert, the leave, and the moves to IGMPv2 and
IGMPv1 compatibility mode when an older querier is heard.

Everything the suite looks at is what the stack does on its own, so the
application here only joins one group, keeps it for a while, leaves it,
waits and starts again for as long as it runs, and a test that wants to
see a join or a leave waits for the next one. It works below IP on
zethL2 like the arp and ndp suites, and needs root for the same reason.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-10-28 22:39:35 -04:00
Aric Radzin
1dd3ebe885 scripts: checkpatch: load bundled typedefsfile by default
.checkpatch.conf passed --typedefsfile=scripts/checkpatch/typedefsfile,
which is resolved against the current directory. When checkpatch.pl runs
from another directory, such as a downstream repository using
$ZEPHYR_BASE/scripts/checkpatch.pl directly or through
check_compliance.py, the file is not found and types such as FILE or
NRF_GPIO_Type produce "need consistent spacing around '*'" errors.

Default $typedefsfile to the file next to the script, as is done for
spelling.txt, and drop the option from .checkpatch.conf. Passing
--typedefsfile still overrides the default. Add a regression test that
runs checkpatch outside the Zephyr tree.

Fixes #121910

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Aric Radzin <aric.radzin@gmail.com>
2026-10-28 22:39:25 -04:00
Omar Naffaa
bf28b4eac7 scripts: build: Add support to display priority
Added support to display driver priority and sub-priority
extracted from map file using a newly added "-p" flag.

Signed-off-by: Omar Naffaa <onaffaa@qti.qualcomm.com>
2026-10-28 22:32:56 -04:00
Egemen Tuncarslan
31b78a6dbf dts: edtlib: let a node carry dma-ranges without declaring it
edtlib handles dma-ranges like ranges, but only ranges was exempt from
being declared in the node's binding, so a node with dma-ranges whose
binding does not declare it (e.g. does not include base.yaml) made the
whole devicetree fail to load. Exempt dma-ranges as well and add a
regression test.

Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Egemen Tuncarslan <egementuncarslan@hotmail.com>
2026-10-28 22:29:08 -04:00
Maciej Torhan
bbb431a903 scripts: tracing: Adjust trace viewer to CTF packets
Adds handling of CTF packets and streams in trace_viewer.py script.

Signed-off-by: Maciej Torhan <mtorhan@antmicro.com>
2026-10-28 22:28:09 -04:00
Johan Hedberg
239cc53473 twister: add a Bumble Bluetooth sidecar
Bluetooth Classic tests on native_sim need linked virtual controllers
and one Zephyr instance per device. Without host-side support every
test carries shell scripts that allocate TCP ports, start and stop the
controllers and launch the peers, and that depend on the layout of the
twister output directory.

The "bumble" sidecar provisions this from sidecar_config, so a test
keeps its normal harness and ships no scripts. The controllers bind
kernel-chosen ports and report them to the sidecar, since a port
picked up front can be taken by a parallel worker before it is bound.
The handler watches the guest only, so the sidecar reads the Ztest
results the peers printed and reports the cases they ran, and the
peers share the scenario's timeout with the guest. On a host without
Bumble the test is built but not run.

Based on Anas Nashif's proof of concept for the pre-merge sidecar
framework (nashif/zephyr commit 099427868f7).

Tested on native_sim with Bumble 0.0.220: the acl_conn test passes
with both of its cases reported, also as three instances run in
parallel, and is only built when Bumble is missing.

Assisted-by: Claude:claude-fable-5.1
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-10-28 22:28:03 -04:00
Christoph Busold
2dea66aa7e kernel: userspace: Implement sys_mutex based on k_futex
This allows locking and unlocking uncontended mutexes without
syscalls. The futex stores the TID of the owner. The LSB should
be free, since TIDs are 4-byte aligned, and is used to indicate
if a thread is waiting.

This does not implement priority inheritance (PI), which requires
a different kind of futex.

Update futex test to use k_mutex as non-futex, since sys_mutex
now contains a futex.

Add separate test for futex-based sys_mutex, which does not cover
PI and instead tests the contested path.

Signed-off-by: Christoph Busold <cbusold@qti.qualcomm.com>
2026-10-28 22:26:26 -04:00
Kyle Bonnici
b5422480a0 CI: Enable sorting nodes and properties check
Implements https://github.com/zephyrproject-rtos/zephyr/issues/118202

This PR enables sorting of nodes and properteis.

Order of Properties in Device Node
The following order of properties in device nodes is preferred:

“compatible”
“reg”
“ranges”
Standard/common properties (defined by common bindings,
                            e.g. without vendor-prefixes)
Vendor-specific properties
“status” (if applicable)
Child nodes, where each node is preceded with a blank line

Node are sorted by address.

If node block contains /delete-property/ this will split the node
contents into groups. and sorting is applied within each group.

If a node block contain #include directives, this will split the node
contents into groups. and sorting is applied within each group.

If node containf ifdef/ifndef conditions, no sorting is applied within
that block.

Signed-off-by: Kyle Bonnici <kylebonnici@hotmail.com>
2026-10-28 20:10:28 -04:00
Henrik Brix Andersen
3b42ac0d24 scripts: requirements: west: refresh pinned versions
Run the uv command to update the pinned version in requirements-west.txt.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2026-10-24 07:07:02 -05:00
Henrik Brix Andersen
81b6c0dc7d scripts: requirements: actions: refresh pinned versions
Run the uv command to update the pinned versions in
requirements-actions.txt.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2026-10-24 07:07:02 -05:00
Henrik Brix Andersen
48f1ef888c scripts: requirements: actions: basic: refresh pinned versions
Run the uv command to update the pinned versions in
requirements-actions-basic.txt.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2026-10-24 07:07:02 -05:00
Benjamin Cabé
3a76a3cf8f twister: treat sram segment overflows as overflows
ESP32-P4, C5, C6, C61 and H2 name their RAM region sram0_0_seg, which
the overflow pattern did not match, so a too large image was reported
as a build error instead of an overflow skip like on the other ESP32
SoCs.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5.5
2026-10-22 18:36:26 +02:00
Jamie McCrae
7bc41260cb scripts: west_commands: run_common: Fix issue west attach resetting
Fixes an issue which was introduced when west attach was allowed to
reset the device, as part of west flash common code, a reset
command was added which included when running west attach, prevent
this from being added if west attach is used

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-10-22 18:29:08 +02:00
Egemen Tuncarslan
b1b78047c1 scripts: build: parse_syscalls: fix decode error handling
The decode error message printed `path`, a leftover from the directory
walk that names an unrelated file, or is unbound if nothing was walked.
Drop it, and catch only UnicodeDecodeError, the one error the message
describes.

Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Egemen Tuncarslan <egementuncarslan@hotmail.com>
2026-10-21 13:44:27 +02:00
Henrik Brix Andersen
ffdeaa078c requirements: fetch the reuse tool from the github mirror
Switch to fetching the FSFE reuse tool from the GitHub mirror instead of
directly from Codeberg to work around SSL issues in some contexts.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2026-10-20 17:43:27 +02:00
Carles Cufi
6e62d291f8 west: runners: jlink: Extend registry-based search to JLinkGDBServer
Commit bb1794bf3a introduced a mechanism
in the J-Link runner to find the location of the JLink executable on
Winodws using its registry. This patch extends that to cover
JLinkGDBServer as well, which is located in the same folder on Windows
installations of the J-Link Software and Documentation Pack.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2026-10-20 17:32:50 +02:00
Carles Cufi
572b170631 runners: jlink: Remove unused command-line option: rtt-client
The rtt-client option has been unused since its introduction of the west
rtt command in 73c8235881, since in fact
the runner uses sockets and telnet to interface to RTT.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2026-10-20 17:32:50 +02:00
Henrik Brix Andersen
f78c4deb45 scripts: ci: coverage: analysis: handle functions without execution count
Handle functions without execution count the same way as functions with an
execution count of zero.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2026-10-19 16:35:56 +02:00
Johan Hedberg
2a13a1e7d6 tests: twister: cover the named pipe job server
Check for which installed Ninja and make versions and CMake arguments
the job server becomes a named pipe, that such a job server keeps one
token per job across a claimed job and advertises the pipe in MAKEFLAGS
without passing file descriptors, and that it falls back to file
descriptors or cleans up when the pipe cannot be used or created.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-10-19 10:23:57 +02:00
Johan Hedberg
393c4989da twister: fix the job server being ignored by Ninja 1.13
Ninja 1.13 became a GNU make job server client, but on POSIX it accepts
the job server only as a named pipe. Twister hands out a pair of file
descriptors, so Ninja warns "Ignoring jobserver: Pipe-based protocol is
not supported!" and every build twister runs in parallel starts its own
full set of jobs: a load average of 150 and 11 GB of anonymous memory
for tests/bluetooth on native_sim on a 24-thread machine.

Create the job server as a named pipe when the build tool takes that
form (Ninja from 1.13, GNU make from 4.4) and no make on PATH is older
than GNU make 4.4: such a make stops with an error on a named pipe, and
native builds run make below Ninja. Otherwise, and when extra CMake
arguments select the tools, the file descriptors are passed as before.

Tested with Ninja 1.13.2 and GNU make 4.4.1: without ccache the run
above takes 425 to 438 s instead of 477 s and peaks at 4.4 GB.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-10-19 10:23:57 +02:00
Leo Camus
f07b32b040 scripts: ci: report analyzer: don't look past the start of the build log
_get_info_from_build_failure() reports which region overflowed by reading
the line before the one carrying "error: ld returned":

    if "error: ld returned" in line and "overflowed by" in lines[i - 1]:

At i == 0 that is lines[-1], the last line of the log. That line does not
even come from the build: JsonReport.create() appends the handler's
stderr to the build log before writing it to twister.json, which is what
this tool reads. When it happens to mention an overflow, the function
returns straight away with no region and no build step, hiding the real
overflow further down the log.

Read the previous line only when there is one, as commit 30beaec88f
("twister: reports: don't look past the start of the build log") did for
the same expression in JsonReport._parse_build_failure(); that commit
left this tool for a change of its own.

Add the first unit tests for the tool, covering the region and
build-step cases and the first-line one.

I ran the new cases against the parser directly rather than under pytest,
and did not run the tool on a real twister.json.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Leo Camus <leo.camus23@gmail.com>
2026-10-19 10:12:56 +02:00
Egemen Tuncarslan
94801b80ee tests: west: cover reading a UF2 image in bindesc
Add tests for convert_from_uf2(), which had none, including a gap
between blocks, and list the file under Binary Descriptors.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Egemen Tuncarslan <egementuncarslan@hotmail.com>
2026-10-19 10:12:40 +02:00
Egemen Tuncarslan
36d3c05503 west: bindesc: pad a gap between UF2 blocks with bytes, not ints
Reading a UF2 whose blocks are not adjacent, such as two images built at
different base addresses and concatenated, fails with:

    TypeError: sequence item 1: expected a bytes-like object, int found

Append the padding instead of extending the list with it, as upstream
microsoft/uf2 9332c30e did in uf2conv.py.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Egemen Tuncarslan <egementuncarslan@hotmail.com>
2026-10-19 10:12:40 +02:00
Bill Waters
c43f5b31a3 scripts: twister: reset stale Ztest state on device restart
The twister Test harness attributes every Ztest suite/case marker it
parses to the current run. When a device restarts mid-run -- because it
reboots on its own, or because console output was captured from a
previously-programmed image while the board was still being flashed (the
default flash_before=False opens the serial port before flashing) -- the
markers seen before the restart are left pending. They never reach a
terminal status, so they surface as phantom 'started' cases and produce
spurious 'already STARTED' warnings once the real run re-emits the same
markers.

Discard that stale state when a restart is detected, keyed on two signals
that Ztest emits itself rather than on any application artifact:

- A start marker for a suite or case that is already running. Ztest emits
  these itself, so whenever there is stale state to discard the evidence
  of the restart is already present, with no dependency on any Kconfig.
  This replaces the 'already STARTED' warnings the harness logged for
  these restarts (729 across an 1841-log device-run replay corpus) with a
  correct recovery.
- The "RunID started:" marker that TC_PRINT_RUNID_START prints at the
  start of every run. A second one seen while markers are still pending
  proves the image restarted, so it catches a restart that never re-emits
  a marker that is still pending. It is emitted on every boot when a run
  id is set, and nothing is printed otherwise.

A suite that ends before starting again is a legitimate repeat and is
left alone, as is any suite declaring expect_reboot.

An earlier revision used the Zephyr boot banner for the second signal.
The banner is an application artifact and is optional; the RunID marker
is part of the test output and does not depend on CONFIG_BOOT_BANNER.

Assisted-by: AI (GitHub Copilot)
Signed-off-by: Bill Waters <bill.waters@infineon.com>
2026-10-19 10:10:11 +02:00
Tom Burdick
f2ba448d1d rtio: Update usage of rtio_sqe_cancel
Updates callers of rtio_sqe_cancel to use the newer opaque handle
version which takes into account the generational allocation of SQEs.
The validation of cancel is now safe in that each SQE being cancelled
must belong to the pool in struct rtio the caller has access to and
knows about. It must also be the correct generation of the SQE so that
recycled or freed SQEs are not incorrectly dereferenced with undefined
behavior.

Adds a coccinelle semantic patch to update callers both in and outside
the tree.

A migration guide was updated to include information about the API
change and the usage of the spatch to help out of tree applications
update to the new call semantics. The spatch likely won't fix all
callers but could save some time.

Assisted-by: claude:claude-opus-5 coccinelle
Signed-off-by: Tom Burdick <thomas.burdick@infineon.com>
2026-10-16 09:14:58 +02:00
Tom Burdick
76309bc679 rtio: Make rtio_sqe const friendly
Move several members of the struct out to the containing struct
(iodev_sqe) such that the internal rtio_sqe can be viewed as const data.

In making the containing struct const a few usages of this needed
updating to access the receive buffer through the helper
(rtio_sqe_rx_buf) rather than directly through struct members.

Assisted-by: claude:claude-opus-5 coccinelle
Signed-off-by: Tom Burdick <thomas.burdick@infineon.com>
2026-10-16 09:14:58 +02:00
Benjamin Cabé
d36e0dc932 scripts: ci: check_compliance: Check vendor in shield.yml files
Apply the BoardYml vendor prefix check to shield.yml files too, so a
shield with an unknown vendor is caught before it reaches the board
catalog.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5.5
2026-10-15 20:38:31 +02:00
Benjamin Cabé
e7eae8eb57 tests: spdx: cover the Zephyr package version, purl and CPE
Unit cases for the identity the walker derives for Zephyr: which of a
release tag and the VERSION file names the version, how a pre-release
qualifier maps onto the CPE 'update' field, and what the purl is pinned
to for a fork, an unconfirmed revision, or a checkout recording no
remote. None of those states is reachable from the application test,
which only ever sees the tree it runs in.

That test keeps what a build can show: both Zephyr packages report this
tree's version and carry the matching CPE.

Assisted-by: Claude:opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-10-15 20:34:05 +02:00
Benjamin Cabé
3a5ae97180 scripts: zspdx: always attach a purl and CPE to the Zephyr sources
The CPE was only emitted when an exact vX.Y.Z tag pointed at the built
revision, leaving zephyr-sources and zephyr-deps with no version and no
CPE on every other build, release candidates included. Fall back to the
VERSION file and map EXTRAVERSION onto the CPE update field, so an rc is
recorded as cpe:2.3⭕zephyrproject:zephyr:4.4.0:rc3:*:*:*:*:*:*.

Assisted-by: Claude:opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-10-15 20:34:05 +02:00
Szymon Antkowiak
9e536c5c21 scripts: ci: check_compliance: skip spurious removed-file diffs
When a file is listed in .clang-format-ignore, clang-format-diff will
report a full-file removal. Ignore those patches so it does not suggest
removing ignored file.

Signed-off-by: Szymon Antkowiak <szymon.antkowiak@nordicsemi.no>
2026-10-15 14:20:02 +02:00
Torsten Rasmussen
332c0a69c9 scripts: clarify use of undef_kconfig_allowlist
The commit f87cfbd69d moved the list of
allowed undefined Kconfig symbols away from the corresponding text which
describes that the list is solely intended for false positive Kconfig
symbols, and not for symbols failing because they are not defined in
Zephyr tree.

Add a comment in undef_kconfig_allowlist.txt to clarify the purpose of
the file.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2026-10-15 14:18:45 +02:00
Marc Herbert
6bf57f08b2 scripts: west: runners: core: print an error when pyserial is missing
The entire purpose of resolve_port_by_chip() is to scan serial ports.
So when pyserial cannot be imported, that function becomes entirely
useless. When it's called anyway then it should at the very least
display an error (I think it should not even have caught the
exception but it seems too late for that)

Fixes initial commit 806a6ff3fa.

Signed-off-by: Marc Herbert <marc.herbert@gmail.com>
2026-10-14 13:51:31 +02:00
Thorsten Klein
267db467d1 scripts: west_commands: blobs: validate downloads before caching
This commit supersedes f008ab3:
A blob is now downloaded to a temporary .part file and only moved to the
final path once the sha256 checksum matches. A failed or corrupted
download from one URL falls through to the next URL instead of
poisoning the cache.

download_blob() now guarantees that the target path holds a valid blob
or raises ZephyrBlobException.

Signed-off-by: Thorsten Klein <thorsten.klein.git@gmail.com>
2026-10-13 14:12:41 -05:00
Jonghyun An
246bb5228c scripts: build: add file2hex CLI tests
Exercise the file2hex CLI with offsets, zero length, partial and exact
chunk boundaries, empty files, EOF and the unlimited default. Check both
output formats and gzip round trips. Validate list syntax to catch empty
chunks that would otherwise produce lone commas.

All 80 cases pass with the fix; 12 fail without it. The existing Scripts
tests workflow runs this test alongside the other build script tests.

Assisted-by: Codex:GPT-6
Signed-off-by: Jonghyun An <markajh@gmail.com>
2026-10-13 09:44:13 +02:00
Jonghyun An
753fa94d33 scripts: build: file2hex: respect the length across chunks
The chunk reader keeps emitting data after the requested length is
consumed. A 3328-byte input with --offset=11 --length=1 produces four
bytes. Exact chunk boundaries also produce empty chunks in list output.

Limit each read to the remaining byte count and stop at zero or EOF.
Preserve -1 as the unlimited default. Verify the generated include size
through the CMake helper and run the Scripts tests and gen_inc_file suite.

Assisted-by: Codex:GPT-6
Signed-off-by: Jonghyun An <markajh@gmail.com>
2026-10-13 09:44:13 +02:00
Kevin Chan
a8ed548c24 twister: harness: tolerate non-UTF-8 bytes in the output reader
The Script/Pytest/Bsim/Ctest harnesses read the spawned process output
in _output_reader() and decode it as strict UTF-8. A single invalid
byte, which is common on a hardware serial console, raises
UnicodeDecodeError. That kills the reader thread and stops capturing
the rest of the process output for the run.

Decode with errors="replace" so a stray byte no longer aborts output
capture.

Signed-off-by: Kevin Chan <kevin.chan3@infineon.com>
2026-10-13 09:40:34 +02:00
Kevin Chan
6cf789196b twister: fix required application build dir lookup on Windows
When a testsuite uses required_devices/required_applications, twister
locates the companion application's build directory with a regular
expression built from forward slashes ("{platform}/.*/{application}").
On Windows the build_dir is produced with os.path.join(), so it uses
backslashes and the pattern never matches. twister then reports
"Could not find a build dir for required application" even though the
directory exists. The glob that locates a pre-built required
application makes the same forward-slash assumption.

Normalize os.sep to "/" before matching so the lookup works on both
POSIX and Windows.

Signed-off-by: Kevin Chan <kevin.chan3@infineon.com>
2026-10-13 09:40:34 +02:00