Commit graph

786 commits

Author SHA1 Message Date
Tobias Pisani
73c8235881 west: runners: Implement the west rtt command for jlink
Moves the telnet client into runners/core.py as well, as this is now shared
between openocd and jlink.

Signed-off-by: Tobias Pisani <mail@topisani.dev>
2024-09-10 12:39:42 -04:00
Tobias Pisani
18f45b5f06 west: runners: Implement the west rtt command for openocd
This was non-trivial, as openocd is a bit weird to work with. Using only
commands passed with '-c' arguments, I couldn't get it to reliably resume
(or just not halt) the target when started. I tried using the 'sleep'
command, and various 'configure -event XX { resume }' events, but nothing
panned out, as it seems to always halt after all `-c` commands have been
run.

To avoid that, this waits for the TCL RPC port to be up, and sends a
resume command there. This works reliably.

Signed-off-by: Tobias Pisani <mail@topisani.dev>
2024-09-10 12:39:42 -04:00
Tobias Pisani
b3b8360f39 west: runners: Add west rtt command with pyocd implementation
This command runs separately from a debug server, instead of attaching
to a running server. This is both the easiest out of the box experience,
and also should be possible to implement consistently for most runners.

This commit includes an initial implementation for pyocd.

Signed-off-by: Tobias Pisani <mail@topisani.dev>
2024-09-10 12:39:42 -04:00
Attie Grande
e6dc930322 bindesc: Add support for the build version values
This patch adds bindesc support for the build version values for the
kernel and application - BUILD_VERSION and APP_BUILD_VERSION.

The kernel's BUILD_VERSION can be overridden at build time.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2024-09-04 07:03:47 -04:00
Andrej Butok
3f5fc42fba runners: linkserver: Add .elf support to the linkserver flash command
As the .bin & .hex build output is optional
and it can be disabled by CONFIG_BUILD_OUTPUT_BIN/HEX,
add support for the mandatory .elf build output
to the linkserver runner flash command.

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
2024-08-29 11:37:54 +02:00
Andrej Butok
c1fe3150e9 runners: pyocd: Add support for .elf files to the pyocd flash command
As the .bin & .hex build output is optional
and it can be disabled by CONFIG_BUILD_OUTPUT_BIN/HEX,
add support for the mandatory .elf build output
to the pyocd runner flash command.

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
2024-08-27 12:44:55 +02:00
Emanuele Di Santo
b511704dd8 scripts: west: runners: add initial nRF92 support
Add initial support flashing and erasing the application and
radio cores of the nRF9280.

Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
2024-08-22 14:24:38 -04:00
TOKITA Hiroshi
eb675eb281 scripts: west_commands: completion: zsh: Add minimum support for sdk
Add minimum support for the `west sdk` command.
This only provides completion for the `sdk` command itself.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2024-08-21 16:54:56 -04:00
TOKITA Hiroshi
85ffd1e031 scripts: west_commands: completion: fash: Add support for west sdk
Add a feature for completion of the `west sdk` command.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2024-08-21 16:54:56 -04:00
TOKITA Hiroshi
af5850d44a scripts: west_commands: completion: bash: Add support for west sdk
Add a feature for completion of the `west sdk` command.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2024-08-21 16:54:56 -04:00
TOKITA Hiroshi
b68071dc71 commands: add the 'sdk' command to manage SDK.
This command can list and install SDK.

Run 'west sdk install' to install the SDK.
Run without any parameter, installing
specified by SDK_VERSION in the source tree.
'west sdk' to show installed SDK information.

