Commit graph zephyr/scripts
Author SHA1 Message Date
Filip Kokosinski
f5a349f45c scripts: move zaru.py to a separate directory
This commit moves the `zaru.py` script to `scripts/instrumentation`, and
adjusts references to the script in other places.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2025-10-06 15:06:25 -04:00
Alberto Escolar Piedras
9de8947bf9 native_simulator: Get latest from upstream
Align with native_simulator's upstream main
4641dad899979528e4083aa762651388a2a7ec7b

Which includes:
4641dad common: nsi_internal.h: Use NSI_INLINE macros
7a1156c nsi_tasks: move header to include folder
6b7d76a nct: fix restarting sem_wait after signal
166516d nce: fix restarting sem_wait after signal

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-10-06 20:02:02 +03:00
Gustavo Romero
9f402bd177 scripts: zaru: Add instrumentation CLI tool
This commit adds 'zaru', a CLI tool for the instrumentation subsystem.

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
Signed-off-by: Kevin Townsend <kevin.townsend@linaro.org>
Signed-off-by: Erik Schilling <erik.schilling@linaro.org>
Signed-off-by: Maciej Sobkowski <msobkowski@antmicro.com>
2025-10-05 06:18:25 -04:00
Anas Nashif
f53ab27157 scripts: set_assignee: add tests as a meta area
Add tests to be a meta area, similar to samples and documentation.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-10-05 06:17:45 -04:00
Rubin Gerritsen
e9abaf435b scripts: compliance: Add basic cmake style checks
It is very common to see a comment stating that the
"No Space Before Opening Brackets" style guide is not followed.
To avoid putting this burdon on reviewers, let the compliance
check catch this instead.

Checking for tab indentation was also very simple, so also added
this.

Running this check on all files finds many violations:
 - Space before opening brackets: 141 violations
 - Tab indentation: 420 violations

Fixing these will not be done as part of this PR. Adding the check
will prevent us from adding new violations.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2025-10-05 06:17:36 -04:00
Mathieu Choplain
33a7b65f69 scripts: ci: check_compliance: use correct error when author didn't sign
Commit e4650bc349 modified check_compliance
to avoid false negatives when a commit has multiple signoff lines and the
author's signoff line isn't the first one. To avoid this, a signoff line
which matches exactly the author's name and email is searched instead of
matching any line with the proper syntax and checking the fields.

While this solved the original issue, this also introduced a new issue:
whereas the old script would distinguish a properly formed signoff line
with the wrong author from a malformed signoff line, the new method now
checks both the syntax and the author name/email at the same time. As
such, the script will report "signoff line does not follow the syntax"
for both situations, but the signoff line DOES follow the syntax in the
latter case: the error message is then only a misleading red herring.

Fix this issue - and improve the check - by verifying every signoff line
in a commit's message body. Invalid syntax on any line is reported as a
"does not follow syntax" failure, whereas inability to find the commit
author is reported as a separate "no signoff entry matches commit author"
failure as it should always have...

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2025-10-03 21:03:29 -04:00
Mathieu Choplain
82fd615aad scripts: ci: check_compliance: fix potential unbound variable access
When checking for emails/sign-off, if parsing of the commit information
using 'git show' fails, the 'auth_name', 'auth_email' and 'body' variables
are unbound but accessed right afterwards, which would cause an error.

Skip straight to next iteration of the loop when such an error occurs to
ensure access to the unbound variables is never performed.

This error was reported by the VS Code Pylance analyzer.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2025-10-03 21:03:29 -04:00
Martí Bolívar
0907a05baf scripts: dts: fix CMake DT API helper for compatible properties
Our build system DT API has a dt_comp_path() function used to look up
paths of nodes with a given compatible. This relies on the generated
edt.pickle.cmake file in the build directory to look inside the
concrete devicetree for the current application build.

The script gen_dts_cmake.py is responsible for generating
edt.pickle.cmake. It currently generates the data needed by
dt_comp_path() by looking inside each edtlib.Node object's "props"
attribute. This attribute in turn is fed by the "properties:" key in
the node's YAML binding. This leads to an edge case which is breaking
the dt_comp_path() API.

In most cases, we don't notice this edge case because base.yaml, which
is included by nearly all bindings, has a definition for "compatible"
in its "properties:" map. However, bindings are not required to
include base.yaml, and bindings do not have to explicitliy define a
"compatible" entry in their "properties:". An example of a binding
that does neither is fixed-partitions.yaml: it only has #address-cells
and #size-cells in its "properties:".

