Commit graph

5548 commits

Author SHA1 Message Date
Pieter De Gendt
0a0e691750 scripts: west_commands: zspdx: cmakecache: Fix linter issue
Fix redundant open mode.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-06-02 20:22:51 +02:00
Pieter De Gendt
62ea066794 scripts: west_commands: simulate: Fix linter issues
Fix issues reported by ruff.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-05-31 06:54:39 -04:00
Pieter De Gendt
b9fb5d79e4 scripts: west_commands: robot: Fix linter issues
Fix issues reported by ruff.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-05-31 06:54:39 -04:00
Pieter De Gendt
359a0c2809 scripts: west_commands: flash: Fix linter issues
Fix issues reported by ruff.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-05-31 06:54:39 -04:00
Pieter De Gendt
5321c14628 scripts: west_commands: debug: Fix linter issues
Fix issues reported by ruff.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-05-31 06:54:39 -04:00
Pieter De Gendt
d9d4daa940 scripts: west_commands: build_helpers: Fix linter issues
Fix issues reported by ruff.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-05-31 06:54:39 -04:00
Pieter De Gendt
166fd3e506 scripts: west_commands: build: Fix linter issues
Fix issues reported by ruff.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-05-31 06:54:39 -04:00
Anas Nashif
e9451b7294 actions: update python requirements
Lower version of elasticsearch to match the server version we are using.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-05-29 23:25:10 +02:00
Yangbo Lu
600cae64c2 scripts: blobs: add auto-accept option for license click-through
Added auto-accept option for license click-through.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-05-29 10:46:56 +02:00
Fin Maaß
f7153012ef dts: enum_macros: make sure that they are lowercase
DT_ENUM_HAS_VALUE_BY_IDX states, that the value
must be lowercase-and-underscores, this makes sure,
that they can match.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-05-28 17:48:57 +02:00
Benjamin Cabé
804915841a shields: doc: allow to indicate supported hw features
Shield authors can now indicate an optional list of hardware features
that the shield supports, in the form of the same kind of "binding type"
already used for boards.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-05-28 15:33:50 +02:00
Pieter De Gendt
432db03003 scripts: requirements-actions: Update packages
Update packages installed by GH actions.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-05-28 15:32:33 +02:00
Pieter De Gendt
3c234b4ecb scripts: Update ruff and generate excludes
Update to the latest version of ruff and generate linter and format
exclusions for current python files in tree.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-05-28 15:32:33 +02:00
Pieter De Gendt
8e2e319925 scripts: west_commands: export: Sorted imports
Sort imports with ruff.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-05-28 11:13:51 +02:00
Pieter De Gendt
476a8c2c39 scripts: west_commands: completion: Fix linter issues
Fix issues reported by ruff.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-05-28 11:13:51 +02:00
Pieter De Gendt
eba120384a scripts: west_commands: blobs: Fix linter issues
Fix issues reported by ruff.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-05-28 11:13:51 +02:00
Pieter De Gendt
0c18197325 scripts: west_commands: bindesc: Fix linter issues
Fix issues reported by ruff.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-05-28 11:13:51 +02:00
Noah Pendleton
7f1a639327 west: blobs: fetch exit immediately on HTTP error
If an HTTP error occurs during `west blobs fetch`, the response was written
to a file (even if the response body is empty), and then the checksum
validation fails, which can be somewhat confusing.

Add an immediate error message and exit-with-error-code when the HTTP
request fails.

Tested by modify a blob manifest to have an invalid URL:

```bash
# test with invalid URL
❯ west blobs fetch nrf_wifi
Fetching blob nrf_wifi: .../wifi_fw_bins/default/nrf70.bin
ERROR: HTTP error occurred: 404 Client Error: Not Found for url: ...

# test with networking disabled
❯ west blobs fetch nrf_wifi
Fetching blob nrf_wifi: .../wifi_fw_bins/default/nrf70.bin
ERROR: An error occurred: HTTPSConnectionPool(host='git.... \
  Max retries exceeded with url: \
  .../zzzz/nrf_wifi/bin/zephyr/default/nrf70.bin
...
```

Signed-off-by: Noah Pendleton <noah.pendleton@gmail.com>
2025-05-28 11:09:54 +02:00
Grzegorz Chwierut
632d006260 twister: Convert platform names before printing
Just move a code with workaroud to convert platform names
to the full name with variants.
It fixes an issue, that not every platforms are printed
before running tests.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2025-05-27 17:55:46 +02:00
Camille BAUD
75972e0e21 tests: west_runners: Add bflb_mcu_tool to import test
Adds bflb_mcu_tool to import test

Signed-off-by: Camille BAUD <mail@massdriver.space>
2025-05-26 09:19:26 +02:00
Camille BAUD
fb937beb62 scripts: runners: Introduce bflb_mcu_tool runner
Introduces one of the official flash tools for bouffalolab platforms.