This command is just a wrapper for SDK's setup command,
but it simplifies the installation process. It will be a good
improvement for onboarding first-time users.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2024-08-21 16:54:56 -04:00
Andrej Butok
e767ac0703 runners: jlink: Add support for .elf files to the jlink flash command
The .bin & .hex build output is optional and can be disabled by
CONFIG_BUILD_OUTPUT_BIN/HEX.
Add support for the mandatory .elf build output
to the jlink runner flash command.

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
2024-08-20 18:59:26 -04:00
Raffael Rostagno
eca1112d5b tools: esp32: Update for esp32c2
Added argument to support custom baud rate on ESP monitor
for ESP32C2 and ESP8684.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-08-11 10:32:59 +02:00
Tomasz Chyrowicz
4c541eb216 scripts: nrf_common: Use cfg for SUIT paths
It is safer to base the SUIT artifacts path on the path of the
configuration file than the HEX file that is being flashed.
The latter may be overriden by several scripts that merge/transform the
final firmware image.

Signed-off-by: Tomasz Chyrowicz <tomasz.chyrowicz@nordicsemi.no>
2024-08-05 18:38:23 -04:00
Pieter De Gendt
9894b84a2d scripts: west_commands: build: Fix empty testcase
An empty but specified testcase does not build, check if the test key
exists instead.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-08-01 16:39:51 +02:00
Chen Xingyu
0095c224fa scripts: west_commands: runners: Add support for probe-rs
probe-rs is a new programming and debugging tool written in Rust, supports
many probes and targets.

This commit introduces initial support for probe-rs to Zephyr.

Signed-off-by: Chen Xingyu <hi@xingrz.me>
2024-08-01 12:39:28 +02:00
Christophe Dufaza
2b2a0e04b2 west: blobs: verify fetched blobs after downloading
Running 'west blobs fetch' does not verify the digest of downloaded files:
1. if the checksum of the previously downloaded file does match
   that in the blob metadata (status BLOB_PRESENT), do nothing
2. if the checksum of the previously downloaded file does not match
   that in the blob metadata (status BLOB_OUTDATED),
   download the "up to date" file
3. if the blob has not yet been downloaded (status BLOB_NOT_PRESENT),
   download it

None of the 2) and 3) code paths will verify that the checksum of the file
just downloaded actually matches the digest in the blob's metadata.

In the event that the metadata of a module is incorrect, then the user
will not notice anything, and may rely on an unexpected binary,
e.g. a static library for a different architecture.

According to the Binary Blobs documentation [1], the expected
behavior is to check the blob digest after downloading.

[1] Fetching blobs, Zephyr 3.6.0 (still applies to Zephyr 3.7.0rc3)
docs.zephyrproject.org/3.6.0/contribute/bin_blobs.html#fetching-blobs

Signed-off-by: Christophe Dufaza <chris@openmarl.org>
2024-07-30 18:29:39 +01:00
Christophe Dufaza
ae9326c920 west: blobs: prefer constants to literals for blob status
Replace blob status literals with the corresponding
constants defined in zephyr_module.

Signed-off-by: Christophe Dufaza <chris@openmarl.org>
2024-07-30 18:29:39 +01:00
Théo Battrel
b764238e0d west: Update fish completion for boards
With the recent change to hwmv2, loading the
boards is extremely slow and can take several
seconds.

To solve that problem this commit add a cache
of the boards. The cache is updated based on:
    - when the latest commit of the manifest
    file directory is updated or;
    - when the manifest file directory is not
    a git directory, when the manifest file
    content itself is updated.

At the same time:
    - update how the board completion is
    displayed by including the board vendor to it;
    - add missing `--board` and `--board-dir`
    options;
    - remove `hwmv1` board completion code.

Signed-off-by: Théo Battrel <theo.util@protonmail.ch>
2024-07-30 18:25:28 +01:00
Théo Battrel
377eed6251 west: add vendor to boards format
Add the new `vendor` formatter argument to display board vendor.

Signed-off-by: Théo Battrel <theo.util@protonmail.ch>
2024-07-30 18:25:28 +01:00
Carles Cufi
539f3a1600 scripts: west_commands: nrfjprog: Change tool-opt help text
The current option used as an example, --recover, is actually a separate
option in the runner itself. Instead use --clockspeed as an example,
which is applicable to all nrfjprog commands.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2024-07-27 15:19:39 +03:00
Carles Cufi
7eb364b082 scripts: west_commands: nrfjprog: Add support for --qspiini
Allow for users to provide a --qspiini parameter that is passed directly to
the nrfjprog executable but only in the --program operation. This is
required since e073210ec2 enabled the
-O/--tool-opt for all operations, but --qspiini is only allowed combined
with --program.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2024-07-27 15:19:39 +03:00
Marcin Niestroj
35059a1b3a west: runners: esp32: respect --esp-device during erase
When --erase was specified, esp32 runner was autodetecting serial port to
be used, regardless of --esp-device argument.