Nonetheless, "compatible:" is always a valid property name because
it's defined in the DT spec, and we should make the CMake API robustly
detect all nodes with a given compatible, regardless of whether that
node's binding explicitly defines it or not.

To make this happen, rely on the edtlib.Node.compats attribute instead
of edtlib.Node.props. The compats attribute is always defined even if
the node's YAML binding doesn't have an explicit entry for
"compatible".

Signed-off-by: Martí Bolívar <marti.bolivar@oss.qualcomm.com>
2025-10-03 21:00:29 -04:00
Torsten Rasmussen
b88e615339 sysbuild: support application CMakePresets.json files with sysbuild
This commit provides a CMakePresets.json which includes the sample's
CMakePresets.json file.

`west build` is extended to set `APP_DIR` in environment when sysbuild
is used. This allows sysbuild's CMakePresets.json to include the
sample's presets file.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2025-10-03 12:51:01 +03:00
Bartlomiej Buczek
cbe94caa77 scripts: twister: coverage: do not fail when suspicious_hits are detected.
gcovr 8.0 introduces suspicious_hits detection, warn on such detection, but
do not stop coverage calculation at all.

Signed-off-by: Bartlomiej Buczek <bartlomiej.buczek@nordicsemi.no>
2025-10-03 12:50:24 +03:00
Benjamin Cabé
27330f6f02 scripts: requirements-actions: regen pinned dependencies
Run uv pip compile to get fresh snapshots of the pinned dependencies.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-10-01 20:23:51 -04:00
Chris Friedt
5cbb2a421d posix: switch to using posix_time.h and posix_signal.h
To avoid conflicts between the C library's `time.h` and signal.h use an
"override" header (when necessary) for C libraries that do not themselves
provide POSIX definitions in `time.h` or `signal.h`.

V2

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-10-01 14:36:55 +03:00
Sebastian Bøe
7c9275c891 soc: nordic: uicr: Add support for uicr.PROTECTEDMEM
Add support for PROTECTEDMEM.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2025-09-29 12:39:33 -04:00
Sebastian Bøe
9f45d2ccd7 soc: nordic: uicr: Add support for uicr.SECONDARY.PROCESSOR
Add support for uicr.SECONDARY.PROCESSOR.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2025-09-29 12:39:33 -04:00
Tim Pambor
30e5ea0b3f native_simulator: Get latest from upstream
Align with native_simulator's upstream main
4eab13716376e63236d77013f996a897d24dd780

Which includes:
4eab137 Host trampolines: Add getenv/setenv

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2025-09-29 12:37:47 -04:00
Łukasz Fundakowski
f23b1f59da twister: Improve handling SystemExit exceptions
If twister exits by sys.exit function or by raising
the SystemExit exception, catch that exceptions and
return proper exit code.

Signed-off-by: Łukasz Fundakowski <lukasz.fundakowski@nordicsemi.no>
2025-09-26 09:38:10 -04:00
Anas Nashif
83132c767f Revert "ci: set_assignee: add release team on PRs without review"
Script does not handle already assigned PRs correctly, revert until we
have a proper fix.

This reverts commit 972ebb64dc.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-09-26 08:02:38 -04:00
Anas Nashif
972ebb64dc ci: set_assignee: add release team on PRs without review
In cases where we are not able to assign a PR due to lack of matches in
the maintainer file, add the release team to the reviewers so someone
can triage it. Also add a comment to make it clear that the release team
was added for triage purposes only.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-09-26 13:23:44 +02:00
Thorsten Klein
b9516025ce scripts: west_commands: fix default build directory fallback
fixed fallback to default build directory (build) in case that no other
build directory could be determined.

Signed-off-by: Thorsten Klein <Thorsten.Klein@bshg.com>
2025-09-26 09:09:56 +02:00
Fabio Baltieri
9384cc5b96 Revert "posix: switch to using posix_time.h and posix_signal.h"
This reverts commit 1eb5c97bd6.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-09-25 14:15:57 -04:00
Chris Friedt
1eb5c97bd6 posix: switch to using posix_time.h and posix_signal.h
To avoid conflicts between the C library's `time.h` and signal.h use an
"override" header (when necessary) for C libraries that do not themselves
provide POSIX definitions in `time.h` or `signal.h`.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-09-25 12:01:23 +01:00
Grzegorz Chwierut
51cba9d11f twister: Add unit tests for required applications
Added tests for sharing of build application feature
added in #94167

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2025-09-24 19:20:15 -04:00
Jared Wolff
3c7d9732e8 west: runners: probe-rs: Add enhanced functionality
Add comprehensive enhancements to the probe-rs runner:

