Commit graph

786 commits

Author SHA1 Message Date
Grzegorz Chwierut
db3c344af9 west: runners: Add ncs-provision to west flash command
Added automatic KMU key provisioning, when keyfile.json
file exists in the build directory.
This enables automated key provisioning during the
flashing process to enable testing nRF54L aplications using Twister.
Only applicable on nrfutil runner.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2025-06-11 16:09:05 -07:00
Yangbo Lu
e960af1cb1 scripts: west_commands: runners: add nxp spsdk
Added nxp spsdk as west runner.

Secure Provisioning SDK (SPSDK) is a unified, reliable,
and easy to use Python SDK library working across the
NXP MCU portfolio providing a strong foundation from
quick customer prototyping up to production deployment.

Docs: https://spsdk.readthedocs.io

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2025-06-11 16:03:37 -07:00
Benjamin Cabé
be504b000d west: spdx: allow to generate for different SPDX versions
When support for SPDX 2.3 was added, it effectively dropped support for
SPDX 2.2, which in retrospect was a bad idea since SPDX 2.2 is the
version that is the current ISO/IEC standard.
This commit adds a `--spdx-version` option to the `west spdx` command
so that users can generate SPDX 2.2 documents if they want.
Default is 2.3 given that's effectively what shipped for a few releases
now, including latest LTS.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-10 13:28:38 +02:00
Benjamin Cabé
22b089432c scripts: west: spdx: handle error codes in makeSPDX()
Add missing error handling of some of the calls to writeSPDX().

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-10 13:28:38 +02:00
Benjamin Cabé
4655e0d9d4 west: spdx: remove unnecessary format strings
As reported by sonarqube, "String formatting should be used correctly"

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-10 13:28:38 +02:00
Pieter De Gendt
c5d1e8e220 scripts: west_commands: patch: Support Python 3.10
The west patch command used hashlib.file_digest which was introduced in
Python 3.11.
Replace with a loop to support Python 3.10 (the current minimum).

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-06-05 09:34:40 +02:00
Miguel Gazquez
783103ebf6 scripts: west_commands: runners: fix dt-flash handling in some runners
In minichlink and spi_burn, the script checks if dt_flash is True by
checking if the value is "y". But dt_flash is a boolean.
Fix these checks.

Also, when dt-flash is True, spi_burn calculate the address in a
convoluted way, by substrating CONFIG_FLASH_LOAD_OFFSET to
itself.
Simplify this computation.

Signed-off-by: Miguel Gazquez <miguel.gazquez@bootlin.com>
2025-06-04 10:03:40 +02:00
Miguel Gazquez
8c6a290d4a scripts: west_commands: runners: Fix default value for --dt-flash
The '--dt-flash' parameter accepts a string like "y", "yes", "no", etc,
and is supposed to be converted into a boolean value. This is only the
theory as in practice, the default value is set to 'n' and is never
converted to False afterwards.

Set the default value to False.

Signed-off-by: Miguel Gazquez <miguel.gazquez@bootlin.com>
2025-06-04 10:03:40 +02:00
Pieter De Gendt
88d7715a29 scripts: west_commands: zspdx: writer: Fix linter issues
Fix issues reported by ruff.

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

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

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

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

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-06-02 20:22:51 +02:00
Pieter De Gendt
3ccda0e4fe scripts: west_commands: zspdx: datatypes: Fix UP008
Replace super call with parameters reported by ruff.

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

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

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-06-02 20:22:51 +02:00
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
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
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
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
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é
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
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
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
Anas Nashif
5fe84d5b69 arch: nios2: remove arch
Remove architecture and dependencies.
Remove altera HAL supporting nios2

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-05-15 20:01:05 -04:00
Carles Cufi
6659d2d711 scripts: runners: nrfutil: Check return code after Popen
The code invoking nrfutil was not checking the return code of the
subprocess, which meant that if the underlying tool was exiting with a
failure error code it remained undetected.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2025-05-13 17:45:09 +02:00
Vignesh Pandian
d750daa2bb west: fix for west flash --context with sysbuild.
Fix west flash --context fails for Sysbuild projects issue.

Signed-off-by: Vignesh Pandian <vignesh@aerlync.com>
2025-05-08 15:56:02 +02:00
Daniel DeGrasse
6ec7908239 scripts: west_commands: runners: do not print newline in telnet decode
Remove the newline printed after decoding a block of telnet data from
the server in the "pure python" implementation used when netcat is not
available. This newline print is incorrect as it is not in the RTT
output being produced from the device, and can impact programs like
twister which expect specific strings in the output and cannot handle
these strings being split across two lines

Signed-off-by: Daniel DeGrasse <ddegrasse@tenstorrent.com>
2025-05-08 12:25:07 +02:00
Phi Tran
7ac89d33b1 scripts: west: flash: Add support for .mot file format
Add support for .mot file flash using west flash command
The RX build output .mot as binary file to flash into
board

Signed-off-by: Phi Tran <phi.tran.jg@bp.renesas.com>
Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
2025-05-02 09:18:16 +02:00
Tais Hjortshøj
0709014549 scripts: west_commands: Add powershell autocompletion (west -b)
Windows powershell can by default not autocomplete known boards when
tapping which can cause frustration when you can't quite remember the
exact name or you don't want to type it out.
west build .\path\to\application\ -p -b stm<tab> will search for
available board including 'stm' in their name.

Signed-off-by: Tais Hjortshøj <tbh@mjolner.dk>
2025-05-02 01:16:00 +02:00
TOKITA Hiroshi
4b563934a6 west: runners: openocd: Add option to start RTT server during debug
Add `--rtt-server` option to start RTT server when the OpenOCD
launched from `debug`, `debugserver`, and `attach` commands.

This option starts the RTT server and opens a port,
but RTT logging must be done externally.
That is, you must connect to port 5555 using `telnet` or `nc`
in another terminal to view the RTT log.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2025-04-29 20:08:20 -04:00
Jamie McCrae
088c8f4df8 Revert "west: fix for context with sysbuild"
This reverts commit 8972146302.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-04-28 13:41:34 +02:00
Vignesh Pandian
8972146302 west: fix for context with sysbuild
show `west flash --context` with sysbuild

Signed-off-by: Vignesh Pandian <vignesh@aerlync.com>
2025-04-25 15:55:40 +02:00
Sebastian Bøe
fff2fef27c west: runners: nrf_common: Temp hack for NRF54H20_IRON
Temp hack while waiting for NRF54H20_IRON support for Network in
nrfutil.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2025-04-24 20:28:51 +02:00
Carles Cufi
999b6a14a4 west: runners: nrf: Add an option to control the ext erase mode
The erase mode for any external memory that is mapped to the address
space of the MCU is derived from the internal non-volatile memory erase
mode. In order to allow users to override the default value, add a new
--ext-erase-mode command-line option that takes an erase mode just like
--erase-mode does.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2025-04-16 08:07:44 +02:00
Carles Cufi
58e0e31c7e west: runners: nrf: Generalize the erase command
Instead of providing an `--erase-pages` command, generalize it to a new
`--erase-mode` one that can be set to `none`, `ranges`, or `all`. This
gives the user full control over the erase mode that will be passed on
to nrfutil.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2025-04-16 08:07:44 +02:00
Carles Cufi
01f65f658b west: runners: nrf: Fix typo in nrjfprog runner
The correct string is `ERASE_NONE`.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2025-04-16 08:07:44 +02:00