Co-authored-by: Gerson Fernando Budke <nandojve@gmail.com>
Signed-off-by: Camille BAUD <mail@massdriver.space>
2025-05-26 09:19:26 +02:00
Benjamin Cabé
df01afa8c6 scripts: west: commands: make use of shield.yml in west shields command
This change introduces the use of shield.yml in the `west shields`
command so that when using the `-f` option one can output the shields'
full name and vendor information.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-05-23 17:19:58 +02:00
Benjamin Cabé
3a62b17b85 cmake: shields: introduce shield.yml
While legacy shields are still supported, this introduces a shield.yml
file similar to board.yml that allows to more explicitly declare a
shield and to set some useful metadata such as vendor and full name.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-05-23 17:19:58 +02:00
Benjamin Cabé
66fda826e1 shields: scripts: cmake: use list_shields.py in shields.cmake
The logic to "guess" shield names/dirs was duplicated between
list_shields.py (which is used by e.g. west shields) and shields.cmake.
This commit moves the logic to list_shields.py, and updates
shields.cmake to call the script and process its JSON output.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-05-23 17:19:58 +02:00
Benjamin Cabé
93ced043f5 scripts: shields: handle BOARD_ROOT not containing shields folder
Prevent list_shields.py from crashing if a provided BOARD_ROOT
does not contain a shields folder.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-05-23 17:19:58 +02:00
Jamie McCrae
a9d0a36332 scripts: kconfig: Add dt_nodelabel_int_prop function
Adds a function which can be used to get the integer value of a
devicetree property in Kconfig from a nodelabel

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-05-23 14:04:32 +02:00
Joel Holdsworth
39916042d1 code_relocation: use booleans for string_create_helper arguments
The string_create_helper function has the arguments: load_address_in_flash
and is_copy. These arguments take logical values, but previously the
calling code used 1 and 0 rather than the more idiomatic True and False.

This patch corrects the issue by replacing use of int values with bool
values.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
2025-05-22 20:57:39 +02:00
Joel Holdsworth
f7332da62e code_relocation: improve code conciseness
This patch makes various simplifications to the code structure which make
it more concise by reducing repetition.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
2025-05-22 20:57:39 +02:00
Joel Holdsworth
33d9961f56 code_relocation: use named fields in string templates
Previously the script used templates where the fields were identified by
numeric ordinal-identified placeholders. This makes the code hard to read
because it is hard to tell which string corresponds to which placeholder
in the substitution.

This patch corrects the issue by replacing the ordinal placeholders with
named placeholders.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
2025-05-22 20:57:39 +02:00
Joel Holdsworth
567984c12e code_relocation: fix ruff UP037 warnings
In Python, type annotations can be quoted to avoid forward references.

However, if "from __future__ import annotations" is present, Python will
always evaluate type annotations in a deferred manner, making the quotes
unnecessary.

The ruff python linter produces UP037 warnings to indicate cases where
quoting of type annotations can be removed. This patch corrects the
warnings.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
2025-05-22 20:57:39 +02:00
Joel Holdsworth
8ee466337e code_relocation: fix ruff UP006 and UP035 warnings
PEP585 enabled collections in the Python standard library (like tuple) to
be used as generic type annotations directly, instead of importing
analogous members from the typing module (like typing.Tuple).

The ruff python linter produces a UP006 warning if the deprecated type
annotations continue to be used.

This patch corrects the issue by correcting the single instance where
PEP585-style type annotations can be used.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
2025-05-22 20:57:39 +02:00
Joel Holdsworth
6ede0d5bc1 code_relocation: fix ruff SUM401 warning
The ruff python linter produces a SIM401 warning when a dictionary is
accessed using if-statements to check for key presence. In this case, the
dict.get() method could be used instead.

For example:

    value = foo["bar"] if "bar" in foo else 0

...can be replaced with:

    value = foo.get("bar", 0)

This patch corrects the single instance of this issue in the script.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
2025-05-22 20:57:39 +02:00
Joel Holdsworth
f4c54fcb93 code_relocation: fix ruff SIM102 warning
The ruff python linter produces a SIM102 warning when there are nested if
statements which can be collapsed into a single if statement:

    if foo:
        if bar:
	    ...

...becomes...

    if foo and bar:
        ...

This patch corrects the single instance of this issue in the script.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
2025-05-22 20:57:39 +02:00
Joel Holdsworth
3db20541de code_relocation: fix ruff I001 warning
The ruff python linter produces a I001 warning when the imports of a Python
script are not sorted. This patch corrects the issue by sorting them.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
2025-05-22 20:57:39 +02:00
Joel Holdsworth
8a8b42be8c code_relocation: combine typing imports onto a single line
The script can be made more concise by combining the imports of three
classes from the typing module into a single line.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
2025-05-22 20:57:39 +02:00
Joel Holdsworth
4f0b402224 code_relocation: fix ruff B028 warnings
The ruff python linter produces a B028 warning when the warnings.warn()
function is called with a stacklevel parameter.