- New parameters: --reset, --protocol, --speed, --verify, etc
- RTT logging support via 'attach' command
- Smart binary format detection with FileType support
- Enhanced debug/debugserver with improved GDB integration
- Conditional reset after flashing instead of always resetting

Maintains upstream compatibility while significantly expanding
probe-rs capabilities for embedded development workflows.

Signed-off-by: Jared Wolff <hello@jaredwolff.com>
2025-09-24 11:27:40 +01:00
Vladislav Pejic
1d02d57413 driver: adc: Added stream APIs for ADC
Introduce a streaming APIs for ADC devices.
Two new APIs are added to the adc_driver_api: submit and get_decoder.
Added decoder following APIs: get_frame_count, get_size_info, decode,
has_trigger.

Supported triggers are:
- ADC_TRIG_DATA_READY
- ADC_TRIG_FIFO_WATERMARK
- ADC_TRIG_FIFO_FULL
Supported operations to be done on trigger:
- include - whatever data is associated with the trigger
- nop - do nothing with data associated with the trigger
- drop - clear data associated with the trigger

Some changes to the linker scripts were needed to add decoder APIs.

Signed-off-by: Vladislav Pejic <vladislav.pejic@orioninc.com>
2025-09-23 17:50:25 -04:00
Benjamin Cabé
8f4b253ac8 scripts: replace pykwalify with jsonschema
Converted `arch-schema.yml`, `board-schema.yml`, and `soc-schema.yml`
from PyYAML format to JSON Schema format, including baking in some of
the validation rules that were deferred to ad hoc Python right into the
schemas (e.g. mutual exclusivity of certain fields).

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-09-22 17:49:08 -04:00
Thorsten Klein
64723f6b4f scripts: west_commands: list sdk from env variable ZEPHYR_SDK_INSTALL_DIR
Users can specify a Zephyr SDK installation directory using the
`ZEPHYR_SDK_INSTALL_DIR` environment variable. This variable must be
taken into account when listing all installed SDKs, such as with the
`west sdk list` command.

Signed-off-by: Thorsten Klein <thorsten.klein@bshg.com>
2025-09-22 13:33:01 -04:00
Sebastian Bøe
38a0f713a6 soc: nordic: uicr: Add support for SECURESTORAGE
Add UICR.SECURESTORAGE configuration based on device tree partitions.
Validates partition layout and populates size fields in 1KB units.
Handles missing partitions gracefully.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2025-09-22 13:28:55 -04:00
Benjamin Cabé
155a371ecf script: ci: check_compliance: add LicenseAndCopyright compliance check
Implement a new compliance check to ensure that all modified files
have correct licensing information (SPDX-License-Identifier as well as
copyright info).

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-09-19 12:45:41 -04:00
Benjamin Cabé
7d510ac2f9 script: ci: check_compliance: adjust test name formatting
Provide more space to tests with a long name so that output is aligned.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-09-19 12:45:41 -04:00
Benjamin Cabé
95e91d67e1 scrips: ci: check_compliance: organize imports
organize import and fix associated ruff exlude rule

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-09-19 12:45:41 -04:00
Fabio Baltieri
7a814345d1 scripts: update the Github auth API
Fixes: /home/runner/work/zephyr/zephyr/scripts/ci/do_not_merge.py:66:
DeprecationWarning: Argument login_or_token is deprecated, please use
auth=github.Auth.Token(...) instead

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-09-19 16:35:15 +02:00
Gerard Marull-Paretas
6dacc14d2b scripts: west_commands: runners: add sftool runner
So we can flash using sftool.

Ref. https://github.com/OpenSiFli/sftool.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2025-09-19 16:34:15 +02:00
Nicolae Dicu
67b4063a20 scripts: requirements: Use gitlint-core for loose requirements
Gitlint-core has loose requirements and not conflicting
with scancode-toolkit v32.4.1 (click==8.1.3 vs click>=8.2.0).

Signed-off-by: Nicolae Dicu <nicolae.dicu@nordicsemi.no>
2025-09-19 08:35:53 -04:00
Jordan Yates
61298e31c7 scripts: twisterlib: more efficient coverage merging
Use `collections.defaultdict` to simplify code, and use the `bytes`
type internally rather than hex strings.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-09-19 08:34:32 -04:00
Jordan Yates
aa08e0df20 testsuite: coverage: convert dump method to choice
To support future coverage dump methods (semihosting) move
`COVERAGE_DUMP` inside a choice symbol.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-09-19 08:34:32 -04:00
Romain Pelletant
732823e0c6 posix: options: replace kconfig for rw lock
- Update Kconfig from CONFIG_POSIX_READER_WRITER_LOCKS to POSIX_RW_LOCKS

