Commit graph zephyr/scripts
Author SHA1 Message Date
William Vinnicombe
dfbdca0e13 scripts: west: build: add fallback for srcrel to self.source_dir
On Windows, if the working directory and source directory are on different
drive letters, `os.path.relpath` will throw `ValueError: path is on mount
'D:', start on mount 'C:'`

This adds a fallback to use `self.source_dir` in that case, as `srcrel` is
only used in the printout of the checks below, so does not need to be
relative to the working directory

Signed-off-by: William Vinnicombe <william.vinnicombe@raspberrypi.com>
2026-06-30 11:54:55 -04:00
Piotr Kosycarz
99c6f8af40 scripts: twister: handlers: handle nrf* runner dev-id
As there are multiple custom nrf* runners which needs dev-id,
handle them in general way for future.

Signed-off-by: Piotr Kosycarz <piotr.kosycarz@nordicsemi.no>
2026-06-30 06:48:37 -04:00
Lucas Romero
fd407d213a lint: disable duplicate code check
for file that is intentionally a duplicate

Signed-off-by: Lucas Romero <lucas.romero@a-labs.io>
2026-06-30 06:47:37 -04:00
Lucas Romero
2efb7a1fba tests: update list of runners
to make tests succeed

Signed-off-by: Lucas Romero <lucas.romero@a-labs.io>
2026-06-30 06:47:37 -04:00
Lucas Romero
ebbffc9dda west: runners: add rtkprog
as an alternative flashing tool for realtek boards.
It is open source and cross-platform and available at the following
locations:
- https://github.com/a-labs-io/rtkprog
- https://pypi.org/project/rtkprog/

Signed-off-by: Lucas Romero <lucas.romero@a-labs.io>
2026-06-30 06:47:37 -04:00
Ryan McClelland
739f9edba9 counter: add devicetree reader macros
Add devicetree reader macros for counter capture. These include
an index for the channel number and default flags. These are
intended to eventually to be used within drivers for timestamp
capturing.

Signed-off-by: Ryan McClelland <rymcclel@gmail.com>
2026-06-30 06:46:41 -04:00
Anas Nashif
4bfa037c3f scripts: tracing: add a console CTF trace viewer
Add scripts/tracing/trace_viewer.py, a dependency-free (Python 3 stdlib
only) viewer that renders a Zephyr CTF trace graphically on the console,
in the spirit of Trace Compass.

The viewer decodes the packed little-endian CTF records itself rather
than relying on babeltrace2. The per-event field layout is read from the
TSDL subsys/tracing/ctf/tsdl/metadata file (located by climbing the tree
from the script or via ZEPHYR_BASE), so the decoder tracks any events
added there; a small built-in table covers the core scheduling events so
the time graph still works when the metadata file is not found.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-06-29 22:18:05 -04:00
Pieter De Gendt
a9992bfb8b scripts: kconfig: Don't require a blank line between comment and if
A comment directly above a top-level 'if' documents the conditional
block, so anchor the required blank line before the comment rather than
between the comment and the 'if'.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Assisted-by: Claude Code:claude-opus-4.8
2026-06-29 14:05:29 -05:00
Mathieu Choplain
d8b6648fb8 scripts: runners: pyocd: accept --no-load argument
Add support for the --load/--no-load argument in the pyOCD runner to
enable debugging using pyOCD without programming the target beforehand.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-06-29 13:59:31 -05:00
Zhixuan Jin
eaac153a15 scripts: runners: openocd: support -i/--dev-id for adapter selection
The openocd runner can already select a specific debug adapter by serial
number, but it did not advertise the dev_id capability. As a result the
common `west flash -i <serial>` form supported by every other runner failed
with "openocd doesn't support --dev-id option", which is confusing when
several identical adapters (e.g. CMSIS-DAP) are connected at once.

Declare dev_id=True and route the existing --serial option to the same
'dev_id' destination, following the pattern other runners used for this
migration. Both flags therefore land in args.dev_id (argparse handles
precedence), and the value is passed to the OpenOCD config as
_ZEPHYR_BOARD_SERIAL as before. --serial is kept as a deprecated alias and
documented in the migration guide; tests/test_openocd.py covers both forms.