Append '--port SERIAL_DEVICE' parameter earlier, so that erase command
invocation uses explicitly specified serial device.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-07-27 15:19:01 +03:00
Nick Kraus
29084dc06b west: Regex based version finding in OpenOCD runner
Previous OpenOCD version finding would fail when additional tokens were
prepended to the 'openocd --version' output, as happens with some third-
party OpenOCD repackages (xPack for one).

Fixes: #71955

Signed-off-by: Nick Kraus <nick@nckraus.com>
2024-07-09 19:02:13 +02:00
Grzegorz Swiderski
7a10c7dff1 scripts: west_commands: Fix west boards for SoC and arch in modules
Fixes #71761

The `west boards` command parses extra BOARD_ROOTs from Zephyr modules,
so that the boards defined in those modules are automatically listed.

In HWMv2, OOT boards can be described in terms of OOT SoCs, which means
that extra SOC_ROOTs must also be provided. Otherwise, an error message
will be displayed when attempting to list all boards. Therefore, every
Zephyr module SOC_ROOT should be included as well.

In HWMv1 (deprecated), OOT boards can be defined in terms of OOT archs,
but module ARCH_ROOTs had never been included automatically. The fix for
this is long overdue, but it's included for symmetry.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2024-07-05 14:55:08 +02:00
Henrik Brix Andersen
e5aad45bb1 west: commands: runners: canopen: increase default SDO timeout
Increase the default SDO timeout for the CANopen program download west
runner from 0.3 seconds to 1 second. Depending on the flash size and speed,
a full erase may take slightly longer than 300 ms.

The timeout can be customized by using the --sdo-timeout runner parameter.

Fixes: #73987

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2024-07-02 09:20:57 +02:00
Gerson Fernando Budke
768b8bbca3 scripts: west robot & simulation: Fix OOT
The current version of scipts do not consider OOT boards use cases and
the tests with robot now are strict to only one robot file, which is
not realistic for real environment. This address those issues and allow
multiple testsuits at command line and lists at tests entries. It add
another test parameter to allow configure robotframework options.

Fixes: #74563

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2024-07-01 16:10:35 -04:00
Louis Feller
5b4c8945fd west : runners : Fix error message when runners.yaml is not found.
Adjust error message so that it clearly states runners.yaml is
missing from <build_dir>/zephyr, instead of referencing CMake cache
variable ZEPHYR_RUNNERS_YAML, which is no longer used (since
3124c02987 ).
Also clean up that variable in CMake since it is no longer used
(0 other references in entire tree).
Fixes #70605

Signed-off-by: Louis Feller <louis.feller@st.com>
2024-06-28 12:23:18 -04:00
Jordan Yates
07870934e3 everywhere: replace double words
Treewide search and replace on a range of double word combinations:
    * `the the`
    * `to to`
    * `if if`
    * `that that`
    * `on on`
    * `is is`
    * `from from`

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-06-22 05:40:22 -04:00
Carles Cufi
4fecad4fe0 scripts: runners: nrf_common: Fix recover on 54H20
In order for the --recover option to work properly on the nRF54H20, it
requires executing it for both cores, the radio and the application one.
Extend the recover_target() function so that it does so for both 53 and
54H20.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2024-06-20 12:05:39 -04:00
Torsten Rasmussen
a9efb1dae6 west: update build extension command to use APP_DIR
`west build` can be invoked without specifying the source directory when
being invoked from the source directory itself.
When using `west build` for incremental builds, then the build command
will examine the CMake cache to determine the application dir by using
the value of CMAKE_HOME_DIRECTORY.

