Commit graph zephyr/scripts
Author SHA1 Message Date
Michał Bogdziewicz
d456ef71a5 runners: probe-rs: migrate to standard --file/--file-type interface
The runner always selected elf_file, ignoring hex_file and bin_file from
RunnerConfig. This broke MCUBoot support since the bootloader
requires hex/bin format and the build system sets hex_file to
signed images (zephyr.signed.hex).

Fixes commit 3c7d973 ("west: runners: probe-rs: Add enhanced
functionality")

Signed-off-by: Michał Bogdziewicz <michal@bogdziewicz.xyz>
2026-03-23 08:58:33 -04:00
Daniel Leung
f225fd06e9 twister: add support for whisper simulator
This adds support for running with whisper simulator under
twister.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2026-03-23 08:56:34 -04:00
Nancy Sangani
752cd19e04 scripts: west: commands: completion: fish: update completions
Add Fish shell completion entries that are already present in the
Bash completion script but were missing from the Fish one:

- Add __zephyr_west_complete_shield for cached shield completion
- Add --shield argument completion to west build
- Add completion entries for the west shields subcommand
- Add completion entries for the west twister subcommand

Fixes #73128

Signed-off-by: Nancy Sangani <9d.24.nancy.sangani@gmail.com>
2026-03-23 10:25:04 +01:00
Joel Holdsworth
09cd8302ef scripts: twister: Add OpenRISC as a supported test platform
Adds the openrisc CPU architecture to the twister platform definitions.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
2026-03-21 07:50:57 -05:00
Joel Holdsworth
01d4ea6d2b scripts: logging: Add openrisc to ARCHS
The OpenRISC CPU architecture is signified by the CONFIG_OPENRISC Kconfig
option. This patch adds this information to the log database ARCHS table.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
2026-03-21 07:50:57 -05:00
Ilia Kharin
15c27c378b west: rtt: jlink: Add ability to select RTT channel
When the `west rtt --runner=jlink` command is executed, the client is
attached to the channel number 0 by default.. However, if several
subsystems are configured to use different RTT channels, e.g. shell to
the channel 0 and logging to the channel 1, it's currently impossible
to attach to any channel other than 0.

The `west rtt` command for the `jlink` runner is extended by a new
argument called `--rtt-channel=<channel>` where `<channel>` is an
integer, e.g. 0, 1, etc. Usage example:

    west rtt --runner=jlink --rtt-channel=1

When the channel is specified, once the client is connected, it sends the
following configuration sequence:

    $$SEGGER_TELNET_ConfigStr=RTTCh;<channel>$$

This configuration sequence instructs the server to send data associated
only to the given channel. This string must be send within 100 ms after
establishing a connection, otherwise it would be ignored.

The following is an example of a configuration where shell uses channel 0
and logging - channel 1:

    CONFIG_SHELL=y
    CONFIG_SHELL_BACKEND_RTT=y
    CONFIG_SHELL_BACKEND_RTT_BUFFER=0
    CONFIG_SHELL_BACKEND_SERIAL=n
    CONFIG_SHELL_LOG_BACKEND=n

    CONFIG_LOG=y
    CONFIG_LOG_BACKEND_RTT=y
    CONFIG_LOG_BACKEND_RTT_BUFFER=1
    CONFIG_LOG_BACKEND_UART=n

Signed-off-by: Ilia Kharin <akscram@gmail.com>
2026-03-20 12:36:16 -05:00
Mathieu Choplain
aea7120dab scripts: kconfig: add function to obtain highest IRQn on a controller
Add a custom Kconfig preprocessor option to obtain the highest IRQn on a
controller. This can be useful to compute CONFIG_NUM_IRQS automatically at
build time.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-03-20 12:34:28 -05:00
Josuah Demangeon
ca3991d150 west: blobs: support fallback URLs
Allow fallback URLs to select a different back-end.
The "url:" field can now take a list of URLs so that if an
URL fails, the next one can be fetched (i.e. a remote host is down).

Error handling is refactored to let blobs.py call os.exit(), with a
new ZephyrBlobException used for the purpose of catching blob-fetching
related errors, and still allow i.e. KeyboardInterrupt to be raised.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2026-03-20 18:19:06 +09:00
Pieter De Gendt
3bcf145bac scripts: requirements: Generate actions dependencies
Run the uv command to update requirements-actions.txt.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2026-03-20 18:16:57 +09:00
Kyle Bonnici
eecf59716c dts: address dtslib unambiguous path matching
The spec makes it clear that node address can be omitted from node path
if not unambiguous see 2.2.3. Path Names

> A unit address may be omitted if the full path to the node is
unambiguous.

e.g.
````
/ {
foo@10 {};
}
```

both paths -> /foo and /foo@10 should work.

Signed-off-by: Kyle Bonnici <kylebonnici@hotmail.com>
2026-03-20 07:11:12 +01:00
Kyle Bonnici
82a84d628c dts: address dtslib address case sensitivity
IMO the spec is clear about the case insensitivity. The node address
must be match the reg value see 2.2.1.1. Node Name Requirements

> The unit-address must match the first address specified in the reg
property of the node.

reg property is a prop-encoded array and by definition.
reg = <0xA> or reg = <0xa> are the same. hence Both foo@a and foo@A
are the same.

Signed-off-by: Kyle Bonnici <kylebonnici@hotmail.com>
2026-03-20 07:11:12 +01:00
dependabot[bot]
b990e62c93 build(deps): bump pyasn1 from 0.6.2 to 0.6.3 in /scripts
Bumps [pyasn1](https://github.com/pyasn1/pyasn1) from 0.6.2 to 0.6.3.
- [Release notes](https://github.com/pyasn1/pyasn1/releases)
- [Changelog](https://github.com/pyasn1/pyasn1/blob/main/CHANGES.rst)
- [Commits](https://github.com/pyasn1/pyasn1/compare/v0.6.2...v0.6.3)

---
updated-dependencies:
- dependency-name: pyasn1
  dependency-version: 0.6.3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-19 17:12:19 -05:00
Dmitrii Sharshakov
f2dd01fd84 soc: raspberrypi: rp2350: add west sign for secure boot
Wrap the picotool sign command (requires recent picotool) to build
signed ELF files (which can be later converted to UF2 as well).

The resulting files boot, yet this has not been tested with actual
Secure Boot yet.

Signed-off-by: Dmitrii Sharshakov <d3dx12.xx@gmail.com>
2026-03-19 17:06:17 -05:00
Dmitrii Sharshakov
e19a8ff6b6 west: sign: abstract out common operations
Share code for locating tools and Zephyr binaries.

Signed-off-by: Dmitrii Sharshakov <d3dx12.xx@gmail.com>
2026-03-19 17:06:17 -05:00
Jjateen Gundesha
7386141720 scripts: twister: fix monitor_serial writing handler.log in binary mode
- monitor_serial() opens handler.log in binary mode (\"wb\") and writes
re-encoded bytes. When the runner (e.g. linkserver for frdm-mcxn947)
produces serial output that is not cleanly decodable as UTF-8, the
decode('utf-8', 'ignore') silently drops bytes and the resulting
handler.log is unreadable.

- Fix by opening handler.log in text mode with explicit UTF-8 encoding,
consistent with BinaryHandler.handle_serial() which uses open(\"w\").
Change the decode error handler from 'ignore' to 'replace' so
corruption becomes visible as replacement characters rather than
silently dropped bytes.

Signed-off-by: Jjateen Gundesha <jjateen97@gmail.com>
2026-03-19 14:53:58 -05:00
Nils Schlegelmilch
78ba018b85 scripts: west_commands: zspdx: add zephyr to modules-deps
Add Zephyr itself, with its CPE and PURL, to the modules-deps.spdx file, to
have one accurate SBoM for vulnerability scanning. Also add DEPENDENCY_OF
relationships to be able to build up a dependency-graph with the
modules-deps.spdx SBoM

Signed-off-by: Nils Schlegelmilch <n.schlegelmilch@vega.com>
Co-authored-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-03-19 17:03:15 +01:00
Fin Maaß
41ac62b79a dts: allow refering childs with phy-handle
According to the DT spec the 'phy-handle' phandle prop
is required, when a phy is used. As this phy could be
a child, we have to filter it out to not get a cycle in the graph.

This allows the phy to be a child of the eternet controller,
when using the  'phy-handle' dt prop.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-03-19 11:37:05 +00:00
Sylvio Alves
d8215fe289 cmake: remove deprecated espressif toolchain variant
The espressif toolchain variant (ZEPHYR_TOOLCHAIN_VARIANT=espressif)
has not been used for years. Espressif targets are now built using the
Zephyr SDK, which bundles the required Xtensa and RISC-V toolchains.

Remove the cmake/toolchain/espressif/ directory containing generic.cmake,
target.cmake, and Kconfig files that implemented this variant. Also
clean up references in the coredump xtensa gdb stubs, removing the
ESPRESSIF toolchain enum value and related handling code.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-03-18 15:25:03 -05:00
Grzegorz Chwierut
86a1c954a2 tests: twister: Align tests with hardware reservation changes
Update unit tests after moving hardware reservation logic from
Handler class to HardwareMap. Relocate and rename tests to match
the new module structure and API changes.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2026-03-18 15:19:30 -05:00
Grzegorz Chwierut
2eb3bb9588 twister: move hardware reservation to runner context manager
Hardware reservation logic moved from Handler class to ProjectBuilder
runner using context manager approach. When NoDeviceAvailableException
is raised due to no free devices, the task is re-queued for later
processing instead of blocking the execution pipeline.

The reserve_hardware() context manager handles device reservation,
yields execution control only when hardware is available, and ensures
proper cleanup in the finally block.

All DUT management logic is now consolidated in HardwareMap class,
removing DUT references from Handler classes. This improves code
maintainability by centralizing responsibilities and eliminating
shared ownership of hardware resources between modules.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2026-03-18 15:19:30 -05:00
Bjarki Arge Andreasen
9bfe7ca1f5 scripts: dts: python-devicetree: extend special casing to io-channels
Extend the special casing of specifer space to include io-channels,
making the implementation a bit more easily scalable for the
future as well. This allows defining io-channels like gpios,
prepending a name like foo-io-channels, which is useful when
multiple groups of io-channels need to be defined for a node:

  foo {
          bar-io-channels = <&baz 0>, <&baz 1>;
          qiz-io-channels = <&baz 2>, <&baz 3>;
  };

This is useful for defining channels to be read in parralel
sequences.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2026-03-18 15:16:49 -05:00
Sylvio Alves
e2f6e190cb twister: increase ESP32 reset pulse duration
Increase the reset pulse from 10ms to 100ms to ensure reliable
boot across all Espressif SoCs. Shorter pulses may cause the UART
to miss early bootloader output, leading to false-positive test
failures.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-03-18 08:45:23 -05:00
Jamie McCrae
ba68dd026f scripts: dts: gen_defines: Add support for zephyr,mapped-partitions
Adds support for outputting partition information on this new
compatible, to match fixed-partitions

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-03-17 18:24:52 -04:00
Jordan Yates
e9e06e4224 scripts: completion: bash: completion for west rtt
Add completion handling for `west rtt`, which is the same as the other
runner based commands.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2026-03-17 18:19:47 -04:00
Stephanos Ioannidis
935a5283f1 scripts: tests: twister_blackbox: Update Zephyr SDK toolchain name
This commit updates the Twister Black Box tests to expect the enhanced
toolchain variant names (i.e. `host/gnu` and `zephyr/gnu`).

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2026-03-17 15:43:52 -04:00
Stephanos Ioannidis
109099c962 scripts: twisterlib: Update Zephyr SDK gcov path
Update the gcov executable path for Zephyr SDK 1.0.0.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2026-03-17 15:43:52 -04:00
Anas Nashif
ea41428980 twister: tests: adapt for new zephyr sdk 1.0
Fix toolchain detection which now has a compiler part.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-03-17 15:43:52 -04:00
Stephanos Ioannidis
c2e6d5861b scripts: ci: errno: Check errorno against picolibc
Zephyr SDK 1.0.0 has dropped newlib support and made picolibc the default
libc.

This commit updates the errno check script to check minimal libc error
numbers against the picolibc error numbers.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2026-03-17 15:43:52 -04:00
Anas Nashif
3bf6c859ef twister: support new toolchain variant syntax
support new syntax involving compiler and toolchains with multiple
compilers, i.e. zephyr/gnu

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2026-03-17 15:43:52 -04:00
Stephanos Ioannidis
f989ab93de scripts: west_commands: sdk: Rename --toolchains arg to --gnu-toolchains
This commit renames the `--toolchains` and `--no-toolchains` arguments,
which control the SDK GNU toolchain installation, to `--gnu-toolchains` and
`--no-gnu-toolchains` to avoid any confusion with the SDK LLVM toolchain.

The old `--toolchains` and `--no-toolchains` arguments remain supported
with a deprecation warning message.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2026-03-17 15:43:21 -04:00
Stephanos Ioannidis
09b9554a06 scripts: west_commands: sdk: Support Zephyr SDK 1.0.0
This commit updates the west sdk command to support the Zephyr SDK 1.0.0
release.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2026-03-17 15:43:21 -04:00
Lukasz Fundakowski
8168f74916 twister: Remove DisablePyTestCollectionMixin and related tests
Simplified the code by removing useless class.

Signed-off-by: Lukasz Fundakowski <lukasz.fundakowski@nordicsemi.no>
2026-03-16 09:06:24 +01:00
Loek Le Blansch
9ef766de8a revert "build: support newlines in syscall decls"
This reverts commit 1993ea019b because the
`parse_syscalls.py` script has been modified to not output whitespace
characters other than spaces in the generated JSON file.

Signed-off-by: Loek Le Blansch <loek.le-blansch.pv@renesas.com>
2026-03-16 07:16:13 +01:00
Loek Le Blansch
d3bb91eac5 scripts/build: flatten whitespace in parse_syscalls.py
Syscall regex matches may include whitespace characters other than space
(i.e. `\n` or `\t`), which causes `gen_syscalls.py` to fail. This mainly
affects long system call signatures wrapped onto multiple lines (e.g. by
code formatter). This change replaces all successive whitespace in the
regex match groups with a single space.

Signed-off-by: Loek Le Blansch <loek.le-blansch.pv@renesas.com>
2026-03-16 07:16:13 +01:00
Thorsten Klein
1c0eb01816 scripts: west_commands: runners: jlink: support --pre-script-cmd
Allow passing custom J-Link commands to the jlink runner via
--pre-script-cmd argument. The argument can be given multiple times. The
commands are prepended to runner.jlink in the given order.

Signed-off-by: Thorsten Klein <thorsten.klein@bshg.com>
2026-03-13 14:44:14 +01:00
Jordan Yates
5539556415 scripts: west_commands: completion: use --all-targets
Update completion scripts to use `west boards --all-targets` to obtain
the list of targets, instead of using shell black magic to perform
string parsing and modification. As a result, all shells get board
revision support.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2026-03-13 07:12:41 +01:00
Jordan Yates
4bfb5c7923 scripts: west_commands: completion: add --all-targets
Add completion information for the new `west boards` argument,
`--all-targets`.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2026-03-13 07:12:41 +01:00
Jordan Yates
d3897b5185 scripts: west_commands: boards: add --all-targets
Add an option to `west boards` that automatically outputs all valid
board targets as a newline separated list without requiring any post
processing.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2026-03-13 07:12:41 +01:00
Marc Herbert
b001dee329 scripts: empty unused .help duplicates in west extensions
Stop requesting west extension authors to "keep in sync" an unused .help
duplicate. Empty such duplicates from existing extensions. They cannot
be `None` yet because current west versions unfortunately require them.

Since the beginning of west extensions (2019 commit d3bb3cfd7a)
extension authors have been requested to provide not just a "help" field
in west-commands.yml, but also a duplicate in their WestCommmand
constructor than they should carefully "keep in sync".
While doing some unrelated extension work, I discovered by chance
that this duplicate has never been used. See detailed analysis in
https://github.com/zephyrproject-rtos/west/issues/927, shorter analysis
in https://github.com/zephyrproject-rtos/west/pull/933 and smoking gun
in the "TODO" comment added by west commit
0d39b6b77a

Signed-off-by: Marc Herbert <Marc.Herbert@gmail.com>
2026-03-12 14:05:03 -05:00
Ilia Kharin
da7d31eda1 west: rtt: Retry when socket connection fails with invalid argument
On macOS, calling socket.connect() may fail with
OSError(22, 'Invalid argument') if it occurs at a certain point after
JLinkGDBServer has started. This leaves the socket in an unrecoverable
state, meaning that all subsequent connection attempts using the same
socket fail with the same error.

The fix is to close the socket on known errors, wait, create a new
socket and try to connect again.

Signed-off-by: Ilia Kharin <akscram@gmail.com>
2026-03-12 14:04:13 -05:00
Martí Bolívar
b7ad704311 scripts: check_compliance: verify DT binding file names
Add a compliance check to make sure that the rules in
doc/build/dts/bindings-upstream.rst (section "File names") are
followed from now on.

Signed-off-by: Martí Bolívar <marti.bolivar@oss.qualcomm.com>
2026-03-12 12:07:57 -04:00
Martí Bolívar
c4b9507680 scripts: check_compliance: cosmetic DT bindings prep work
No functional changes expected; just prep work for extending these
checks.

Signed-off-by: Martí Bolívar <marti.bolivar@oss.qualcomm.com>
2026-03-12 12:07:57 -04:00
Maksim Salau
363336b999 scripts: gen_cfb_font_header.py: Improve PNG support
The commit allows matrix arrangement of glyphs in a PNG file.

Signed-off-by: Maksim Salau <maksim.salau@gmail.com>
2026-03-12 09:18:39 -05:00
Yongxu Wang
edfa8d55ac scripts: gen_device_deps: Sort supported devices by DT dependency ordinal
When generating device dependency arrays, the supported devices list
is currently sorted by device handle. This can cause child devices to
be processed before their parent devices when a power domain resumes,
leading to hardware access errors.

This fix changes the sorting key for supported devices from device
handle to dependency ordinal, ensuring that parent devices are always
processed before their children during power domain operations.

The sorting is performed at build time, so there is no runtime
overhead.

Signed-off-by: Yongxu Wang <yongxu.wang@nxp.com>
2026-03-11 23:18:03 -04:00
Nicolas Pitre
1db0458480 cmake: add zephyr_constants_library() for build-time constants
Introduce a reusable CMake function that creates an OBJECT library
from a C source file containing GEN_ABSOLUTE_SYM() declarations and
generates a header file from the resulting symbols.  This encapsulates
the boilerplate needed for the offsets-style pattern: OBJECT library
creation, LTO prohibition, gen_offset_header.py invocation, and
dependency registration.

Convert the existing offsets.h generation to use this new function.

The zephyr_generated_headers target is moved earlier in CMakeLists.txt
so that subsystem CMakeLists.txt files can register generated headers
via zephyr_constants_library().

Also update gen_offset_header.py to derive the include guard from the
output filename instead of hardcoding __GEN_OFFSETS_H__, and remove the
unused input_name parameter.  This allows multiple generated headers to
coexist with distinct include guards.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2026-03-11 20:52:01 -04:00
James Bennion-Pedley
18ba7b4d6e runners: wch: add wchisp and wlink runner options
Adds wlink and wchisp as optional runners for WCH boards

Signed-off-by: James Bennion-Pedley <james@bojit.org>
2026-03-11 20:51:23 -04:00
Mark Holden
302f978bb2 debug: coredump: arm: add callee-saved offset for thread debugging
Extend the ARM Cortex-M coredump arch block to version 3 with metadata
that provides the offset to the callee_saved struct within k_thread.
This enables the coredump GDB stub to accurately retrieve callee-saved
registers (r4-r11) for non-faulting threads during multi-thread
debugging.

Signed-off-by: Mark Holden <mholden@meta.com>
2026-03-11 17:56:17 +00:00
Stephanos Ioannidis
c279bedaa4 scripts: gen_image_info: Skip PT_GNU_STACK segment
When `-z nostackexec` or `-z stackexec` option is specified, GNU ld adds a
segment of type `PT_GNU_STACK` with zero VMA/LMA and size to the output ELF
file.

Since the sole purpose of `PT_GNU_STACK` segment is to mark whether the
stack should be executable and it has no loadable details, this commit
updates the gen_image_info script to omit it from the image information
header file.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2026-03-11 17:51:42 +00:00
Dhanoo Surasarang
36e26fca3a scripts: runners: nrf: Use ERASE_NONE for nrf71 family
Apply the same ERASE_NONE default as nRF54L.

Signed-off-by: Dhanoo Surasarang <dhanoo.surasarang@nordicsemi.no>
2026-03-11 17:49:34 +00:00
Georgios Vasilakis
ee6fda0311 scripts: west: nrf_common: Provision slot invalidation json
The nRF54L series devices require to reserve 2 KMU slots which are
filled with random data used for invalidating the Protected RAM.
Until now the provisioning of these slots happends in firmware which
costs in both volatile and non volatile memory.

Instead of doing this nrfutil recently added the funcionality to
provision these slots using a .json file which means that everything
can be handled by the build system now.

This is preparation work, that is needed before the full integration
arrives. The change checks if a json file with the name:
"prot_ram_inv_slots.json" exists and if it does it invokes nrfutil
with the provisioning command.

Signed-off-by: Georgios Vasilakis <georgios.vasilakis@nordicsemi.no>
2026-03-10 17:24:21 +01:00