Signed-off-by: Zhixuan Jin <me@zhixuan.dev>
2026-06-29 13:54:14 -05:00
Jamie McCrae
9197ece1e8 scripts/cmake: Add monitoring for dts bindings being changed
Generates a new file for use by the build system which lists all
the paths to dts bindings used in a build, then from CMake adds a
dependency to these files so that if they are modified, CMake will
re-run.

This has been implemented by adding support to edtlib to output
details on bindings and binding paths inside of the python code

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-06-29 11:28:16 +02:00
Henrik Brix Andersen
15cf3913b2 scripts: requirements: actions: refresh pinned versions
Run the uv command to update the pinned version in
requirements-actions.txt.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2026-06-26 13:02:39 -04:00
Martin Moya
f6b8a3ac31 twister: gtest: add failure reason when Gtest tests fail
Before this change, whenever a Gtest failed the runner failed reporting
that `instance.reason` was a `NoneType` and couldn't be concatenated
to string.

This PR fix that by adding a reason to the Gtest instance whenever
it failed. Additionally, it covers the edge case where Gtest
started but it has never finished executing the test

Signed-off-by: Martin Moya <moyamartin1@gmail.com>
2026-06-26 14:24:19 +01:00
Bill Waters
37923771bd scripts: twister: report unknown platform when loading a test plan
When loading a saved test plan with --load-tests/-F, get_platform()
returns None for any platform name in the file that is not part of the
current build. TestInstance() then dereferences platform.name and fails
with an opaque "AttributeError: 'NoneType' object has no attribute
'name'", which gives no hint about which entry is at fault.

Raise a TwisterRuntimeError that names the file, the unknown platform
and the test instead, so a stale or mismatched test plan is easy to
diagnose.

Assisted-by: AI (GitHub Copilot)
Signed-off-by: Bill Waters <bill.waters@infineon.com>
2026-06-26 07:46:37 -04:00
Shankar Ramasamy
8ad8e21b80 west: twister: enhancements to mplab_ipe runner
- fix mplab_ipe runner to use the board by serial number
- fix twister handler to pass dev_id to mplab_ipe runner
- fix map file generation to include MPLAB boards

Signed-off-by: Shankar Ramasamy <shankar.ramasamy@microchip.com>
2026-06-26 07:45:37 -04:00
Appana Durga Kedareswara rao
8f9860f660 scripts: coredump: add UDP receiver; fix gdbserver pipe teardown
Add coredump_udp_receiver.py to reassemble ZCDU-framed UDP datagrams
sent by CONFIG_DEBUG_COREDUMP_BACKEND_LOGGING_UDP into a raw .bin file
compatible with coredump_gdbserver.py. Supports IPv4 (--listen 0.0.0.0)
and IPv6 (--listen ::) with an idle-timeout to detect end-of-session
when the END datagram is lost.

Fix coredump_gdbserver.py: call gdbserver.close() only when not using
--pipe mode to avoid a double-close teardown error. Also clarify the
second positional argument as coredump_bin and document both the
serial-log-parser and UDP receiver workflows in the help text.

Signed-off-by: Appana Durga Kedareswara rao <appana.durga.kedareswara.rao@amd.com>
2026-06-25 22:18:57 +01:00
Fabio Baltieri
550ba56ddc ci: pr_metadata_check: pin pygithub
Pin the pygithub depdendency, keep the code scanning check happy. This
has to be done using a requirement file so that the automation can
update it with the other one so create a new requirements-actions-basic
just for this, it may come in handy for other workflows that don't need
the whole toolchain but just github api access.