With sysbuild, this leads to the wrong assumption that the sysbuild
itself is the application to build.

Instead, have west build look for APP_DIR which points to the correct
source dir when sysbuild is used. Use APPLICATION_SOURCE_DIR when
APP_DIR is not set, as this indicates a no-sysbuild build.

Keep CMAKE_HOME_DIRECTORY behavior as last fallback mechanism.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-06-17 12:09:45 -04:00
Marcin Niestroj
4835658b46 west: runners: openocd: handle empty --elf-file
Make this param truly optional, so that hex file alone is enough for
flashing.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-06-14 21:05:49 -04:00
Thomas Gagneret
f5df063cbd scripts: zephyr_module: Move SPDX name normalization to writer.py
Since `writer.py` is the one writting the SPDX file, it should normalize
the name field and not `walker.py` which generates the SBOM components.

Signed-off-by: Thomas Gagneret <thomas.gagneret@hexploy.com>
2024-06-14 19:07:48 -04:00
Thomas Gagneret
0d05318c96 scripts: zephyr_module: Add URL, version to SPDX
Improve the SPDX with the current values:
 - URL: extracted from `git remote`. If more than one remote, URL is not
 set.
 - Version: extracted from `git rev-parse` (commit id).
 - PURL and CPE for Zephyr: generated from URL and version.

For zephyr, the tag is extracted, if present, and replace the commit id for
the version field.
Since official modules does not have tags, tags are not yet extracted for
modules.

To track vulnerabilities from modules dependencies, a new SBOM,
`modules-deps.spdx` was created. It contains the `external-references`
provided by the modules. It allows to easily track vulnerabilities from
these external dependencies.

Signed-off-by: Thomas Gagneret <thomas.gagneret@hexploy.com>
2024-06-14 19:07:48 -04:00
Sigmund Klåpbakken
6f215526d7 runners: jlink: Add support for big endian device
Sets the endianness of the JLink and the GDB Server based on if
`CONFIG_BIG_ENDIAN` is set.

Doc on JLink LE/BE option:
https://wiki.segger.com/J-Link_Commander#LE

Doc on GDB server -endian option:
https://wiki.segger.com/J-Link_GDB_Server#-endian

Signed-off-by: Sigmund Klåpbakken <sigmundklaa@outlook.com>
2024-06-14 15:37:46 +02:00
Daniel Schultz
b22c961e5e scripts: west: runner: openocd: Add gdb-client-port
The gdb-port defines the GDB port and the openocd runner passes
this value to openocd as well as gdb. However, the TI AM62x board
provides multiple ports for each subsystem. For example, systick
appears at 3333, A53 as 3334-3337, R5F as 3338 and M4F as 3339.

If we want to connect to the M4F, we need to add another port which
is different to the to the gdb-port value.

This patch adds an additional argument --gdb-client-port to define
the port which GDB should connect to. It defaults to 3333, identical
to gdb-port.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
2024-06-13 20:24:16 -04:00
Jamie McCrae
c0c51a8d40 scripts: west: flash: Fix issue with loading outdated domain file
Fixes an issue whereby the domains file in sysbuild projects
would be loaded and used with outdated information if sysbuild
configuration was changed then west flash was ran directly after
it

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-06-13 17:53:00 +02:00
Félix Piédallu
52c92159cd scripts: More explicit error in west_commands for NRF flashing
Instead of suggesting a python dep is missing, tell the user intelhex is
missing.

Signed-off-by: Félix Piédallu <felix@piedallu.me>
2024-06-12 18:26:29 -04:00
Carles Cufi
37ec117386 scripts: west: blobs: Check for existence of modules
Instead of blindly using the module names provided by the user via
command-line arguments, check if those actually exist in the current
manifest, and error out if any of them does not.

Fixes #73901.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2024-06-12 12:50:12 -04:00
Tomasz Chyrowicz
f15a2e8ca8 scripts: nrf_common: Handle SUIT artifacts
Handle MPI and root manifest for radio core separately from the main
build system logic.

