Commit graph zephyr/scripts
Author SHA1 Message Date
Benjamin Cabé
0d94fc917d ci: doc-build: install reuse with the custom_properties API
The zephyr.licensing docs extension needs reuse's custom_properties API,
which is not yet in a released reuse. Install it from the reuse-tool repo
as a temporary measure until a new release makes it to PyPi.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-4.8
2026-08-28 06:45:57 -04:00
Benjamin Cabé
794b2ef3f2 scripts: tests: ci: test_test_plan_v2: add reuse ignore tags
The file isn't rely carrying BSD-3-Clause license, it's test data.
Flag as reuse ignore.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-28 06:45:57 -04:00
Krzysztof Chruściński
5e34e0a3b8 twister: runner: Relax platform filter
Expect that string provided in platform argument is part of the
target platform instead of an exact name match. This relaxed setting
allows to handle cases like:
- unify argument for multiple boards with the same SoC
- handle multiple versions of the same board

It also matches handling in the west build command implementation.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-08-27 22:11:34 -04:00
Mayank Chadha
ba6d3b2f03 scripts: west: runners: stm32cubeprogrammer: fix path lookup on macos
The path to STM32_Programmer_CLI inside the STM32CubeProgrammer macOS
app has changed between versions. Remove the architecture
based guess and instead check both subdirectories for existence.
Update the test accordingly.

Link: 21d3ec1106

Link: d8d90c087b

Signed-off-by: Mayank Chadha <mayankchadha1998@gmail.com>
2026-08-27 21:23:43 +01:00
Zhaoxiang Jin
e0cc7d70f1 scripts: build: gen_kobject_list: handle arrays of const kernel objects
gen_kobject_list.py aborts with "'ConstType' object has no attribute
'size'" when a kernel object is an array of const-qualified objects,
such as "const struct device dummy_devs[N]" in the I3C mem_slab driver.

ArrayType.get_kobjects() locates each element at addr + i * mt.size,
where mt is the array's element type. When the element is const, mt is
a ConstType, which delegated has_kobject() and get_kobjects() to its
child type but never exposed size, so accessing mt.size raised
AttributeError and stopped the build under CONFIG_USERSPACE.

Add a size property to ConstType that delegates to the underlying
type, mirroring the existing has_kobject()/get_kobjects() delegation.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2026-08-27 12:05:32 +01:00
Tomasz Moń
bdd9775677 scripts: dts: gen_defines: Avoid percent signs in identifiers
Update regular expression in str2ident to replace percent sign (%)
character when creating identifiers.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2026-08-26 15:15:44 -04:00
Pieter De Gendt
05e17a4c06 scripts: ci: check_compliance: Allow extending the CMake style allow-list
Let downstream projects point the CMAKE_STYLE_MIXED_CASE_FILE
environment variable at an extra mixed-case command allow-list file,
forwarded to cmake_style.py as --mixed-case-file, mirroring the
UNDEF_KCONFIG_OUTSIDE_ALLOWLIST_FILE mechanism.

Assisted-by: Claude Code:claude-fable-5
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2026-08-26 15:53:29 +01:00
Pieter De Gendt
38cca01368 scripts: cmake: style: Load mixed-case commands from allow-list files
Replace the hardcoded MIXED_CASE_COMMANDS set with an allow-list file
shipped next to the script, and add a repeatable --mixed-case-file
argument that appends extra files to it. This gives downstream projects
a way to extend the lowercase-rule exceptions with their own mixed-case
commands.