Link: https://github.com/zephyrproject-rtos/zephyr/security/code-scanning/1102
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2026-06-25 22:17:26 +01:00
Pieter De Gendt
0a78b04519 scripts: ci: Add Kconfig formatting compliance check
Add a KconfigFormat check that runs scripts/kconfig/kconfig_style.py on
changed Kconfig files and reports the style issues on the touched lines.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Assisted-by: Claude Code:claude-opus-4.8
2026-06-25 15:25:02 +02:00
Pieter De Gendt
a3b078938c scripts: kconfig: Add style checker helper script
Add scripts/kconfig/kconfig_style.py, a dependency-free checker for the
Kconfig formatting rules from the style guidelines (line length,
indentation, blank lines, comment spacing and final newline).

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Assisted-by: Claude Code:claude-opus-4.8
2026-06-25 15:25:02 +02:00
Benjamin Cabé
0ed493902c scripts: zspdx: adopt snake_case naming throughout
Rename functions, class attributes, and local variables from camelCase
to snake_case across the zspdx library and west spdx command. This is
a mechanical rename with no functional changes.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-06-25 06:20:02 -04:00
David Nepožitek
daad7c59b8 scripts: zspdx: Fix encoding of SPDX 2 files
Explicitly open SPDX text output files with UTF-8 encoding to avoid
invalid UTF-8 content from platform-default encoding.

Signed-off-by: David Nepožitek <david@nepozitek.cz>
2026-06-24 14:00:04 -04:00
Pieter De Gendt
dcb1f49019 scripts: west_commands: Strip name and level from log forwarding
West itself adds ERROR/WARNING prefix, and does not print a (module) name.
Remove the logger class, the default already simply forwards the message.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2026-06-24 13:58:14 -04:00
Ioannis Damigos
af2909f001 west: runners: ezflashcli.py: Use flash_address_from_build_conf()
Use flash_address_from_build_conf() to find the offset for the
binary.

Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
2026-06-24 07:38:58 -04:00
Anas Nashif
e836695cc8 scripts: fix various typos
Fix various typos under scripts/

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-06-23 09:12:58 -04:00
Nicolas Pitre
97fac4b782 kernel: mmu: remove LINKER_USE_PINNED_SECTION and __pinned_* tagging
CONFIG_LINKER_USE_PINNED_SECTION is the second half of the selective
kernel-pinning model removed in issue #108773. With the kernel image
now always resident at boot (previous commit), the __pinned_*
attribute family is a no-op: every page they would have segregated is
already pinned by z_mem_manage_init()'s whole-image loop, so the
tagging contract neither adds safety nor remains maintainable.

Drop it.

Mechanical removals:

* All ~219 in-tree uses of __pinned_text, __pinned_rodata,
  __pinned_data, __pinned_bss, __pinned_noinit, and __pinned_func
  across arch/x86, drivers/interrupt_controller, drivers/timer,
  arch/common, kernel, lib/libc, subsys/portability/posix, tests, and
  the syscall code generator (scripts/build/gen_syscalls.py).

