Commit graph

6,360 commits

Author SHA1 Message Date
Benjamin Cabé
53649a4f76 twister: harness: display_capture: remove unused fields from UVCCamera
This removes a few unused fields from the UVCCamera class.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-11-13 23:11:32 +02:00
Jamie McCrae
d884a097cd scripts: utils: Remove hwmv1 migration script
HWMv2 was introduced in v3.7, and HWMv1 support was removed in v4.2
so this script is no longer needed

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-11-13 23:09:55 +02:00
Yves Wang
c46454781a ci: compliance: update dts-linter to 0.3.6
Update dts-linter to 0.3.6 and dts-lsp to 0.6.7

Signed-off-by: Yves Wang <zhengjia.wang@nxp.com>
2025-11-11 19:47:38 +02:00
Yves Wang
14bba90725 ci: compliance: call dts linter safely under windows
subprocess run without shell requires npx shim under windows.

Signed-off-by: Yves Wang <zhengjia.wang@nxp.com>
2025-11-11 19:47:38 +02:00
Yasushi SHOJI
6d6508ae12 scripts: kconfig: gnuconfig: Ignore loc
The commit 125d0daaa1 added 'loc' to the sym.ranges tuples and fixed
kconfiglib.py but guiconfig.py is left untouched. This make menuconfig to
die with:

  Exception in Tkinter callback
  Traceback (most recent call last):
    File "/usr/lib/python3.13/tkinter/__init__.py", line 2077, in __call__
      return self.func(*args)
             ~~~~~~~~~^^^^^^^
    File ".../scripts/kconfig/guiconfig.py", line 917, in _tree_double_click
      return _tree_enter(event)
    File ".../scripts/kconfig/guiconfig.py", line 942, in _tree_enter
      _change_node(node, tree.winfo_toplevel())
      ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File ".../scripts/kconfig/guiconfig.py", line 1125, in _change_node
      s = _set_val_dialog(node, parent)
    File ".../scripts/kconfig/guiconfig.py", line 1219, in _set_val_dialog
      range_info = _range_info(sym)
    File ".../scripts/kconfig/guiconfig.py", line 1339, in _range_info
      for low, high, cond in sym.ranges:
          ^^^^^^^^^^^^^^^
  ValueError: too many values to unpack (expected 3)

This commit ignores the last element in the tuples.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2025-11-11 12:46:17 -05:00
Yasushi SHOJI
090d294ae0 scripts: kconfig: menuconfig: Ignore loc
The commit 125d0daaa1 added 'loc' to the sym.ranges tuples and fixed
kconfiglib.py but menuconfig.py is left untouched. This make menuconfig to
die with:

  Traceback (most recent call last):
    File ".../scripts/kconfig/menuconfig.py", line 3284, in <module>
      _main()
      ~~~~~^^
    File ".../scripts/kconfig/menuconfig.py", line 663, in _main
      menuconfig(standard_kconfig(__doc__))
      ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File ".../scripts/kconfig/menuconfig.py", line 732, in menuconfig
      print(curses.wrapper(_menuconfig))
            ~~~~~~~~~~~~~~^^^^^^^^^^^^^
    File "/usr/lib/python3.13/curses/__init__.py", line 94, in wrapper
      return func(stdscr, *args, **kwds)
    File ".../scripts/kconfig/menuconfig.py", line 872, in _menuconfig
      _change_node(sel_node)
      ~~~~~~~~~~~~^^^^^^^^^^
    File ".../scripts/kconfig/menuconfig.py", line 1586, in _change_node
      s, _range_info(sc))
         ~~~~~~~~~~~^^^^
    File ".../scripts/kconfig/menuconfig.py", line 3119, in _range_info
      for low, high, cond in sym.ranges:
          ^^^^^^^^^^^^^^^
  ValueError: too many values to unpack (expected 3)