Signed-off-by: Romain Pelletant <romainp@kickmaker.net>
2025-09-19 08:27:49 -04:00
Cherniaev Andrei
fceca3b268 doc: Kconfiglib development has moved
Details https://github.com/ulfalizer/Kconfiglib/issues/139

Signed-off-by: Cherniaev Andrei <dungeonlords789@naver.com>
2025-09-18 13:49:22 -04:00
Benjamin Cabé
635e7c7261 sca: add DT diagnostic tool
implemented as an SCA for now but might benefit from being baked into
the build system so that it's always available.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-09-18 15:42:42 +01:00
Jiafei Pan
77b000faaa requirements: update spsdk version
Update spsdk version to fix dependency confliction with other software.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2025-09-17 08:48:05 +02:00
Tamás Kiss
14d24b1698 script: logging: fix formatting of dropped messages
Print the actual number instead of a single-element tuple.
For example: "2 messages dropped" instead of "(2,) messages dropped"

Signed-off-by: Tamás Kiss <tmik@demant.com>
2025-09-16 13:06:12 -04:00
Miguel Gazquez
5335b7c424 scripts: west_commands: correct f-string in board mismatch error message
The board mismatch error message in `scripts/west_commands/build.py` was
partially missing f-string formatting. This caused `{self.args.board}`
to be printed literally instead of being replaced with the actual board
value.

Fix the f-string.

Signed-off-by: Miguel Gazquez <miguel.gazquez@bootlin.com>
2025-09-16 16:05:03 +02:00
Bill Waters
e20c04a320 scripts: west_commands: runners: openocd path fix
There is a fix that is needed for building on Linux and
running on Windows.  Without this fix, the scripts throws
errors and fails because of the '\' instead of '/'.  For
portability, the script should not use literal slashes.

Signed-off-by: Bill Waters <bill.waters@infineon.com>
2025-09-15 19:44:17 -04:00
Thomas Stranger
340c59cc80 scripts: west_commands: zspdx: fix log ref to meta file
The build output meta data is written to the zephyr.meta
file not zephyr_meta.yml.
This name is defined by KERNEL_META_NAME in cmake/modules/kernel.cmake.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2025-09-15 19:44:07 -04:00
Leonardo Bispo
df0cb360fa script: trim RTT log data on dictionary parser
The fact that log data captured with RTT has a header, like the
following, impedes the parser to parse the data properly

```
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
SEGGER J-Link V8.24 - Real time terminal output
SEGGER J-Trace PRO V4.0, SN=XXXX
Process: JLinkExe
```

Signed-off-by: Leonardo Bispo <l.bispo@live.com>
2025-09-15 14:07:11 -04:00
Hake Huang
4c8419b992 twsiter: binary handler: pass verbose setting to west call
pass verbose setting to west call. when the v > 2 west log
will be triggerred

Signed-off-by: Hake Huang <hake.huang@nxp.com>
2025-09-15 14:43:51 +02:00
Grzegorz Chwierut
bf2378e36b twister: scripts: sharing of built applications
This feature enables sharing of built applications between test
scenarios, allowing tests to access build artifacts from other
applications.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2025-09-15 10:29:40 +02:00
Rico van Dongen
8bb976ad12 scripts: west_commands: zspdx: re-naming PACKAGE-MANAGER
According to the SPDX specification
PACKAGE-MANAGER should be spelled with a dash not an underscore

Signed-off-by: Rico van Dongen <rdongen@ziggo.nl>
2025-09-13 18:15:24 -04:00
Rico van Dongen
02da120792 scripts: west_commands: zspdx: updating sbom data based on cpe reference
The PackageName, PackageVersionand and PackageSupplier in the generated
SBOM will be updated based on the information passed in the
external-references in the module.yml.
This way packages are better recognized by vulnerability scanning tools
like cve-bin-tool.

Signed-off-by: Rico van Dongen <rdongen@ziggo.nl>
2025-09-13 18:15:24 -04:00
Hake Huang
504fb0158f doc: scripts: display_harness: update document on installation
add Installation Guide section

Signed-off-by: Hake Huang <hake.huang@nxp.com>
2025-09-13 11:21:53 -04:00
Hake Huang
2d8a6d23f8 tests: display: support headless mode
for test machine without display, need support open-cv-headless mode.

1. support headless mode
2. add parser for environment path

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2025-09-13 11:21:53 -04:00