Commit graph

5,851 commits

Author SHA1 Message Date
Pieter De Gendt
aad2408b30 scripts: Don't use isort known-first-party
Partially revert 1bcc0652241af70d0b28aee155f260cd9ca0fc74

This change impacts all other scripts that import those modules, while
those weren't updated.

It will be hard to maintain this list, whilst keeping the entire tree
compliant.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-10-16 17:09:14 +03:00
Sebastian Bøe
35b89abd61 soc: nordic: uicr: Add safety flag for permanent device transition
Add --permit-permanently-transitioning-device-to-deployed safety flag
to gen_uicr.py, required when enabling both UICR.LOCK and
UICR.ERASEPROTECT together. This prevents accidental permanent locking
of devices since this combination makes the configuration irreversible.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2025-10-15 17:37:02 -04:00
Sebastian Bøe
1438f8ae69 soc: nordic: uicr: Add support for UICR.APPROTECT
Add support for UICR.APPROTECT configuration, which controls debugger
and access-port permissions through the TAMPC peripheral.

This introduces three Kconfig options that allow independent control
over access port protection for different processor domains:

- GEN_UICR_APPROTECT_APPLICATION_PROTECTED: Controls debug access to
  the application domain processor
- GEN_UICR_APPROTECT_RADIOCORE_PROTECTED: Controls debug access to
  the radio core processor
- GEN_UICR_APPROTECT_CORESIGHT_PROTECTED: Controls access to the
  CoreSight debug infrastructure

When enabled, each option sets the corresponding UICR.APPROTECT
register to PROTECTED (0xFFFFFFFF), which disables debug access for
that domain. When disabled, the registers remain at their erased value
(UNPROTECTED), allowing full debug access.

This feature is critical for production devices where debug access must
be restricted to prevent unauthorized access to sensitive code and data.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2025-10-15 17:37:02 -04:00
Sebastian Bøe
e20352d80a soc: nordic: uicr: Add support for UICR.ERASEPROTECT
Add support for UICR.ERASEPROTECT configuration, which blocks ERASEALL
operations to prevent bulk erasure of protected memory.

This introduces a Kconfig option GEN_UICR_ERASEPROTECT that enables
blocking of ERASEALL operations on NVR0, preserving UICR settings even
if an attacker attempts a full-chip erase.

This is a critical security feature for production devices. When enabled
together with UICR.LOCK, it becomes impossible to modify the UICR in
any way, establishing a permanent device protection scheme. Due to this
irreversibility, it should only be enabled during the final stages of
production.

When enabled, the gen_uicr.py script sets UICR.ERASEPROTECT to
0xFFFFFFFF, which prevents the ERASEALL command from affecting the
NVR0 page.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2025-10-15 17:37:02 -04:00
Sebastian Bøe
1ffdf09c25 soc: nordic: uicr: Add support for UICR.LOCK
Add support for UICR.LOCK configuration, which locks the entire UICR
configuration in NVR0 to prevent unauthorized modifications.

This introduces a Kconfig option GEN_UICR_LOCK that enables locking
of the UICR. Once locked, the UICR can only be modified by performing
an ERASEALL operation.

This is a critical security feature for production devices, typically
enabled alongside UICR.APPROTECT, UICR.PROTECTEDMEM, and
UICR.ERASEPROTECT to establish a complete device protection scheme.

When enabled, the gen_uicr.py script sets UICR.LOCK to 0xFFFFFFFF,
which configures the NVR0 page as read-only and enforces integrity
checks on the UICR content.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2025-10-15 17:37:02 -04:00
Sebastian Bøe
c3f6b8cb34 soc: nordic: uicr: Add support for UICR.SECONDARY.PROTECTEDMEM
Add support for UICR.SECONDARY.PROTECTEDMEM configuration, which enables
configuration of the protected memory region for secondary firmware.

This introduces Kconfig options for configuring:
- GEN_UICR_SECONDARY_PROTECTEDMEM - Enable/disable protected memory
  for secondary firmware
- GEN_UICR_SECONDARY_PROTECTEDMEM_SIZE_BYTES - Size of the protected
  memory region in bytes

The implementation validates that the configured size is divisible by
4096 bytes (4 KiB) as required by the hardware, and converts it to
4 KiB units when writing to UICR.SECONDARY.PROTECTEDMEM.SIZE4KB.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2025-10-15 17:37:02 -04:00
Sebastian Bøe
9dc2b614d6 soc: nordic: uicr: Add support for UICR.SECONDARY.TRIGGER
Add support for UICR.SECONDARY.TRIGGER configuration, which enables
automatic booting of secondary firmware based on specific reset reasons.

This introduces Kconfig options for configuring:
- UICR.SECONDARY.TRIGGER.ENABLE - Enable/disable automatic triggers
- UICR.SECONDARY.TRIGGER.RESETREAS - Bitmask of reset reasons that
  trigger secondary firmware boot

Individual Kconfig options are provided for each reset reason:
- APPLICATIONWDT0/1 - Application core watchdog timeouts
- APPLICATIONLOCKUP - Application core CPU lockup
- RADIOCOREWDT0/1 - Radio core watchdog timeouts
- RADIOCORELOCKUP - Radio core CPU lockup

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2025-10-15 17:37:02 -04:00
Sebastian Bøe
af32ebd198 soc: nordic: uicr: Add support for UICR.WDTSTART
Add support for UICR.WDTSTART.