This commit ignores the last element in the tuples.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2025-11-11 12:46:17 -05:00
Jordan Yates
c127388eaf scripts: build: mergehex: fix --output-bin
Stop `--output-bin` from consuming the first trailing argument that
should have been in `input_files`.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-11-07 19:23:26 +02:00
Abderrahmane JARMOUNI
5be6aa13b9 scripts: pylib: twister: expr_parser: some enhancements
Rename dt_node_prop_enabled filtering expression to
dt_nodelabel_prop_enabled as it takes a node label as a 1st argument.

Enhance dt_node_has_prop inline doc and param name.

Signed-off-by: Abderrahmane JARMOUNI <git@jarmouni.me>
2025-11-06 15:49:28 +02:00
Mathieu Choplain
f36f8d4fb9 runners: stlink_gdbserver: expose --external-init as runner argument
3cc9a843e8 added '--external-init' to the GDB
Server command line whenever an external loader is provided, but it is not
a *necessary* argument and sometimes causes issues.

Provide a new runner argument "--external-init" (for consistency) which
controls whether or not the argument is added to command line if an
external loader is used. (It is otherwise ignored)

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2025-11-04 13:50:56 -05:00
Mathieu Choplain
f890286d8e runners: stlink_gdbserver: make it possible to disable SWD mode
The "--swd" argument had both an action='store_true' and default value of
True so it wasn't possible to disable it: providing the argument would set
its value to True, and not providing it would use the default=True!

Add a new argument "--no-swd" which shares its destination variable with
"--swd", but with action='store_false', such that either can be provided
to enable/disable SWD mode. Both arguments are placed in a mutually
exclusive group and use a common help message.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2025-11-04 13:50:56 -05:00
David Leach
01e3b167af west: blobs: fix UnicodeDecodeError on Windows
Ensure the blobs command is trying to display the license file for
click-through approval. Ensure that special characters doesn't
cause a problem in Windows by opening the file with utf-8 encoding.

Fixes #98520

Signed-off-by: David Leach <david.leach@nxp.com>
2025-11-04 07:06:08 -05:00
Chris Friedt
e4d193b5ed scripts: coccinelle: add fork as a reserved name
`fork()` is defined by POSIX and for creating a new child process.

It is the preferred method of doing so on systems with virtual memory and
the symbol should not be used outside of the context defined by the
POSIX standard.

https://pubs.opengroup.org/onlinepubs/9699919799/functions/fork.html

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-11-01 08:39:26 -04:00
Kyle Bonnici
d18c4db7f1 CI: dts-linter: Move package.json to ./scripts/ci
Move package.json and package-lock.json to ./scripts/ci

Signed-off-by: Kyle Bonnici <kylebonnici@hotmail.com>
2025-10-31 22:40:20 +02:00
Benjamin Cabé
1e8a5f7dd0 doc: twister: add/move doc for display harness
The display harness initial documentation was a separate, stale (had
references to a personal Github repo), README.rst buried in the
twister/scripts folder.
Move the docs to be a "first class" part of the Twister documentation
alongside other harnesses.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-10-31 10:36:57 -04:00
Pieter De Gendt
ed92ee5064 scripts: Bump ruff to 0.14.2
Update the ruff version to the latest 0.14.2 and update the excluded files
to match with the last checks for linter and formatting issues.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-10-30 15:16:25 +02:00
Carles Cufi
093bb9972c scripts: compliance: Harden the execution of npx
Instead of relying on various exceptions that can happen when one tries
to execute a program that is not installed in the system (typically
FileNotFoundError but sometimes PermissionError), use shutil.which() to
ensure the npx executable is available before running it.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2025-10-30 15:13:53 +02:00
WenBin Zhang
a43f48b15e twister: Enhanced Filtering Command Help
Collect filter commands into a single location and sort them in the
order: arch, vendor, platform, pattern, filter, tag. This enhances
the readability of help information and reduces the time spent
searching for filter command options.

Signed-off-by: WenBin Zhang <freey7955@gmail.com>
2025-10-28 20:27:20 -04:00
WenBin Zhang
30e5ea8eea twister: Enhanced device-testing Command Help
Collect device-testing commands into a single location to enhance
readability of help information and reduce the time spent
locating device-testing options.