By default the function will set a stacklevel of 1 which causes it to
output the stack frame of the line where the function is called without
any context information from higher up the stack.

It is recommended to use a stacklevel of 2 or higher. Therfore, this patch
sets the stacklevel parameter of all warnings.warn() calls to to 2.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
2025-05-22 20:57:39 +02:00
Joel Holdsworth
66e35624af code_relocation: applied ruff code formatting to gen_relocate_app
Ruff is the Zephyr projects supported Python formatting tool. This patch
applies auto-formatting gen_relocate_app.py in preparation for coming
tidy-ups and improvements.

With the Ruff auto-formatter applied, error E501 can be removed from
.ruff-excludes.toml exclusion rules.

gen_relocate_app.py has also been removed from the format exclude list.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
2025-05-22 20:57:39 +02:00
Grzegorz Swiderski
468db18389 cmake: modules: Add zephyr_dt_import
Extract the part of `dts.cmake` that invokes `gen_dts_cmake.py`, then
generalize it into a CMake extension, which can be reused by sysbuild.

The Python script itself is also updated, so that the generated CMake
file can accept an input variable DEVICETREE_TARGET, which comes from
the `zephyr_dt_import(TARGET ...)` argument.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2025-05-22 13:44:18 +02:00
Yangbo Lu
d91b8b4070 scripts: blobs: add click-through property
Added a click-through property. Some downloading may need to
accept license to continue.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-05-21 12:34:59 +02:00
Benjamin Cabé
0c82c3516f Revert "cmake: shields: introduce shield.yml"
This reverts commit 9d5b19710b.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-05-21 09:30:30 +02:00
Benjamin Cabé
0ed2ca7ced Revert "scripts: west: commands: make use of shield.yml in west shields command"
This reverts commit 9dd10af28b.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-05-21 09:30:30 +02:00
Benjamin Cabé
9dd10af28b scripts: west: commands: make use of shield.yml in west shields command
This change introduces the use of shield.yml in the `west shields`
command so that when using the `-f` option one can output the shields'
full name and vendor information.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-05-20 15:23:34 +02:00
Benjamin Cabé
9d5b19710b cmake: shields: introduce shield.yml
While legacy shields are still supported, this introduces a shield.yml
file similar to board.yml that allows to more explicitly declare a
shield and to set some useful metadata such as vendor and full name.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-05-20 15:23:34 +02:00
Fabio Baltieri
649eb6280d ci: pr_metadata_check: convert DNM logic to python
GitHub seems to have issue with workflow state caching that causes the
DNM step to not work properly in few cases and not detecting changes in
the DNM tag, forcing people to mess with tags or close/opening PRs,
which in turns restarts all workflows.

Convert the script to Python so that the tag data is guaranteed to be
fresh.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-05-20 10:17:19 +02:00
Jiafei Pan
48ed1a74a6 scripts: runners: jlink: add support to flash to sram
Add new parameter "--flash-sram" for J-Link runner to flash the image
to SRAM and modify the PC register to start of SRAM.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2025-05-20 09:16:47 +02:00
Ederson de Souza
9741c25715 twister: More restrictive regex for log markers
Some simulators - like simics - may end up adding extraneous suffixes to
logged lines. This may cause some regex that match too much fail. This
patch fixes two such cases:

  - regex to find RunID changed to only match valid hexadecimal
    characters;
  - regex to match start of testsuite changed to only match valid word
    characters (0-9A-Za-z_).

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-05-17 14:11:45 +02:00
Benjamin Cabé
08206688fd scripts: runners: nios2 runner has been dropped
Remove `nios2` from list of available runners as it's just been dropped
with commit 5fe84d5b69

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-05-16 19:02:34 +02:00
Chris Friedt
c32488f97b cmake: kconfig: auto-generate boolean board revision option
Automatically generate a boolean CONFIG_BOARD_REVISION_FOO=y Kconfig
option based on e.g. CONFIG_BOARD_REVISION="foo".

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-05-16 16:11:48 +02:00
Luca Burelli
fe7f71ba16 dtlib: add test for lineno/filename comments
Tweak the existing filename_and_lineno test to also check the generated
comments in the string representation of the devicetree match expected
contents and alignment.

Using tmpdir as the base directory simplifies the comparison by avoiding
directory separator issues.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-05-16 09:38:35 +02:00
Luca Burelli
c1603b3163 gen_edt: use workspace dir as base for relative paths in comments
This commit allows comments to reference files with paths that are relative
to the Zephyr workspace root. This is done by adding a new argument
'--workspace-dir' to the 'gen_edt.py' script, which is passed to the
'EDT' and 'DT' classes and used instead of the current working directory.

The workspace directory is set to WEST_TOPDIR if West is in use,
otherwise it is set to the parent directory of ZEPHYR_BASE so that
Zephyr files have a 'zephyr/' prefix.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-05-16 09:38:35 +02:00