* The assembly aliases PINNED_TEXT/RODATA/DATA/BSS/NOINIT used in
  arch/x86/core/ia32/*.S and drivers/interrupt_controller/
  intc_loapic_spurious.S become plain TEXT/RODATA/DATA/BSS/NOINIT.

* K_KERNEL_PINNED_STACK_DEFINE, K_KERNEL_PINNED_STACK_ARRAY_DEFINE,
  K_KERNEL_PINNED_STACK_ARRAY_DECLARE, K_THREAD_PINNED_STACK_DEFINE,
  and K_THREAD_PINNED_STACK_ARRAY_DEFINE are removed. The few
  in-tree callers (kernel/init.c, arch/arm/core/cortex_a_r/smp.c,
  arch/arm64/core/fatal.c, arch/rx/core/prep_c.c,
  arch/x86/core/prep_c.c, kernel/include/kernel_internal.h,
  tests/bluetooth/hci_uart_async) move to the corresponding
  non-pinned macros.

Machinery removals:

* Kconfig.zephyr drops CONFIG_LINKER_USE_PINNED_SECTION.
  qemu_x86_tiny and qemu_x86_atom_virt drop their =y overrides.

* include/zephyr/linker/section_tags.h drops the __pinned_* macro
  definitions (both arms). __isr collapses to an empty macro since
  its only purpose was to alias __pinned_func.

* include/zephyr/linker/sections.h drops PINNED_TEXT_SECTION_NAME,
  PINNED_BSS_SECTION_NAME, etc. and the bare PINNED_TEXT/RODATA/etc.
  forwarders, plus the _APP_SMEM_PINNED_SECTION_NAME constant.

* include/zephyr/linker/linker-defs.h drops the lnkr_pinned_*
  externs, the _app_smem_pinned_* externs, and the lnkr_is_pinned()
  / lnkr_is_region_pinned() inline helpers.

* include/zephyr/linker/utils.h drops the lnkr_pinned_rodata branch
  in linker_is_in_rodata().

* include/zephyr/linker/app_smem_pinned{,_aligned,_unaligned}.ld
  are deleted; cmake/linker/ld/target_configure.cmake stops
  configuring them.

* boards/qemu/x86/qemu_x86_tiny.ld and
  include/zephyr/arch/x86/ia32/linker.ld drop their pinned-section
  blocks and the now-redundant #ifndef CONFIG_LINKER_USE_PINNED_SECTION
  conditionals throughout the body. The
  LIB_KERNEL_IN_SECT / LIB_ARCH_X86_IN_SECT / LIB_ZEPHYR_IN_SECT /
  LIB_C_IN_SECT / LIB_DRIVERS_IN_SECT / LIB_SUBSYS_LOGGING_IN_SECT /
  LIB_ZEPHYR_OBJECT_FILE_IN_SECT / ZEPHYR_KERNEL_FUNCS_IN_SECT macros
  in qemu_x86_tiny.ld are deleted; they existed only to feed the
  pinned text/rodata/data/bss/noinit sections.

* kernel/mmu.c drops the mark_linker_section_pinned(lnkr_pinned_start,
  ...) call. The mark_linker_section_pinned() helper survives but is
  now gated only on CONFIG_LINKER_USE_BOOT_SECTION.

* arch/common/init.c and include/zephyr/arch/common/init.h drop
  arch_bss_zero_pinned(); arch/x86/core/ia32/crt0.S drops the call
  to it.

* arch/x86/core/userspace.c drops the eager k_mem_page_in() of the
  thread's privileged stack on user-mode entry. With the kernel
  image fully resident the stack is already mapped.

* arch/x86/gen_mmu.py drops map_region("lnkr_pinned") and the
  set_region_perms() calls for lnkr_pinned_text / lnkr_pinned_rodata.

* CMakeLists.txt drops the LINKER_USE_PINNED_SECTION block that
  generated APP_SMEM_PINNED_* variables and the
  pinned_partitions target property feeding gen_app_partitions.py.
  cmake/modules/extensions.cmake removes the PINNED_RODATA /
  PINNED_RAM_SECTIONS / PINNED_DATA_SECTIONS zephyr_linker_sources()
  location keywords and their snippet files.
  scripts/build/gen_app_partitions.py drops --pinoutput /
  --pinpartitions arguments and the pinned-output branch.
  subsys/testsuite/coverage/CMakeLists.txt drops its
  CONFIG_DEMAND_PAGING-conditional fork.

* scripts/build/gen_kobject_list.py drops the
  app_smem_pinned_start / _end fallback for kobject placement
  validation.

* tests/arch/x86/pagetables and tests/kernel/mem_protect/userspace
  drop their lnkr_pinned_text / lnkr_pinned_rodata branches.

* include/zephyr/arch/x86/ia32/arch.h folds IRQSTUBS_TEXT_SECTION
  to the unconditional ".text.irqstubs" form.

* tests/subsys/llext/src/syscalls_ext.c drops a stale comment about
  syscalls landing in .pinned_text.

Targeted retentions:

* arch/x86/core/bootargs.c keeps multiboot_cmdline and efi_bootargs
  in .noinit (was __pinned_noinit, which decayed to __noinit when
  LINKER_USE_PINNED_SECTION was unset). The multiboot and zefi loader
  paths write these buffers before Zephyr's BSS-zero step, so
  zeroing them at boot loses the cmdline.

* arch/x86/core/ia32/fatal.c keeps _df_esf and _df_stack in .noinit.
  They are scratch space written by the double-fault handler and have
  no zero-init requirement; keeping them in .noinit also preserves
  the historical post-noinit alignment that gen_mmu.py relies on
  (z_mapped_size is computed before CMake-injected iterable sections
  are appended to the linker script, so the post-noinit page padding
  is what keeps those sections within the mapped region).

* include/zephyr/arch/x86/ia32/syscall.h and
  include/zephyr/arch/x86/arch.h wrap the per-arch
  arch_syscall_invoke* / arch_is_user_context / arch_k_cycle_get_*
  implementations in @cond INTERNAL_HIDDEN. The public Doxygen
  contract lives on the prototypes in
  include/zephyr/arch/arch_interface.h; the per-arch implementations
  are internal. Without this, removing the __pinned_func attribute
  exposes the implementations to the doxygen-coverage delta check
  as 10 newly-undocumented APIs.

Documentation updates are deferred to a separate commit.

Issue: #108773

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2026-06-23 09:11:08 -04:00
Benjamin Cabé
10b1b8bbb4 scripts: zspdx: add SPDX 3.0 generation support
Add an SPDX 3.0 (JSON-LD) serializer built on the spdx-python-model
package and wire it into makeSPDX, so that running west spdx with
--spdx-version 3.0 produces SPDX 3.0 output. One JSON-LD document is
written per SBOM document (app, zephyr, build, modules-deps); each
emits its packages, files and relationships and declares conformance
to the Core, Software and SimpleLicensing profiles.

- Add zspdx.serializers.spdx3.SPDX3Serializer.
- Register SPDX_VERSION_3_0 in the supported versions list.
- Add the spdx-python-model dependency.
- Add spdx3-validate and validate the generated SPDX 3.0 documents in
  the software_bill_of_materials test.
- Generalize the west spdx command description and document SPDX 3.0
  usage.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-06-23 05:34:30 -04:00
Benjamin Cabé
16166b2840 scripts: ci: refresh requirements-actions.txt pinned versions and SHAs
This commit refreshes the pinned versions and SHAs for the
requirements-actions.txt file.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-06-23 05:34:30 -04:00
Benjamin Cabé
34abe3b511 scripts: west_commands: runners: core: fix mypy after pyelftools 0.33
pyelftools 0.33 added inline type annotations that expose
get_symbol_by_name() as a SymbolTableSection method only. Narrow
iter_sections() results with isinstance() before calling it.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-06-23 05:34:30 -04:00
Guðni Már Gilbert
efe74cabc3 scripts: dts: apply ruff format to gen_defines
Drop the script from .ruff-excludes.toml

Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
2026-06-22 18:02:08 -04:00
Anas Nashif
5349a7b2f2 twister: fix Console harness failure reason handling
7b543c84ac  moved the testcase status/reason finalization into
Console.handle() and added an `else` branch for the NONE status that
logged "Patterns left unmatched" and set tc.reason accordingly. Because
handle() runs once per console line and self.status stays NONE until all
patterns have matched, that branch fired on every line of a normal run.
This produced repeated bogus "ERROR - Patterns left unmatched" output on
any regex-matching test and left tc.reason set to "Patterns left
unmatched" even on tests that subsequently passed (e.g.
samples/synchronization reported reason="Patterns left unmatched" while
status="passed").

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-06-22 07:01:58 -04:00
Anas Nashif
a264bf5e30 twister: keep ignored platforms in the platform list
Platforms marked with `twister: false` were dropped entirely before being
added to the platform list, so any test referencing them (platform_allow,
integration_platforms, etc.) failed platform-existence verification and
twister aborted on the unidentified platform.

Keep such platforms in the platform list so references to them still
resolve, but never add them as default platforms nor assign them tests.
This allows disabling a platform in CI without having to scrub every
test that references it.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Assisted-by: Claude
2026-06-21 14:04:38 -07:00
Marc Herbert
830968e8df scripts: west: flash: drop "Permanently" from the --help
as requested by Sylvio in review of
https://github.com/zephyrproject-rtos/zephyr/pull/111000

I don't know why (very big) commit eb95bed552 added "Permanently".

Signed-off-by: Marc Herbert <marc.herbert@gmail.com>
2026-06-21 07:40:10 -04:00
Marc Herbert
0dcbec4c6d scripts: west_commands: drop never used 'help' argument in flash.py
This removes the warning seen in west flash -h, see
zephyrproject-rtos/west#927 for details.

Fixes commit b001dee329 ("scripts: empty unused .help duplicates in
west extensions")

Signed-off-by: Marc Herbert <marc.herbert@gmail.com>
2026-06-21 07:40:10 -04:00
9b9731a373 scripts: runners: fix flashing with minichlink
The flash on the ch32v series starts at 0x8000000 and, depending on
the system configuration, is aliased to 0x0. When the ch32v003 support
was first submitted, `minichlink` would accept either the real or the
alised address, but became stricter sometime in the last two years.

Fix the base address in the ch32v00{3,6}.dtsi, change
`minichlink.py` to always use the flash address from the build
configuration, and remove the `--dt-flash=y` work-arounds from the
more recent board configurations.

Tested by building `hello_world` for `ch32v003evt`, `ch32v006evt`,
`bluepillplus_ch32v203`, `ch32v303vct6_evt`, and `ch32v307v_evt_r1`;
running `west -v flash` and checking the command uses `0x8000000`.

Signed-off-by: Michael Hope <michaelh@juju.nz>
2026-06-21 07:39:40 -04:00
Lukasz Fundakowski
7b543c84ac twister: Improve Console harness failure reasons
Add type annotations in harness and testcase classes for clearer APIs and
better static checking.

Refine Console harness testcase status handling so FAIL/ERROR states and
reasons are propagated, and report unmatched patterns when execution ends
without a definitive pass/fail outcome.

Signed-off-by: Lukasz Fundakowski <lukasz.fundakowski@nordicsemi.no>
2026-06-19 22:39:36 +02:00
Anas Nashif
f20c8f37d1 twister: add post-build checks, detect cloned git repos
Add a new "post_build" operation to the twister build pipeline that runs
checks against the freshly built artifacts before metrics gathering. The
build stage hands off to post_build, which fails the instance (ERROR,
missing cases BLOCKed) if any check reports a problem.

The first check, check_no_nested_git_repos, walks the build directory for
any nested git repository (a .git directory or file) and fails the build
if found. A test or platform should never clone a git tree into its build
directory; enforcing this per-build attributes the failure to the specific
test instance and works for local runs as well as CI.

The checks are gated behind a new --post-build-checks option and are
disabled by default, as they add a build-directory walk per build. The
option is enabled in the twister CI workflow (TWISTER_COMMON), which also
drops the previous CI-only "find .git" step.

Added unit tests for the new operation, the check, and the option gating,
and updated the existing build-op process cases for the new transition.
Ran: ZEPHYR_BASE=$PWD python -m pytest
scripts/tests/twister/test_runner.py (144 passed).

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-06-19 22:38:09 +02:00
David Brown
0b3b73e034 ci: compliance: exclude split vulnerability files from Kconfig check
The KconfigBasic check skips doc/security/vulnerabilities.rst because
old CVE entries often reference Kconfig symbols that have since been
removed. Splitting that page into per-year files under
doc/security/vulnerabilities/ moved most of those entries out from
under the existing exclusion, so extend the pathspec to cover the
whole directory.

Signed-off-by: David Brown <david.brown@linaro.org>
Assisted-By: Claude:opus-4.8
2026-06-18 14:39:22 -04:00
Chris Friedt
d77ae038cb scripts: release: list_backports: format script using ruff
Format the script using ruff to avoid future formatting issues.

Signed-off-by: Chris Friedt <chris@fr4.co>
2026-06-18 08:57:38 -04:00
Chris Friedt
e6af1868d7 scripts: release: list_backports: use datetime.UTC
Fix pylint errors for compliance.

```
Python lint error (UP017) see \
https://docs.astral.sh/ruff/rules/datetime-timezone-utc: \
Use `datetime.UTC` alias
```

Remove the unused import `datteime.timezone` as per

```
Python lint error (F401) see \
  https://docs.astral.sh/ruff/rules/unused-import: \
  `datetime.timezone` imported but unused
```

Signed-off-by: Chris Friedt <chris@fr4.co>
2026-06-18 08:57:38 -04:00
Chris Friedt
30a2d75312 scripts: release: list_backports: update deprecated auth mechanism
Previously, the script used `gh = Github(args.token)` which was deprecated
in release 1.59 of PyGithub. The warning was later upgraded to an
exception as of PyGithub 2.0.

```shell
list_backports.py:316: DeprecationWarning: Argument login_or_token is \
deprecated, please use auth=github.Auth.Token(...) instead
  gh = Github(args.token)
Traceback (most recent call last):
...
```

Fixes #111374

Signed-off-by: Chris Friedt <chris@fr4.co>
2026-06-18 08:57:38 -04:00
Anas Nashif
346d415a00 scripts: ci: test_plan_v2: handle missing twister output
NamedTemporaryFile(delete=False) creates the partial output file up
front, so os.path.exists() was always true and the empty/missing-output
guard never fired. When twister errored without writing results, the
code fell through to json.load() on an empty file and crashed.

Guard against a zero-byte file and catch JSONDecodeError so a failed or
truncated twister run returns an empty suite list instead of raising.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-06-18 05:33:00 -04:00
Sreekanth Boga
fc083043ac scripts: build: gen_relocate: parse align suffix before section flags
assign_to_correct_mem_region() reads an optional per-LOCATION MPU alignment
from a numeric suffix on the memory region name (e.g. "SRAM_4" -> 4-byte
align) via memory_region.partition('_') followed by int(align_size). A
LOCATION can also carry a "|COPY" or "|NOKEEP" flag, but that flag is only
stripped later (memory_type.split("|", 1)[0]). When both are present, e.g.
"SRAM_4|COPY", the align parse runs first and int("4|COPY") raises
ValueError, aborting the build.

Split the "|COPY"/"|NOKEEP" flag off the region name before parsing the
numeric align suffix, then re-attach it so the existing NOKEEP handling and
region naming are unchanged. Behavior is identical for every existing
LOCATION; only the previously-crashing align+flag combination is fixed.

Signed-off-by: Sreekanth Boga <sreekanth@meta.com>
2026-06-18 08:03:46 +02:00
Fin Maaß
1537081212 ci: test_plan: fix _macro_to_compat
fix _macro_to_compat for compatibles, that
dont have a vendor or a separator like
"ns16550".

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-06-17 16:35:31 -04:00
Robert Lubos
731bcf72c7 lib: os: zvfs: Add additive eventfd count mechanism
Similarly to the existing CONFIG_ZVFS_OPEN_ADD_SIZE_* mechanism used to
size the file descriptor table, allow subsystems to declare their eventfd
count requirements via CONFIG_ZVFS_EVENTFD_ADD_SIZE_* Kconfig options.
These are summed up at build time and compared against
CONFIG_ZVFS_EVENTFD_MAX, with the larger of the two values used to size
the eventfd table, exposed as the ZVFS_EVENTFD_SIZE compile definition.

A new CONFIG_ZVFS_EVENTFD_IGNORE_MIN option allows to override the
calculated requirement and use CONFIG_ZVFS_EVENTFD_MAX as-is.

As each eventfd also consumes a file descriptor, the resulting eventfd
count is now reserved in the file descriptor table as well, replacing the
former CONFIG_ZVFS_OPEN_ADD_SIZE_EVENTFD option which only accounted for
CONFIG_ZVFS_EVENTFD_MAX.

The WPA supplicant requirement is moved from a CONFIG_ZVFS_EVENTFD_MAX
default into a dedicated
CONFIG_ZVFS_EVENTFD_ADD_SIZE_WIFI_NM_WPA_SUPPLICANT option.

Assisted-by: Cursor:Claude Opus 4.8
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-06-17 11:59:43 -04:00
Benjamin Cabé
67c6eb750e scripts: zspdx: assign generated files to their generating build target
Generated source files that live under the build directory (e.g.
zephyr/isr_tables.c, zephyr/misc/generated/configs.c) were being listed
under the "app" build package (the one that produces libapp.a) even
though they are not sources of libapp.a.

All build-target components share the build directory as their base_dir,
so findOwningComponent() resolved ownership purely by path prefix and
returned whichever build target happened to be iterated first ("app")
for every file under the build directory. The CMake codemodel reports
these generated files with absolute build-tree paths, so the previous
path-only search could not tell the targets apart.

Carry the build target that referenced each source through the pending
queue and let findOwningComponent() prefer that target when the file
lives under the build directory. Generated files now land in the
component that actually generates them (e.g. configs.c -> zephyr,
isr_tables.c -> zephyr_final) instead of the app package.

Also normalize non-absolute source paths joined from the codemodel so a
relative build-tree path cannot lexically alias the app sources
directory.

Fixes #108005

Assisted-by: Claude:opus-4.8
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-06-17 11:58:28 -04:00
Benjamin Cabé
7a7a95244a scripts: zspdx: migrate SBOM generation to format-agnostic model
Rework the SBOM build pipeline to populate the format-agnostic
zspdx.model and emit SPDX 2.x through SPDX2Serializer instead of the
legacy writer:

- Rewrite the walker to build an SBOMGraph of components, files and
  relationships.
- Refactor the scanner to scan the SBOMGraph.
- Route makeSPDX through the SPDX 2.x serializer.
- Remove the now-unused legacy datatypes and writer modules.

No user-visible change to the SPDX 2.x output beyond the new
generation path.

Assisted-by: Claude:opus-4.8
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-06-17 11:58:28 -04:00
Benjamin Cabé
bb46f8daab scripts: zspdx: add SPDX 2.x serializer backend
Add a format-agnostic serializer framework (zspdx.serializers) and an
SPDX 2.x tag-value serializer
(zspdx.serializers.spdx2.SPDX2Serializer) that consumes the
zspdx.model SBOMGraph. It is not yet wired into the SBOM build path;
that switch is done in a follow-up change.

Mark the legacy zspdx.writer functions as deprecated.

Assisted-by: Claude:opus-4.8
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-06-17 11:58:28 -04:00
Benjamin Cabé
3a077fca91 scripts: zspdx: introduce format-agnostic SBOM model
Add zspdx.model, a set of format-agnostic dataclasses (SBOMGraph,
SBOMDocument, SBOMComponent, SBOMFile, SBOMRelationship and the
ComponentPurpose/RelationshipType enums) meant to back both SPDX 2.x
and SPDX 3.0 serialization in later changes.

Mark the legacy SPDX 2.x structures in zspdx.datatypes as deprecated;
they are kept for backward compatibility during the migration.

Assisted-by: Claude:opus-4.8
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-06-17 11:58:28 -04:00
Anas Nashif
7d823f1d3b ci: set_assignee: apply ruff format
Run file through `ruff format` to fix style issues.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-06-17 11:58:16 -04:00
Anas Nashif
83d1ac6781 scripts: ci: set_assignees: preserve additional_reviews in overflow path
After the previous commit (_add_reviewers: fix reviewer overflow
fallback), the overflow path uses only primary_maintainers as
candidates.  This had a side effect: users in additional_reviews
(maintainers of MAINTAINERS.yml-changed areas) were silently dropped
when the PR was already at the MAX_REVIEWERS limit, because those
users live in collab (which is discarded in overflow) but not in
primary_maintainers.

People in additional_reviews are specifically chosen because they are
responsible for changed MAINTAINERS.yml areas and must be notified of
those changes; dropping them defeats the purpose of the feature.

Fix: add an extra_reviewers parameter (frozenset) to _add_reviewers.
In the overflow path the candidate list becomes:

    primary_maintainers + sorted(extra_reviewers)

deduplicated via dict.fromkeys.  In the normal path the parameter is
unused (additional_reviews is already part of collab, which serves as
the candidate list).  The same four filters (author, existing reviewer,
self-removed, collaborator status) are applied to all candidates in
both paths.

Call-site change in process_pr: the trigger condition for the reviewer
step is relaxed from 'if collab' to 'if collab or additional_reviews'
so that a PR touching only MAINTAINERS.yml (empty collab) still
notifies the area maintainers.

Assisted-by: GitHub Copilot:claude-sonnet-4.6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-06-17 11:58:16 -04:00