Signed-off-by: WenBin Zhang <freey7955@gmail.com>
2025-10-28 20:27:20 -04:00
Thorsten Klein
d58bc085bd scripts: west_commands: rework run_tests.py
reworked run_tests.py script:
- removed obsolete arguments from commands called by this script
- avoid code duplication by using a for-loop

Signed-off-by: Thorsten Klein <thorsten.klein@bshg.com>
2025-10-28 20:22:55 -04:00
Thorsten Klein
54ebd72ed9 scripts: west_commands: add pyproject.toml file
added pyproject.toml config file which allows to set paths for tools
like mypy or pytest. With this config file it becomes possible to
directly run those tools in a local zephyr tree.

Signed-off-by: Thorsten Klein <thorsten.klein@bshg.com>
2025-10-28 20:22:55 -04:00
Jamie McCrae
396466ed17 scripts: snippets: Update to use jsonschema instead of pykwalify
Updates the schema and script to use jsonschema

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-10-28 17:43:02 +02:00
Kyle Bonnici
c581297f2c Compliance check: no dts-linter installed
This PR fixes incorrect error message when dts-linter is not installed
and provide a proper message instead of:

`Failed to parse dts-linter JSON output: ...`

Signed-off-by: Kyle Bonnici <kylebonnici@hotmail.com>
2025-10-28 11:50:44 +02:00
Jamie McCrae
603e4df64d scripts: ci: check_compliance: Fix not checking CMakeLists.txt files
Fixes an oversight of only checking files that are exactly named
CMakeLists.txt - this includes the directory name, so that it
actually checks any file in the tree with this name

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-10-28 11:49:12 +02:00
Abderrahmane JARMOUNI
3cc9a843e8 scripts: west runners: ST-LINK GDB Server: add external-init cmd
When debugging boards with external Flash, to make it accessible for
read and write by the debugger, we need the --external-init option
together with --extload <file_path> option.
It allows the ST-LINK GDB server to make external memory accessible
after reset without any need for the app to set it up.
The external memory must be memory mapped and directly accessed because
normal memory read/write is used by gdb.

Signed-off-by: Abderrahmane JARMOUNI <git@jarmouni.me>
2025-10-25 10:46:38 +03:00
Henrik Brix Andersen
58a334f2f9 scripts: pylib: twister: hardwaremap: add Tigard support
Add support for the Tigard multi-protocol hardware hacking tool from
SecuringHardware.com.

More information available at https://github.com/tigard-tools/tigard

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2025-10-24 20:17:04 -04:00
BUDKE Gerson Fernando
6334838cdb scripts: build: mergehex: Add --output-bin parameter
The optional --output-bin parameter instructs the IntelHex class to
save the content as a binary file instead of the Intel Hex format.

Signed-off-by: BUDKE Gerson Fernando <gerson.budke@leica-geosystems.com>
2025-10-24 13:27:24 -04:00
Thorsten Klein
5ee522efc0 scripts: west_commands: added tests for config build.dir-fmt
Tests are added for different build.dir-fmt format string arguments.

Signed-off-by: Thorsten Klein <thorsten.klein@bshg.com>
2025-10-24 13:26:37 -04:00
Thorsten Klein
122edfef5b scripts: west_commands: extend build.dir-fmt format args
build.dir-fmt format string arguments are extended. New format args are
'west_topdir' (absolute path to the west workspace directory) and
'source_dir_workspace' (relative path of the source directory to
west_topdir).

Signed-off-by: Thorsten Klein <thorsten.klein@bshg.com>
2025-10-24 13:26:37 -04:00
Jordan Yates
dbb45ddd18 scripts: checkpatch.pl: relax Missing a blank line
Relax the `Missing a blank line after declarations` checkpatch error by
loosening the requirements for a macro to be treated as one that
declared a variable.

Currently the regex matches the pattern `DECLARE` or `DEFINE`, as long
as there are between 1 and 6 trailing `_FOO` components to the macro
name (e.g. `DECLARE_MY_TYPE()`). Zephyr however contains many macros
that don't have the trailing components but still resolve to variables
(e.g. `ATOMIC_DEFINE`, `K_MUTEX_DEFINE, etc`).

