Commit graph

6,360 commits

Author SHA1 Message Date
Mathieu Choplain
f2e5148dc1 scripts: build: llext: move ELF utilities to dedicated script
Move ELF-related utilities from the "llext_prepare_exptab" script to a
dedicated "llext_elf_toolkit" which can be reused by other LLEXT scripts.
While at it, also improve documentation of class SectionDescriptor.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-01-29 13:42:56 +01:00
Fin Maaß
0247086963 Kconfig: dt: add dt_node_array_prop_has_val
add dt_node_array_prop_has_val function and
extend dt_nodelabel_array_prop_has_val to be
used with string-arrays.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-01-29 13:38:01 +01:00
Jamie McCrae
27a91104c6 scripts: kconfig: Fix dt_chosen_partition_addr function
Fixes this function so that it returns the unit address of the
node, without having to rely on odd tricks to locate various parent
nodes and check that they have reg addresses and perform additions

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-01-28 10:18:57 +01:00
Benjamin Cabé
1025dcc634 scripts: edtlib: preserve hexadecimal notation for integer values
When YAML binding files specify values in hexadecimal notation, this
information was previously lost during parsing as PyYAML converts hex to
regular integers.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-01-28 08:30:32 +01:00
TOKITA Hiroshi
724c35c871 scripts: dts: devicetree: tests: Add a map property test
Add a map property test for `test_edtlib.py`.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2026-01-28 08:29:57 +01:00
TOKITA Hiroshi
5979e40d32 scripts: dts: Add handling for *-map property
This change introduces generating definitions corresponding to
`*-map` property, which was currently discarded.

For `*-map` properties are made able to be treated as a variation
of phandle-array, assign sequential cell names for each group of
specifiers (child_specifier_0, child_specifier_1, ...,
parent_specifier_0, ...).

The `*-map` data is like a two-dimensional array, so it is difficult to
handle with the existing APIs, so we will also provide new APIs.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2026-01-28 08:29:57 +01:00
Benjamin Cabé
9cfb6f50bc scripts: ci: refresh requirements-actions.txt pinned versions and SHAs
Refresh pinned dependencies to pick up security updates for:

- pyasn1
- filelock
- virtualenv
- pynacl
- urllib3

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-01-27 08:38:24 -05:00
Guðni Már Gilbert
6b9177f750 scripts: snippets: update typing for Python 3.10+
Automatically done using :
pyupgrade --py310-plus scripts/snippets.py

Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
2026-01-27 10:54:26 +00:00
Guðni Már Gilbert
902a8c5700 scripts: snippets: optimize parsing performance
1. Load and validate the schema only once
2. Use CSafeLoader if it's available
3. Read YAML files in binary mode

This reduces the execution time of snippets.py from ~380ms
down to ~160ms when I build samples/basic/blinky for
nrf52dk/nrf52832

Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
2026-01-27 10:54:26 +00:00
Torsten Rasmussen
a0983a2f91 cmake: align board qualifiers in CMake with Kconfig
The value os board qualifiers in CMake and Kconfig differs.
CMake has a leading '/', as example:
CMake:   BOARD_QUALIFIERS=/nrf52840
Kconfig: BOARD_QUALIFIERS=nrf52840

This was also discussed in
https://github.com/zephyrproject-rtos/zephyr/pull/69740

This commit aligns the value of the CMake variable BOARD_QUALIFIERS to
the value of BOARD_QUALIFIERS (CONFIG_BOARD_QUALIFIERS) in Kconfig.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2026-01-27 10:52:37 +00:00
Sylvio Alves
e5a2574eca runners: openocd: migrate to standard --file/--file-type interface
Align the OpenOCD runner with the JLink runner by adopting the
framework's standard file selection mechanism:

- Add file=True to RunnerCaps to enable --file and --file-type args
- Deprecate --use-hex, --use-elf, --use-bin flags (still work with
  warning)
- Use FileType enum instead of string comparisons
- Support --file for custom file paths (like JLink)
- Store hex_name and bin_name alongside elf_name for consistency

Also remove the framework constraint that --file-type requires --file,
allowing boards to specify a preferred file format via board.cmake
without providing a custom file path.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-01-27 08:08:19 +01:00
Pieter De Gendt
c1e2b83180 scripts: dts: gen_driver_kconfig_dts.py: Format and fix linter issue
Run ruff formatter and linter on the script file and remove exclusions.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2026-01-27 08:06:39 +01:00
Sharon Lin
5d56e00bfb scripts: twister: fix codec cp950 error when running on Windows
When running twister on Windows host, the build will fail from
cmakecache.py with error as:
UnicodeDecodeError: 'cp950' codec can't decode byte 0xe2 in
position 3444: illegal multibyte sequence