Assisted-by: Claude Code:claude-fable-5
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2026-08-26 15:53:29 +01:00
Johan Hedberg
81eb5db08f Bluetooth: Host: Remove deprecated CONFIG_BT_FIXED_PASSKEY
CONFIG_BT_FIXED_PASSKEY, bt_passkey_set() and BT_PASSKEY_INVALID were
deprecated in commit 82cfb5a056 ("Bluetooth: Host: Deprecate
BT_FIXED_PASSKEY"), released in Zephyr 4.3, in favour of the app_passkey
callback gated on CONFIG_BT_APP_PASSKEY. Two releases have passed, so
remove them.

The replacement covers what the option did: an application that returns a
constant from bt_conn_auth_cb.app_passkey gets a fixed passkey, and one
that returns BT_PASSKEY_RAND gets a Host generated one, which is what
BT_PASSKEY_INVALID was used to fall back to.

DISPLAY_FIXED() could only ever be true with a fixed passkey configured,
so the four conditions using it reduce to the JUST_WORKS test they were
already OR'd with. Likewise the two branches in get_io_capa() that
upgraded the reported capability when a fixed passkey was set collapse to
the values they already returned otherwise; the CONFIG_BT_APP_PASSKEY
block above them covers that case for the replacement API. Behaviour is
therefore unchanged for anyone not enabling the removed option.

Drop the accompanying build warning and the hardened.csv entry, both of
which existed only to steer users away from the option.

Fixes: #36005

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
Assisted-by: Claude:claude-opus-5
2026-08-26 15:48:41 +01:00
Perry Naseck
cb8b633d62 dts: Add gen defines and bnf for DT_BINDING_COMPAT_*
Add gen defines and bnf for DT_BINDING_COMPAT_*, which allows
for getting a node's compatible string at compile time. Adds
DT_BINDING_COMPAT_TOKEN, DT_BINDING_COMPAT_UPPER_TOKEN, and
DT_BINDING_COMPAT_UNQUOTED.

Assisted-by: Claude:claude-opus-5

Signed-off-by: Perry Naseck <pnaseck@media.mit.edu>
2026-08-25 08:05:11 -07:00
Benjamin Cabé
d8f979b019 scripts: west: spdx: deprecate --init
Nothing needs to call "west spdx --init" any more: a build with
CONFIG_BUILD_OUTPUT_META asks CMake for the file-based API object model
itself, so the build directory no longer has to be prepared before it is
configured.

Warn when it is used and note it in the docs, release notes and
migration guide. The option still works, so existing scripts and CI keep
running until it is removed.

Assisted-by: Claude Code:claude-opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-25 08:59:27 +02:00
Benjamin Cabé
c8c1675e09 cmake: request the CMake file-based API when building an SBOM
"west spdx" reads CMake's file-based API object model -- the codemodel
and toolchains replies -- to work out what went into a build. A file API
query has to exist in the build directory before CMake starts, so it
could not be created from the build system itself. Hence "west spdx
--init": a separate pass, run once per build directory before
configuring, easy to forget and recoverable only by reconfiguring.

CMake 3.27 added cmake_file_api(), which registers a query for the
current invocation and has the reply written at generation time. Zephyr
required CMake 3.20 until the floor was raised to 3.28, so the build can
now ask for its own object model and the pre-configure step goes away.

Tie it to CONFIG_BUILD_OUTPUT_META, which "west spdx" already requires:
it reads the zephyr.meta that option emits and bails without it. Builds
that are not producing an SBOM pay nothing.

This also covers sysbuild, where the query had to be created in each
domain's build directory -- one that does not exist until sysbuild has
configured it. Each domain is an ordinary Zephyr build, so each now
requests its own reply.

Cost, measured on hello_world and an LVGL sample for qemu_x86 with the
same tree and a warm ccache, varying only whether the query is present:
no measurable configure time (-0.02 s and +0.04 s median of 6 runs, both
inside run-to-run spread; CMake's generate phase does not move) and no
change to no-op rebuilds. The reply costs 1.1-1.4 MB of build-directory
disk. Without CONFIG_BUILD_OUTPUT_META no reply is written at all.

Assisted-by: Claude Code:claude-opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-25 08:59:27 +02:00
Alberto Escolar Piedras
11bcb86d8f native_simulator: Get latest from upstream
Align with native_simulator's upstream main
0d3eafc13a7bf37ef146da540986f99356ac48bd

Which includes:
0d3eafc native: hw_timer: split real time pacing from tick logic

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-08-24 14:12:14 -07:00
Pieter De Gendt
97c8c661aa scripts: kconfig: test the length-check exemptions
Cover the quoted-string exemption (single and double quotes) and that
comments and 'help' body text stay subject to the limit, with a macro
in help text still exempt. Keep the '$(...)' case on an unquoted line
so it exercises the macro branch independently of the quote branch.

Assisted-by: Claude Code:claude-opus-4.8
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2026-08-24 18:44:47 +02:00
Pieter De Gendt
ad12f820a8 scripts: kconfig: exempt unsplittable lines from the length check
A long quoted value (e.g. a path) or '$(...)' macro cannot be brought
under the 100-column limit: kconfiglib joins backslash continuations by
raw concatenation, so splitting the value injects the continuation's
leading whitespace into it. Exempt lines containing a quoted string
(single or double) too, not just macros. Comments and 'help' text are
re-wrappable prose and stay subject to the limit (a macro cited in help
text stays exempt, as it still cannot be split).

Assisted-by: Claude Code:claude-opus-4.8
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2026-08-24 18:44:47 +02:00
Etienne Carriere
8bf05cca7b scripts: kconfig: Warn when dt_*_has_prop() is used on a boolean prop
dt_*_has_prop() functions from kconfigfunctions.py always the same
value ("y", aside dt_compat_any_not_has_prop() that always return "n")
when used with a boolean property defined the node DT bindings
since such property is always found whatever it is set to True or False.

Using such functions on boolean properties is not accurate and could
corrupt the target configuration.

When testing a DT boolean property, one should:
- use dt_node_bool_prop() instead of  dt_node_has_prop(),
- use dt_nodelabel_bool_prop() instead of dt_nodelabel_has_prop(),
- use dt_compat_all_has_prop() with valid value parameter,
- use dt_compat_any_has_prop() with valid value parameter,
- not use dt_compat_any_not_has_prop().

This change makes configuration build stage to emit a warning message
upon such a wrong usage of these helper functions.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-08-24 18:43:41 +02:00
Benjamin Cabé
0a22328a73 scripts: gen_relocate_app: drop deprecated pattern expansion
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
2026-08-24 18:43:22 +02:00
Anas Nashif
5b73b60428 ci: backport_issue_check: use pull_request instead of pull_request_target
The backport issue check ran on pull_request_target purely so that it
could be granted pull-requests: write and post a comment telling the
contributor to add a "Fixes #<issue>" line. Nothing else in the job
needs the elevated trigger: it only reads the pull request body and
resolves the referenced issue, which a read-only token can do.

Switch the workflow to pull_request. GitHub only downgrades GITHUB_TOKEN
to read-only for pull requests coming from a fork, so pull requests from
a branch of this repository -- which is where the automated backports
opened by backport.yml come from -- still get a token that can comment.
The workflow now passes the new --comment flag to list_backports.py only
in that case, and for fork pull requests the check reports the same
guidance through an ::error:: annotation and the job summary instead.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-23 17:23:39 -04:00
Etienne Carriere
7a65b76fc0 scripts: dts: Add info on how to test edtlib.py and dtlib.py
Add info in local README.txt on how to run edtlib.py and dtlib.py tests.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-08-22 19:19:29 -04:00
Anas Nashif
6a7a479275 twister: add --console-monitor for a live in-terminal dashboard
On long runs the scrolling console output makes it hard to tell what
twister is actually doing: what is queued, which pipeline stage every
job is in, and which tests already failed and why. Add a
--console-monitor option that replaces the normal output with a live,
top-style full-screen dashboard for the duration of the run.

The monitoring core (twisterlib/runmonitor.py) is transport-free: the
worker processes emit one plain-dict event per pipeline op
start/completion over a multiprocessing.Queue (put_nowait, dropped on
any error, so monitoring can never stall or fail the pipeline), and a
drain thread in the main process folds them into a thread-safe state
model with one row per test instance, initialized from the test plan
so statically filtered instances are visible too. The curses UI
(twisterlib/consolemonitor.py) runs in a thread of the main process
and reads that state in-process; other frontends (e.g. a web view)
can be layered on the same core later.

The dashboard shows overall progress with counters and an ETA, the
in-flight jobs with their current pipeline stage, and a scrollable
instance table with filter tabs. f jumps to the failures view, /
starts an incremental search over instance names and failure reasons,
and arrows or j/k plus Enter open a per-instance detail view: the
pipeline stage timeline, the failing test cases with their reasons,
and scrollable log tails (l switches between the available logs).

While the UI owns the terminal, console log handlers are detached
(everything still lands in twister.log) and restored when it exits;
the workers' single-line progress ticker is skipped; the handlers'
`stty sane` reset after local runs is suppressed and simulator
processes get /dev/null as stdin so nothing can knock the terminal
out of curses mode - the UI also re-asserts its terminal modes on
every poll tick as a backstop. These worker-side accommodations are
keyed to a shared UI-active flag (a module-level multiprocessing
Value inherited by the forked workers - deliberately not an options
attribute, since options travels inside pickled TestInstance objects
through the manager queues where a Value cannot go), so they all
revert the moment the UI exits.

Leaving the dashboard always hands the terminal back cleanly: q
mid-run resumes the normal console output (including the progress
ticker) while the run continues; when the run finishes the dashboard
stays up for inspecting failures and q then writes the reports and
exits as usual; Ctrl-C aborts the run, shuts the dashboard down
without waiting for a keypress, and skips any retry iterations. The
option requires an interactive terminal and curses, and is ignored
with a warning otherwise (e.g. in CI).

Assisted-by: Claude:claude-fable-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-22 19:19:21 -04:00
Benjamin Cabé
ef51e0cb7a scripts: runners: pyocd: drop deprecated PYOCD_DAPARG variable
The pyocd runner no longer reads the PYOCD_DAPARG environment variable
as a fallback for an unset --daparg. Pass --daparg on the command line
instead.

Deprecated in Zephyr 4.2 or earlier.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
2026-08-21 17:49:57 +02:00
Benjamin Cabé
4a2a892567 scripts: west: remove deprecated --skip-rebuild option
Remove the --skip-rebuild option shared by the west commands that invoke
a runner (flash, debug, debugserver, attach, rtt, reset, robot and
simulate), along with its handling in skip_rebuild(). Use --no-rebuild,
the negative half of the --rebuild option, instead.

With --skip-rebuild gone, --rebuild is the only remaining member of its
mutually exclusive group, so the group is dropped and the option is
added directly to the enclosing argument group; help output and
behaviour are unchanged.

Deprecated in Zephyr 4.3.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
2026-08-21 17:49:57 +02:00
Benjamin Cabé
fe12a7df44 scripts: logging: remove deprecated log_parser_uart.py
Remove the UART dictionary log parser shim, which since its deprecation
has only translated its arguments and handed over to live_log_parser.py.
Use live_log_parser.py directly, passing the port and baud rate after a
"serial" sub-command.

The 4.3 migration guide entry now spells the script as plain literal
text, as :zephyr_file: only resolves for files still in the tree.

Deprecated in Zephyr 4.3.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
2026-08-21 17:49:57 +02:00
Benjamin Cabé
9463713ae4 scripts: logging: dictionary: resolve DW_OP_addrx string locations
extract_string_variables() rendered each const-char variable's location
expression to text and matched it against a "(DW_OP_addr: <hex>)" regex.
DWARF 5 expresses a static address as DW_OP_addrx - an index into
.debug_addr - which pyelftools renders as "(<unknown DW_OP_addrx>)", so
the regex missed it and the string was dropped from the dictionary
database. That corrupts %s output in dictionary-based logging.

GCC still emits DW_OP_addr regardless of DWARF version, so GCC builds are
unaffected; Clang emits DW_OP_addrx under DWARF 5, so its builds regress
the moment -gdwarf-4 is dropped, the same way gen_kobject_list did.

Parse the expression's leading opcode directly with DWARFExprParser
instead of scraping its text form: read the inline address for
DW_OP_addr, and resolve the index through DWARFInfo.get_addr() for
DW_OP_addrx. The text form of addrx never carried the address anyway.

Verified with arm-none-eabi Clang -gdwarf-4 and -gdwarf-5: both recover
the same string addresses; before, the v5 build recovered none.

Assisted-by: Claude:opus-4.8
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-20 10:56:47 +02:00
Benjamin Cabé
e89161007e scripts: gen_kobject_list: accept DWARF v5 array subrange bounds
analyze_die_array() read an array's element count from the subrange's
DW_AT_upper_bound / DW_AT_count only when the attribute used a
DW_FORM_dataN form, and skipped the subrange otherwise. DWARF v5 GCC
encodes a constant upper bound as DW_FORM_implicit_const, which was
therefore dropped: the array looked unbounded and a stack array
collapsed to a single element via the STACK_TYPE fallback.

For userspace that is silent corruption. A K_THREAD_STACK_ARRAY_DEFINE
of N stacks registered only its first element as a kernel object, so
threads using the other stacks were denied at the MPU boundary and the
image faulted at boot. kernel.memory_protection.sys_sem crashed on
every GCC target once -gdwarf-4 was dropped; LLVM was unaffected because
it still emits DW_FORM_dataN here.

Accept the constant-class forms - implicit_const and the signed/unsigned
LEB forms alongside dataN - via a small helper, and keep skipping
non-constant forms (an exprloc/block dynamic bound is not a count).

Verified on mps2/an385: the DWARF v5 GCC build of that test found 46
kernel objects (was 44 - the two missing array stacks) and now boots and
passes 14/14 cases.

Assisted-by: Claude:opus-4.8
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-20 10:56:47 +02:00
Benjamin Cabé
14a1ba1ce4 scripts: gen_kobject_list: resolve DW_OP_addrx locations
The variable scan accepted only DW_OP_addr, where the address is
inline in the expression. DWARF v5 added DW_OP_addrx, which carries a
ULEB128 index into .debug_addr instead, and Clang emits it for static
storage. Every kernel object then hit the "unexpected exprloc opcode"
path and was dropped, leaving an empty kobject_prebuilt_hash.gperf and
failing the build outright:

  WARNING: zero kobject found in [...]
  kobject_prebuilt_hash.gperf: No keywords in input file!

GCC does not reach this: it emits DW_OP_addr regardless of -gdwarf-N.
So this is invisible until an LLVM build meets DWARF v5, which is why
it surfaces with the -gdwarf-4 removal rather than before it.

Resolve the index through pyelftools' DWARFInfo.get_addr(). The
DW_OP_plus_uconst that may follow is handled as before, the ULEB128
decoder already returning the offset just past the operand.

Verified with arm-none-eabi Clang -gdwarf-4 and -gdwarf-5: both now
resolve the same addresses for extern and static objects.

Assisted-by: Claude:opus-4.8
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-20 10:56:47 +02:00
Benjamin Cabé
0fc04772a0 scripts: gen_kobject_list: fix file resolution in debug_die()
Two defects in the same three lines:

- The directory table was indexed as includes[dir_index - 1] with no
  case for dir_index == 0. Up to DWARF v4 index 0 means "the
  compilation directory" and is not in the table, so this wraps to
  includes[-1] - the last unrelated directory - or raises IndexError
  outright on the empty table GCC commonly emits. debug_die() therefore
  throws today on ordinary GCC output.

- The file table was assumed 1-based. DWARF v5 made it 0-based, so
  every index is off by one there.

Both only affect debug/warning text, not generated output, which is why
this has gone unnoticed. Branch on the line program version and handle
directory index 0 explicitly.

Assisted-by: Claude:opus-4.8
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-20 10:56:47 +02:00
Benjamin Cabé
f989efaba8 scripts: footprint: size_report: honour the DWARF line-program version
get_die_filename() resolved DW_AT_decl_file against the pre-v5 layout
unconditionally: a 1-based file table, with directory index 0 meaning
"the compilation directory" rather than a table entry.

DWARF v5 renumbered both tables to be 0-based and made directory 0 an
explicit entry holding the compilation directory. Against a v5 line
program every index is therefore off by one and each symbol is
attributed to the neighbouring source file - main() gets reported as
living in the header it includes. Nothing raises; the ROM/RAM report is
simply wrong.

Zephyr does not hit this today only because -gdwarf-4 is forced. Note
that GCC is insulated twice over: it emits .loc directives and leaves
the line table to GAS, which still defaults to v3 regardless of
-gdwarf-N. Clang uses its integrated assembler and emits v5 line tables
directly, so LLVM builds regress the moment the forced flag is dropped.

Branch on the line program's own header version.

Verified with arm-none-eabi Clang and Zephyr SDK arm-zephyr-eabi GCC
14.3 across -gdwarf-4, -gdwarf-5 and -Wa,--gdwarf-5 (line programs
v3/v4/v5): all five now attribute identically and correctly.

Assisted-by: Claude:opus-4.8
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-20 10:56:47 +02:00
Nicolas Pitre
6484418a3a kernel: move the sleep API declarations to their own header
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>
2026-08-20 08:52:31 +02:00
Benjamin Cabé
281b5743d1 samples: usb: add i2c-tiny-usb bridge sample
Add a sample implementing the vendor request protocol of the
I2C-Tiny-USB project on top of the new USB device stack and the I2C
driver API. It makes a Zephyr board enumerate as a USB to I2C adapter
that works out of the box with the Linux i2c-tiny-usb bus driver, so
the I2C bus of the board can be accessed from the host with the
i2c-dev interface and the usual i2c-tools.

Commands addressed to the interface are handled by a minimal USB
function with a vendor specific interface without endpoints, while the
I2C transfer commands, which carry the target address in wIndex, are
handled with device vendor request nodes. Messages belonging to the
same I2C transaction are collected and executed in a single I2C
transfer to preserve repeated start conditions.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-19 18:43:21 -04:00
Alberto Escolar Piedras
46dc222a4d native_simulator: Get latest from upstream
Align with native_simulator's upstream main
3f81511a813ca38e9afac430f15a19ee53c9f407

Which includes:
3f81511 native: timer_model: Improvements
bc98cfe nsi_errno: Fix typo in comment
8961d7a nsi_scheduler: Terminate gracefully at end of time if no end of
        time set

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-08-19 18:41:48 -04:00
Benjamin Cabé
f77385c227 scripts: zspdx: walker: attribute nested module sources correctly
find_owning_component() returned the application component as soon as a
source file lived under the application source directory, before zephyr
and module components were considered. A module nested under the
application (or under the zephyr tree) was therefore mis-attributed to
the app package instead of its own module package.

Fold the app component into the same deepest-base_dir selection already
used for the zephyr and module components, so each file is assigned to
its most specific (true) owner regardless of check order.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:sonnet-5
2026-08-19 18:38:15 -04:00
Benjamin Cabé
8a9e6d78a4 scripts: zspdx: scanner: drop redundant in-file SPDX tag scanner
get_expression_data() reimplemented, with a cruder regex, what REUSE's
own reuse_info_of() already does: parse the in-file
SPDX-License-Identifier tag and apply precedence against REUSE.toml.

Drop get_expression_data(), parse_line_for_expression(), and the now
unused num_lines_scanned option; rely solely on get_reuse_info().

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:sonnet-5
2026-08-19 18:38:15 -04:00
Benjamin Cabé
bc14cfbb1b scripts: zspdx: scanner: load REUSE.toml, surface its licenses
get_copyright_info() built its REUSE Project with the bare Project()
constructor, which never loads REUSE.toml - only
Project.from_directory() does, so bulk licensing data was never read.

Build one Project.from_directory(component.base_dir) per component.
Rename get_copyright_info() to get_reuse_info(), also returning
license expressions used in scan_sbom_graph() when a file has no
in-file SPDX-License-Identifier tag, and quiet the reuse library's
logger to avoid noise from newly-surfaced compliance warnings.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:sonnet-5
2026-08-19 18:38:15 -04:00
Daniel Leung
60d0a532ae scripts: process_gperf: update allowed version
Update the allowed upper version limit to 3.3. This removes
the warning about outdated gperf version.

Skimming through the changelog from v3.1 to v3.3 and most of
the changes are doc and tool related.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2026-08-19 17:11:29 +01:00
Alberto Escolar Piedras
b3a11d8025 twister: script harness: Allow providing globs in tests_scripts
Let users provide their own globs.
When they do, let's just use the provided glob as is.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-08-19 17:11:15 +01:00
Alberto Escolar Piedras
e28b81892a twister: script harness: Also find scripts in subdirectories
When a directory is provided, find scripts in directories and
sub-directories.
This is what users expect.

Note that now we also name the tests not just based on the "basename" of
the file, but on the relative path to the tests.yaml so we ensure we have
unique tests names.

We also sort the globing output.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-08-19 17:11:15 +01:00
Alberto Escolar Piedras
0dc486b6db twister: script harness: Handle gracefully not finding any script
We may also not find any script at all (say the folder is empty,
or there is no tests_scripts folder).
Let's handle it gracefully too, by printing an appropriate
message instead of pointing at the build log.

This fixes more cases than what was covered by
60643b7b05

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-08-19 17:11:15 +01:00
Muhammad Waleed Badar
0791e4c24e dts: add devicetree support for the dma-ranges property
Zephyr's devicetree tooling parses and generates macros
for the ranges property but has no equivalent support for
dma-ranges, even though both are defined the same way by
the Devicetree Specification (§2.3.9) and edtlib.py already
has the machinery to parse address-translation triplets.

This adds the same pipeline that already exists for ranges.
edtlib.py now parses dma-ranges into Node. dma_ranges using
the same cell-based translation logic as Node via a new
_init_dma_ranges() method.

gen_defines.py emits DT_N_..._DMA_RANGES_* macros for each node
with a dma-ranges property through a new write_dma_ranges() function.

devicetree.h gains the DT_DMA_RANGES_* public API, including HAS_IDX,
CHILD_BUS_ADDRESS_BY_IDX, PARENT_BUS_ADDRESS_BY_IDX, LENGTH_BY_IDX,
NUM_DMA_RANGE, and FOREACH_DMA_RANGE. base.yaml documents the dma-ranges
property per DT spec §2.3.9.

Assisted-by: Claude:claude-sonnet-5
Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
2026-08-19 17:09:21 +01:00
Tim Pambor
dbd6698fc0 scripts: west: build: retain quotes for SB_CONFIG_ in extra_args
The extra_args parsing only treated arguments starting with "CONFIG_"
as config options whose surrounding quotes must be preserved.
Sysbuild config options prefixed with "SB_CONFIG_" were classified as
non-config candidates, which stripped their quotes and could mangle
values.

Extend the prefix check to also match "SB_CONFIG_" so sysbuild config
options are handled identically to regular config options

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-08-19 11:17:53 +02:00
Loek Le Blansch
e417dffd80 scripts/build: allow whitespace between function name and parenthesis
This commit changes the syscall regex to allow whitespace between a
syscall's function name and the opening parenthesis of the argument list.

Signed-off-by: Loek Le Blansch <loek.le-blansch.pv@renesas.com>
2026-08-18 17:20:51 -04:00
Anas Nashif
ac4666dac2 twister: detect faults reported after a test passes
Harness.process_test() failed a run on a kernel fatal error only when
two conditions held: the console line had to be exactly equal to
"ZEPHYR FATAL ERROR", and the fault had to be seen before the test
printed "PROJECT EXECUTION SUCCESSFUL". Neither holds in practice.

z_fatal_error() prints ">>> ZEPHYR FATAL ERROR %d: %s on CPU %d",
normally through LOG_ERR and therefore behind a timestamp and a module
prefix, so no console line ever compares equal to the marker. The
Console harness has always matched it as a substring and worked; the
Test and Ztest harnesses rely on process_test() alone, so for them
fault detection never triggered at all. The existing unit test passed
the bare marker as the whole line, which is why this went unnoticed.

Match the marker as a substring, move the check ahead of the RUN_PASSED
branch, and withdraw a PASS that was recorded earlier in the output.
Tests that fault on purpose are unaffected: they opt out with
ignore_faults, which clears fail_on_fault. Drop the now duplicated
check in Console.handle(), which process_test() covers.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-17 16:30:10 -04:00
Jukka Rissanen
953835d93a net: packet: Add support for multicast membership add/drop
A packet socket can be used to add or drop a multicast group
membership in L2 level. This means that application can ask
the network device to start to listen extra multicast L2 addresses.
This uses PACKET_ADD_MEMBERSHIP and PACKET_DROP_MEMBERSHIP
socket options which can be set using setsockopt() API.

As the same link layer address can be needed by several users at once,
the Ethernet L2 keeps track of the multicast addresses that an
interface listens to and tells the driver to change its receive filter
only when a group is joined by its first user or left by its last one.
The IP level joins, the packet socket memberships and the filters that
an application sets with net_eth_mac_filter() all share this count.
Previously they were given to the driver separately, so leaving one
group could stop the device from listening to another one that needs
the same link layer address. That happens easily as IPv4 multicast
addresses map 32:1 to link layer addresses.

The membership change is given straight to net_eth_mcast_addr_add() and
net_eth_mcast_addr_rm(), so that setsockopt() can tell the application
when the interface cannot serve the group. There is no interface level
callback list in between, as a callback cannot report back that the
address did not fit.

The addresses can be read back with net_eth_mcast_addr_foreach(), so a
driver may also treat ETHERNET_CONFIG_TYPE_FILTER as a hint that the
set of addresses changed and reprogram its filter from scratch. That
suits devices that filter by a hash of the address.

How many addresses an interface can track is the sum of what the
enabled subsystems ask for with their own
NET_L2_ETHERNET_MCAST_FILTER_ADD_COUNT_ options, summed at build time
the same way as the system heap size is. The new
NET_L2_ETHERNET_MCAST_FILTER_COUNT option raises the result if an
application needs more addresses than the subsystems asked for. A
group that does not fit is not joined at all, as programming it
without tracking it would break the drivers that read the addresses
back and the group would be lost as soon as another user of the same
address left.

A device that cannot filter passes the group up anyway, so the group is
joined and tracked also when the driver has no receive filter. The
address is then ready for a filter that the device programs later, and
setsockopt() does not fail on a device that receives the group without
being told to.

A VLAN interface has no receive filter of its own, so a group joined
on one is programmed to the Ethernet interface it is attached to.

Note that a multicast destination address given to net_eth_mac_filter()
is now counted like any other user of the group, so each such filter
that an application sets must also be unset by it, and unsetting one
that was never set fails with -ENOENT.

Assisted-by: Claude:Opus-5
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-08-17 16:26:38 -04:00
William Jeffreys
181bd4b54b scripts: runners: probe-rs: Rename 'attach' RTT command to 'rtt'
RTT support was previously exposed via `west attach` (commit 3c7d9732),
but attach is meant for debugging without reflashing, not RTT. This
renames the relevant runner methods so `west rtt` is used instead,
avoiding confusion. Note this breaks the previous (incorrect) `west
attach` invocation for RTT.

Signed-off-by: William Jeffreys <wjeffreys96@gmail.com>
2026-08-17 10:26:03 +02:00
Anas Nashif
f73914b99f ci: annotate coding guideline violations on the changed lines
The job reported every violation as a single annotation attached to
output.txt. That file does not exist in the tree, so GitHub could only
show it as a job level annotation and the actual findings were buried in
the workflow log.

Give guideline_check.py an --annotate option, following the convention
check_compliance.py already uses, that emits one workflow command per
violation with the real path and line. GitHub then renders them on the
changed lines in the pull request. The rule number is lifted out of the
message into the annotation title so the finding is identifiable without
expanding it.

GitHub keeps only the first 10 annotations of a level per step, so cap
them there and summarise the rest in a single warning. output.txt still
lists every violation and remains what fails the job.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-15 08:12:32 -04:00
Anas Nashif
e6b837e656 scripts: coccinelle: check for unnamed function parameters
MISRA C:2012 Rule 8.2 requires every parameter in a function type to be
named, including the parameters of function pointer parameters. Nothing
in CI caught that, so violations kept being introduced.

Add a rule that walks the parameter list of every function declaration
and definition and reports any parameter that carries a type but no
identifier, recursing into the parameter lists of function pointer
parameters. Macro invocations parse as function declarations, so
identifiers without a lower case letter are skipped, as is the text of
the preprocessor directives that a conditionally compiled parameter list
leaves in the parameter tokens.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-15 08:12:32 -04:00
Anas Nashif
54da97077c scripts: ci: match coccinelle violations in any path
The pattern used to parse the coccinelle output only accepted letters,
digits, underscores and slashes in the file name, so a violation
reported against a path containing anything else was silently dropped.
Zephyr has plenty of those: include/zephyr/sys/libc-hooks.h and every
other hyphenated file name never produced a finding.

Accept anything up to the colon that separates the path from the line
number instead, and require at least one digit for that line number.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-15 08:12:32 -04:00
Gustav Holmberg
18e4be1b71 runners: iar: create complete launch.json file + other minor fixes
Generate complete version of debug launch file and use better defaults
(Enable zephyr plugin, use correct vector table symbol and use reset
strategy with bootloader when available. Also add launch file path to
CMakeCache to automatically load the launch file in Embedded Workbench.

Signed-off-by: Gustav Holmberg <gustav.holmberg@qt.io>
2026-08-14 16:11:57 -04:00
Benjamin Cabé
cd24209e5b scripts: zspdx: add software_artifactSize to SBOM
SPDX 3.1 introduced a new field for the size of software artifacts.
Capture file sizes in the SBOM model at scan time and emit them when
serializing SPDX 3.1 output.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-12 19:27:00 -04:00
Benjamin Cabé
cce85fd3e2 scripts: zspdx: add SPDX 3.1 support
Spec is still WIP but adding support for it will be useful to work on
adding more features to the SBOM, e.g. requirements or tests.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-12 19:27:00 -04:00