By changing `{1,6}` to `{0,6}`, we remove the requirement for the
trailing `_FOO` component(s) while still allowing them. This stops
checkpatch from erroring on patterns like this:
```
struct driver_data {
	uint16_t some_value;
	ATOMIC_DEFINE(some_atomic, 16);
};
```

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-10-24 13:26:04 -04:00
WenBin Zhang
47855127a0 script: west: completion: add missing west completion for zsh
this path only provides autocompletion for the `west` command
itself, not for its subcommands. (i.e. `west [tab]` rather than
`west packages [tab]`). However, it remains highly userful,
significantly reducing typing time and errors when using longer
commands like `west packages`.

Signed-off-by: WenBin Zhang <freey7955@gmail.com>
2025-10-24 13:18:52 -04:00
WenBin Zhang
84a53e5ecc script: west: completion: add missing west completion for fish
this path only provides autocompletion for the `west` command
itself, not for its subcommands. (i.e. `west [tab]` rather than
`west packages [tab]`). However, it remains highly userful,
significantly reducing typing time and errors when using longer
commands like `west packages`.

Signed-off-by: WenBin Zhang <freey7955@gmail.com>
2025-10-24 13:18:52 -04:00
WenBin Zhang
fe3a02d234 script: west: completion: add missing west completion for bash
this path only provides autocompletion for the `west` command
itself, not for its subcommands. (i.e. `west [tab]` rather than
`west packages [tab]`). However, it remains highly userful,
significantly reducing typing time and errors when using longer
commands like `west packages`.

Signed-off-by: WenBin Zhang <freey7955@gmail.com>
2025-10-24 13:18:52 -04:00
Anas Nashif
6ea5f0abd7 twister: prefer 'fork' on POSIX to maintain pre-3.14 behavior
multiprocessing no longer defaults to fork, so force it to maintain pre
3.14 behavior. We will need to revisit the implementation and at some
point move to forkserver

Fixes #95058

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-10-24 08:59:30 -07:00
Carles Cufi
0679c05712 scripts: runners: nrfutil: Add a new --dry-run parameter
In order to allow for users to invoke "west flash" without actual
hardware connected but still running the logic and pregeneration of
commands, specifically the json file.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2025-10-24 08:59:13 -07:00
Carles Cufi
146fd2c88e scripts: runners: nrf: Generalize the use of --erase-mode for all ICs
Until now, for historical reasons (see
f42cef9c81 and
58e0e31c7e), the use of the --erase-mode
command-line switch was reserved for the nRF54L family. But in fact this
can be used (instead of --erase) for any of the Nordic ICs. This patch
extends the usage of this switch regardless of family.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2025-10-24 08:59:13 -07:00
Luca Burelli
338a8b1e48 west: bindesc: add extract subcommand
Add a new 'west bindesc extract' subcommand that dumps all binary
descriptors into a separate binary file. It will also report the range
(offset and length) of the dumped data within the original image.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-10-24 09:43:40 +03:00
Kyle Micallef Bonnici
1dc7eb995d CI: devicetree: linting to check_compliance.py
Use dts-linter to check each touched file in PR

Signed-off-by: Kyle Micallef Bonnici <kylebonnici@hotmail.com>
2025-10-23 16:04:38 -04:00
Nilesh Vyas
9ca3cad57d script: footprint: Improve C++ static variable reporting
Enhance the `size_report` script to correctly categorize static C++
variables in the memory report.

Static C++ variables are currently listed under the "No paths"
category in the size report. This occurs because the script's
address-based mapping logic is designed for functions, which
occupy an address range, but fails to handle variables that
have only a single memory address.

This commit improves the `do_address_range_matching` function
to handle single-address mappings. The updated logic now correctly
identifies and assigns static C++ variables to their corresponding
source file paths in the report tree, providing a more accurate and
comprehensive memory footprint analysis for C++ applications.