Signed-off-by: Sharon Lin <slin@atmosic.com>
2026-01-27 08:05:16 +01:00
Guðni Már Gilbert
e3575fc848 scripts: twister: fix issue with empty serial in hwmap
jsonschema is more strict when it comes to typing and only allows
strings for 'serial' in hwmap-schema.yaml.

Since 'serial' is not a required key in the schema, this commit
removes the 'serial' key from generated hardware maps when the
'serial' value is empty /unknown.

Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
2026-01-26 10:11:35 -06:00
Guðni Már Gilbert
e9f106dd7a twister: replace pykwalify with jsonschema
Usage of pykwalify is deprecated.

Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
2026-01-26 10:11:35 -06:00
Pieter De Gendt
4e62f0510c scripts: ci: check_compliance.py: Add DT_HAS_ to exceptions
The docs refer to an non-existing config option, add it to the checklist.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2026-01-26 08:48:15 -05:00
Fin Maaß
c42538600f scripts: Refactor dt_compat_any_has_prop
Refactor dt_compat_any_has_prop
to reduce its Cognitive Complexity.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-01-26 14:15:18 +01:00
Fin Maaß
3bffe47e3d scripts: Add dt_compat_all_has_prop
Add the dt_compat_all_has_prop
kconfig preprocessor function, simillar to
dt_compat_any_has_prop.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-01-26 14:15:18 +01:00
Fin Maaß
8f23fdc743 scripts: Add list array support for dt_compat_any_has_prop
Add support for arrays and string-arrays to
dt_compat_any_has_prop
kconfig preprocessor function.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-01-26 14:15:18 +01:00
Benjamin Cabé
21dcbfeb24 ci: doc: workflows: Add CI for Doxygen coverage delta analysis
This add a new script and hooks it up into the existing doc workflow so
that we can make documentation build fail if new API is added without
proper documentation coverage for it.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-01-25 14:39:53 +01:00
Peter Mitsis
3944b0cfc7 kernel: Extend thread user_options to 16 bits
Upgrades the thread user_options to 16 bits from an 8-bit value to
provide more space for future values.

Also, as the size of this field has changed, the values for the
existing architecture specific thread options have also shifted
from the upper end of the old 8-bit field, to the upper end of
the new 16-bit field.

Fixes #101034

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2026-01-22 08:40:17 +00:00
Grzegorz Chwierut
efc36d96d3 twister: refactor DUT class to dataclass for serialization support
Convert the DUT class from a traditional class to a dataclass to enable
proper serialization and support for future multi-device testing with
pytest-harness.

Key changes:
- Migrated DUT class to use `dataclass` decorator with proper type hints
- Renamed `baud` property to `serial_baud` for consistency
- Updated hardware map schema to support both `baud` (legacy) and
`serial_baud` fields for backward compatibility
- Updated tests

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2026-01-21 17:06:36 +01:00
James Roy
6524e670b3 edtlib: Fix the accidental merging of examples in the binding
Fix the example nodes in the examples block being accidentally
merged and overwritten during build.

Signed-off-by: James Roy <rruuaanng@outlook.com>
2026-01-21 17:05:41 +01:00
Guðni Már Gilbert
284a30053f scripts: twister: don't parse west modules in TestPlan
TwisterEnv already parses west modules during initialization, but TestPlan
was parsing them again via zephyr_module.parse_modules(), duplicating work.

Store the parsed module objects on TwisterEnv (self.modules) and have
TestPlan derive its module name list from env.modules instead. This drops
the redundant parse in TestPlan by removing handle_modules() and its call
site.

Each call to parse_modules() takes around 250-300ms on my end.

Update twister unit tests

Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
2026-01-20 20:04:37 -05:00
Guðni Már Gilbert
e19ebfb49a scripts: twister: use os.scandir for platform YAML discovery
Use a single os.scandir() pass per board directory to load twister.yaml
and collect legacy *.yaml files, replacing Path checks and globbing.

On my end this reduces execution time by ~50ms on Ubuntu 24.04 and
eliminates  ~80k Python function calls.

Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
2026-01-20 14:35:03 -05:00
Grzegorz Chwierut
f8e4c6cf6a twister: pytest: Fix post-script calling in initialization phase
The post-script was being called multiple times and during the
initialization phase when it should only run after the reader
thread has started and the device testing is complete.