Signed-off-by: Tomasz Chyrowicz <tomasz.chyrowicz@nordicsemi.no>
2024-06-10 17:03:14 +03:00
Tomasz Moń
88dc03618b scripts: west_commands: runners: nrf_common: adjust json output
Make the generated json file match the contents generated with:
  * nrfutil device erase --uicr --core Application --x-operation-id 1
    --x-family nrf54h --x-append-batch batch.json
  * nrfutil device program --firmware uicr_merged.hex
    --options chip_erase_mode=ERASE_NONE,verify=VERIFY_READ
    --core Application --x-operation-id 2 --x-family nrf54h
    --x-append-batch batch.json
  * nrfutil device reset --reset-kind RESET_PIN --x-operation-id 3
    --x-append-batch batch.json

The erase options are supposed to be placed under "option" subkey.
Without the "option" subkey, nrfutil defaulted to ERASE_ALL.

Remove the firmware file format field because it is auto detected by
nrfutil when executing the batch script.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-06-03 04:45:59 -07:00
Ioannis Damigos
90974248ec west/ezflashcli: add dev_id capability
Add dev_id capability

Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
2024-06-03 03:02:11 -07:00
Ioannis Damigos
5ad5ac6414 west/ezflashcli: add tool_opt capability
Add tool_opt capability

Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
2024-06-03 03:02:11 -07:00
Rafał Kuźnia
64bf17daad scripts: west_commands: runners: nrf_common: optional UICR cleanup
The flasher was unconditionally cleaning the UICR area, even when the
application didn't have a new configuration generated. This can happen,
when CONFIG_NRF_REGTOOL_GENERATE_UICR=n. In such case, keep the old UICR
configuration on the device.

A real scenario where we should set CONFIG_NRF_REGTOOL_GENERATE_UICR=n
is when building multiple firmware images that are meant to run one
domain. The primary application build generates the UICR configuration
and secondary images don't. Before this change, the flashing process of
the primary application would write new UICR configuration, but the
flashing process of secondary images would erase it.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2024-05-30 11:55:11 +01:00
Tomasz Moń
e136f02ea6 scripts: west_commands: runners: nrfutil: Only flash with J-Links
The nrfutil runner calls "nrfutil --json device list" which outputs
information about all connected serial ports. The list includes not only
actual boards but also any ttyACM instance. If the ttyACM instance does
not have serial number, then the nrfutil runner will fail on matching
serial number regexp on NoneType.

Fix the issue by limiting nrfutil runner board output to only devices
that have trait jlink set.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-05-29 08:31:01 -07:00
Yong Cong Sin
0dac6c132b build: namespace autoconf.h with zephyr/
Namespace the generated `autoconf.h` file with `zephyr/`.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-28 22:03:55 +02:00
Michał Szprejda
7c084b6649 West: Add west robot command
Introduce `robot` command for running Robot Framework test suites.
Initial implementation consists of one runner dedicated for renode-test,
which is a Renode wrapper for running Robot tests.

Signed-off-by: Michał Szprejda <mszprejda@antmicro.com>
2024-05-28 12:54:52 +02:00
Michał Szprejda
80900cbc3b West: Add west simulate command
Introduce `simulate `command for running samples on a simulator of
choice. Initial implementation consists of one runner, dedicated for
Renode.

Signed-off-by: Michał Szprejda <mszprejda@antmicro.com>
2024-05-28 12:54:52 +02:00
Michał Szprejda
f155ff596c West: runners: Add explicit capabilities
Add explicit capabilities to nios2, nsim and openocd runners to prevent
them from having potentially unwanted ones (for example when new
capabilities are added to Zephyr).

Signed-off-by: Michał Szprejda <mszprejda@antmicro.com>
2024-05-28 12:54:52 +02:00
Michał Szprejda
73b73c91f4 West: Add option to supress elf/bin/hex file params
Add capability allowing to suppress the --file parameters that can be
passed to a west command runner.

Signed-off-by: Michał Szprejda <mszprejda@antmicro.com>
2024-05-28 12:54:52 +02:00