UICR.WDTSTART configures the automatic start of a local watchdog timer
before the application core is booted. This provides early system
protection ensuring that the system can recover from early boot
failures.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2025-10-15 17:37:02 -04:00
Łukasz Fundakowski
2d60533558 twister: Refactor twister tests
- Removed redundant `sys.path.insert`
- Fixed imports order to follow PEP8 style

Signed-off-by: Łukasz Fundakowski <lukasz.fundakowski@nordicsemi.no>
2025-10-15 17:36:11 -04:00
Graham Roff
d5f8b8d03d size_report: Add a report showing total memory use.
The current size_report generates "ram" and "rom" reports, but not one
showing the total of all run-time memory used (the "ram" report does not
include memory required to load the code for non-XIP boards).
Summing the existing reports does not work as it double-counts
statically initialized data.
The new "all" report shows the correct accounting of all run-time memory
used.
To support this functionality the "targets" argument has been extended
to allow multiple arguments, for example to generate all three reports:
$ size_report -k ... -z ... --output=. ram rom all

In the JSON output, the location ("ram" or "rom") is included in the
"loc" property for each symbol.

Signed-off-by: Graham Roff <grahamr@qti.qualcomm.com>
2025-10-15 15:38:22 +03:00
Lukasz Fundakowski
9c5325df29 twister: Add unit tests for Pytest harness
Added unit tests for parsing JUnitXml report by Pytest harness.

Signed-off-by: Lukasz Fundakowski <lukasz.fundakowski@nordicsemi.no>
2025-10-14 17:41:32 -04:00
Łukasz Fundakowski
8201d20b24 twister: remove not needed try..except
Removed redundant try..except around the code
and fixed a test for that code which was false positive.

Signed-off-by: Łukasz Fundakowski <lukasz.fundakowski@nordicsemi.no>
2025-10-13 18:13:11 -04:00
Mathieu Choplain
7bbecd8c37 scripts: kconfig: fix dt_nodelabel_int_prop crash if prop doesn't exist
dt_nodelabel_int_prop did not check if the property existed on the node
before accessing it, which would result in a build-time crash (and thus
build error) if used on a node which lacked the requested property.

Fix by using the common _node_int_prop() helper which handles all edge
cases properly.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2025-10-10 20:51:13 -04:00
Benjamin Cabé
c07d182466 scripts: ci: do_not_merge.py: labels starting with 'block:' mean DNM
When checking for "do not merge" labels on a pull request, also consider
any label that starts with "block:" as a DNM label (e.g "block: HW
Test").

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-10-10 12:53:14 -04:00
James Growden
86ebdf8e32 scripts: Use different module IDs per runner module
If we have multiple runners listed under a module,
Each runner py file will individually overload and overwrite the
prior module loaded, because it is using the same module name.

Signed-off-by: James Growden <jgrowden@tenstorrent.com>
2025-10-10 12:52:56 -04:00
James Roy
a855c61fcb scripts: Add __deprecated_version to the checkpatch checklist
Add macro __deprecated_version to the checklists of
`scripts/checkpatch.pl` and `scripts/tags.sh`.

Signed-off-by: James Roy <rruuaanng@outlook.com>
2025-10-09 12:47:35 -04:00
Guðni Már Gilbert
a1369d5c6a scripts: list_boards: drop HWMv1 code
Fixes #97017

Support for HWMv1 was removed in Zephyr 4.2.0

Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
2025-10-09 12:40:30 -04:00
Guðni Már Gilbert
ec59f15946 scripts: west_commands: don't search for HWMv1 boards
Support for HWMv1 was removed in Zephyr 4.2.0

Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
2025-10-09 12:40:30 -04:00
Kyle Micallef Bonnici
1476fcb935 Devicetree: remove deprecated ok state
The `ok` state is deprecated and very few files are using this.
The DTS spec also does not have this value.

This PR removes this value once and for all.

Signed-off-by: Kyle Micallef Bonnici <kylebonnici@hotmail.com>
2025-10-09 12:36:43 -04:00
Maciej Torhan
12d21dfc2d twister: scripts: add missing failure reason in Robot test runner
Add failure reason with return code when Renode process fails

Signed-off-by: Maciej Torhan <mtorhan@antmicro.com>
2025-10-09 12:35:48 -04:00
Abderrahmane JARMOUNI
fed89a038d scripts: pylib: twister: expr_parser: add dt_node_has_prop expression
Add 'dt_node_has_prop' expression to use the existence of a node property
as a filter in Twister test configuration yaml files.
First argument must be a node alias (in aliases node) or a node path,
not a nodelabel.

Signed-off-by: Abderrahmane JARMOUNI <git@jarmouni.me>
2025-10-08 08:47:27 +02:00
Jamie McCrae
01542407f9 scripts: utils: migrate_mcumgr_kconfigs: Remove old Kconfigs
Removes Kconfig changes which happened in Zephyr 3.3 or older

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-10-08 08:46:03 +02:00
Anas Nashif
bf82f7ffac copyrights: fix copyright line
Add space before (c) to allow correct parsing by linters.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-10-07 22:53:45 -04:00
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