Fixes #102386

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2026-01-20 14:34:54 -05:00
Lukasz Fundakowski
c5bc1a9779 twister: fix access to item in empty list
Fixed default argument in run_cmake_script method,
which cannot be an empty list.

Signed-off-by: Lukasz Fundakowski <lukasz.fundakowski@nordicsemi.no>
2026-01-20 14:34:05 -05:00
Grzegorz Chwierut
3881d4bad7 scripts: west: Fix sysbuild overwrite by test item parameter
When sysbuild is enabled globally and running west build with a
selected test scenario, the sysbuild setting was being overwritten
with False when sysbuild was not explicitly set in the test YAML file.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2026-01-20 15:33:30 +00:00
Grzegorz Chwierut
5d73bc00ca twister: fix --list-tests output, remove duplication in names
This fixes the issue where --list-tests and --test-tree commands
showed duplicated testsuite IDs in the output,
simplifies testcase name handling in harness and runner modules.
Removed feature to extend behaviour of --no-detailed-test-id to shorten
test case names - feature was introduced in #82302.
This makes the twister output more predictable and the codebase easier
to maintain.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2026-01-20 15:30:44 +00:00
Jamie McCrae
ac348a7ab5 scripts: dts: gen_dts_cmake: Output compatibles for no prop. nodes
Seemingly partitions (fixed-partitions) have no properties when
the edt file is loaded, work around this issue by outputting
compatibles for nodes that have them but have no properties, also
fixes some other outputs for misc. devices

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-01-20 15:30:18 +00:00
Jamie McCrae
7a18e3a8cc scripts: dts: gen_dts_cmake: Add DT_UNIT_ADDR to pickled CMake
Adds a new property which outputs the absolute address of a dts
device (if it is available) which will take the parent nodes into
consideration without a user having to manually trawl through
devices (which is error prone depending upon how they are layered)

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-01-20 13:22:53 +00:00
Jamie McCrae
a7e099f20b scripts: Update to use SOC_SERIES_NRF Kconfigs without X suffix
Updates usage of the old Kconfig to use the new Kconfig

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-01-20 13:21:38 +00:00
Jamie McCrae
03e8e88d79 soc: nordic: Add SOC_SERIES_NRF* Kconfigs without X suffix
This is to start the process of fixing the issue of the SoC series
not matching the value in the soc.yml file, which is needed to
support future build system features for automatically creating
SoC Kconfigs by the build system.
This also fixes some oddities with how the Kconfigs were set out,
which included duplicated Kconfigs and duplicate selections and
having them in the wrong (or differing) files, to actually follow
how HWMv2 should define these Kconfigs.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-01-20 13:21:38 +00:00
Malon Tian
16ffda989b scripts: west: fix typos and formatting in sdk help message
Specific fixes include:
- Add missing space after period in the disk space warning.
- Fix mismatched quotes in the --install-base example (usage of `...').
- Removed a typo double quote in the installation description.

This addresses the CLI help message issues reported.

Fixes #95609

Signed-off-by: Malon Tian <a3205153416@gmail.com>
2026-01-16 18:08:24 +01:00
Thorsten Klein
de18a52a20 scripts: west_commands: tests: test_build: add tests for west build args
Add tests to ensure 'west build' arguments are correctly forwarded to
CMake in the correct order.

Signed-off-by: Thorsten Klein <thorsten.klein@bshg.com>
2026-01-16 18:05:26 +01:00
Thorsten Klein
fe13def7a5 scripts: west_commands: build: support cmake arguments via --cmake-opt
Support cmake options specified via argument --cmake-opt, in order to
avoid `--` in alias commands.

Signed-off-by: Thorsten Klein <thorsten.klein@bshg.com>
2026-01-16 18:05:26 +01:00
Thorsten Klein
47db2c6522 scripts: west_commands: build: remove shadowed function argument
Remove _run_cmake argument 'cmake_opts' which is never used and shadowed
by a local variable.

Signed-off-by: Thorsten Klein <thorsten.klein@bshg.com>
2026-01-16 18:05:26 +01:00
Bjarki Arge Andreasen
547d0ffe25 scripts: checkpatch: extend has_arg_concat to include CONCAT()
The has_arg_concat check checks for ## and UTIL_CAT, but is missing
the CONCAT macro. This is causing spurious occurances of
MACRO_WITH_FLOW_CONTROL warnings for functions defined with macros
if they use the CONCAT() macro (its like UTIL_CAT but supports up
to 10 concatenations).

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2026-01-16 11:39:41 +00:00
Nikita Divakov
b807da4f56 scripts: gen_relocate_app.py: add quotes around section names in templates
Section names may contain paths to files with special characters.
For example, a valid file path might contain '@'. Then using
CONFIG_CODE_DATA_RELOCATION to relocate section, macro
__in_section_unique() will generate section name like this:

KEEP(*file.c.obj(.noinit.WEST_TOPDIR/path_with@char/file.c.0))

Such section names cannot be processed by ld because '@'
is a special character for ld.

This fix wraps section names in double quotes to escape
special characters for ld.

Signed-off-by: Nikita Divakov <grommerin@gmail.com>
2026-01-15 16:40:39 +00:00
Sylvio Alves
85e1ea0259 runners: openocd: refactor flash methods into single do_flash
Add _openocd_cmd() helper method to reduce code duplication when
building openocd command lists. Consolidate do_flash, do_flash_elf,
and do_flash_bin into a single do_flash method using match statement
on image_type parameter.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-01-14 13:05:34 -06:00
Sylvio Alves
2ba21af69d runners: openocd: add BIN file flash support
Add --use-bin and --flash-address arguments to allow flashing BIN
files at a specific address. This is needed for targets like ESP32
where HEX files contain virtual addresses (due to MMU mapping)
rather than physical flash addresses.

The new do_flash_bin() method uses the load command with the BIN
file path and flash address, similar to how ELF flashing works.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-01-14 13:05:34 -06:00
Mohamed Moawad
7fb39e806c twister: Add board-level flash_before support for pytest/shell harnesses
Add support for boards to specify flash_before in their board YAML files,
which is then used by pytest and shell harnesses. This is needed for
Synopsys ARC development boards (hsdk, hsdk/arc_hsdk/2cores, hsdk4xd
and iotdk) where the USB serial port disconnects during flashing.

Signed-off-by: Mohamed Moawad <moawad@synopsys.com>
2026-01-14 13:00:22 -06:00
Guðni Már Gilbert
6bb7a1b54b scripts: twister: Add full_name to board.yml
Fixes regression introduced by e45ac11aeb9b874038a2925c2588b94100aa28cc

Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
2026-01-13 09:33:35 -05:00
Jamie McCrae
c1a4c78c5c scripts: snippets: Add support for board revisions
Allows snippets to specify additional files for specific revisions
of boards

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-01-13 13:30:38 +01:00
Nakul Chauhan
a7cea5d58a native_simulator: Get latest from upstream
Align with native_simulator's upstream main
215ee859eee5e49dc09eda8f17a956ee7318caf2

Which includes:
215ee85: native timer_model: Fix printf format specifier warnings w
         debug logs

Signed-off-by: Nakul Chauhan <nakulchauhan111@gmail.com>
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-01-13 10:29:44 +01:00
Tom Burdick
769ac1b112 ci: Drop preemptible||preemptable spellcheck
Preemptable and preemptible are both commonly used spellings. Infineon
had chosen preemptable as the spelling and lead to CI failures when
using struct members in the PDL. Removing the check in Zephyr allows
for flexibility in spellings of this word.

Signed-off-by: Tom Burdick <thomas.burdick@infineon.com>
2026-01-13 10:25:26 +01:00
Tom Burdick
c97ccba142 twister: Support kitprog when generating hw map
Hardware map file generation should at least get you part way now with
Infineon boards with the Cypress derived KitProg3.

Signed-off-by: Tom Burdick <thomas.burdick@infineon.com>
2026-01-13 10:24:30 +01:00
Ederson de Souza
e53da36164 samples: tfm_integration: tfm_secure_partition: Support SFN backend
When support for old "Library model" was removed, support for the new
Secure Function (SFN) model - the FF-M 1.1 spec that succeded the "Library
model" - wasn't implemented. This patch adds it.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2026-01-09 17:08:56 -06:00
Lauren Murphy
69ce125083 twister, west: test extra_conf_files arg to EXTRA_CONF_FILE
The extra_conf_files arg in testcase.yaml was being improperly
assigned to the CONF_FILE CMake arg, which caused
configuration_files.cmake to ignore soc and board Kconfig overlays.

Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
2026-01-09 14:22:41 -06:00
Benjamin Cabé
901d21e454 scripts: schemas: make full_name a required property for boards
When initially introduced, the property was kept optional in an attempt
to not risk disrupting downstream users by introducing a required property
they wouldn't necessarily care about. In practice, this is causing
boards contributed upstream to sometimes miss this propery which is
important for boards to show up nicely in the boards catalog, and it is
therefore being made required.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-01-09 07:56:40 -06:00