This enhancement ensures that all symbols, regardless of their
linkage or type, are correctly placed in the report, providing a
more accurate overview of memory usage.

Signed-off-by: Nilesh Vyas <nileshvyas1112@gmail.com>
2025-10-23 16:02:23 -04:00
Keith Short
028cf7f3d9 twister: fix environment:os tag
Set the environment:os tag to the return value of platform.system(),
which is more useful than os.name() which always returns "posix".

Signed-off-by: Keith Short <keithshort@google.com>
2025-10-23 15:59:41 -04:00
Andreas Kurz
0b5b6b827e native_simulator: Get latest from upstream
Align with native_simulator's upstream main
95f560a2140aacb03a74b8c933f3b27a59c56d50

Which includes:
95f560a: nct: fix possible redefinition of GNU_SOURCE

Signed-off-by: Andreas Kurz <info@akurz.net>
2025-10-23 18:08:14 +02:00
Luca Burelli
e4fa6a8f61 traceconfig: add target to export value origin traces to Markdown
The new 'traceconfig' target generates a Markdown file listing all
configuration symbols, their values, and where those values originated
(user assignment, default, selection, implication, or unset).

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-10-22 18:34:49 +03:00
Luca Burelli
bce4b9af4f kconfig: collect and save trace data
Collect and save trace data for all symbols in the merged configuration.
This includes information about where each symbol was defined or
assigned, which can be useful for debugging complex Kconfig setups.

The trace data includes the following information for each symbol:
- Name
- Visibility
- Type
- Value
- Kind and location of value origin (as defined in kconfiglib)

The trace data is saved for later use in two formats: a binary pickle
file and a human-readable JSON file.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-10-22 18:34:49 +03:00
Luca Burelli
5d2c97d3c1 kconfiglib: track origin for symbol values
Track information about what caused a value to be set in the 'origin'
property of Symbol. 'imply' and 'select' dependencies do not have a
location associated with them, so in those cases the location is
a string representation of the dependency expression. For defaults and
user values, the location in the Kconfig file is stored.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-10-22 18:34:49 +03:00
Luca Burelli
125d0daaa1 kconfiglib: add 'loc' to reverse dependencies
Store the location (filename and line number) where a 'select', 'imply',
'range' or 'default' was added to a Symbol or Choice.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-10-22 18:34:49 +03:00
Luca Burelli
45bea950a2 kconfiglib: add 'user_loc' to Symbol and Choice classes
The 'user_loc' stores the location (filename and line number) where a
symbol or choice was last set via a direct user selection.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-10-22 18:34:49 +03:00
Luca Burelli
9d842ab955 kconfiglib: refactor Kconfig._warn() to use 'loc'
Replace filename and linenr parameters to _warn() with a single loc
element, which is a constant (filename, linenr) tuple that can be more
efficiently passed and stored.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-10-22 18:34:49 +03:00
Luca Burelli
1337f839cd kconfiglib: node: add 'loc' attribute
Replace 'filename' and 'linenr' usages with a single 'loc' attribute,
which is a (filename, linenr) tuple. This simplifies code dealing with
locations, and makes it explicitly constant. The original attributes are
now provided via properties for compatibility.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-10-22 18:34:49 +03:00
Pieter De Gendt
ef7c370187 scripts: west_commands: runners: Replace ToggleAction
Replaces the custom ToggleAction with the argparse.BooleanOptionalAction.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-10-22 18:33:01 +03:00
Pieter De Gendt
e2b3d2a893 scripts: west_commands: sign: Replace ToggleAction
Replaces the custom ToggleAction with the argparse.BooleanOptionalAction.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-10-22 18:33:01 +03:00
Pieter De Gendt
5709b55875 scripts: west_commands: Convert sysbuild argument to BooleanOptionalAction
Instead of using a mutually exclusive group for sysbuild/no-sysbuild
argparse arguments, use the argparse.BooleanOptionalAction to allow passing
multiple arguments, where the last one is applied.

This is consistent with for example gcc compiler flags.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-10-22 15:55:21 +03:00