Commit Graph

97 Commits

Author SHA1 Message Date
Gerard Marull-Paretas 78706dffdb scripts: west_commands: runners: nrf_common: update nRF54H support
nRF54H can only be flashed using nrfutil now, so some workaround present
in the nrf_common module are no longer needed, e.g. UICR erasing.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-03-20 11:35:47 +01:00
Gerard Marull-Paretas 0387214bfc scripts: west_commands: runners: nrfutil: use x-execute-batch
execute-batch is now named x-execute-batch, as it is an experimental
option.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-03-20 11:35:47 +01:00
Anas Nashif be60134421 west: add native_sim flash, debugserver command
Add 'west flash' support which in the case of native_sim just start the
built application.
Reuse existing runner and rename it to be more generic as it does more
than just debugging now.

Also add debugserver command.

Fixes #36706

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-03-12 12:57:18 -04:00
John Whittington 3f282da22d west: runners: blackmagicprobe: elf_file fallback
Building the HEX file is optional (CONFIG_BUILD_OUTPUT_HEX), so
`bmp_flash` will fallback to elf_file if missing. Additionally, to
maintain section names the HEX is only used if it is signed.

Signed-off-by: John Whittington <git@jbrengineering.co.uk>
2024-01-26 14:24:05 -05:00
John Whittington 10183797a1 west: runners: blackmagicprobe: flash hex_file
The cfg.elf_file is not signed, so `west flash` with a sysbuild will
not run the application if MCUboot image signature checking is on. Using
the cfg.hex_file for `bmp_flash` resolves since as the signed hex is
used when using sysbuild. Symbols are not required for flashing so the
switching from elf to hex is not an issue.

Signed-off-by: John Whittington <git@jbrengineering.co.uk>
2024-01-26 14:24:05 -05:00
Henrik Brix Andersen bf598848b1 scripts: west: commands: tests: dfu_util: fix test under Python 3.12
Use "call_args_list" from unittest.mock instead of "called_with" for
verifying the arguments supplied to the dfu-util west runner.

This aligns the assert with the rest of the test case and fixes the
dfu-util west runner test when running under Python 3.12.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-10-26 07:17:10 +02:00
Manuel Argüelles 52e9671fa8 west: add tests for NXP S32 Debug Probe
Add minimal set of tests to verify behavior of supported commands.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-10-25 18:14:51 -07:00
Manuel Argüelles e938a5a31a west: add NXP S32 Debug Probe runner
The NXP S32 Debug Probe is a JTAG-based probe that enables debugging on
NXP S32 devices. This probe is designed to work in conjunction with NXP
S32 Design Studio and this runner offers a wrapper to launch a debug
session from cli.

`flash` command is not implemented at the moment because presently there
are no zephyr boards that can make use of it and test it.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-10-25 18:14:51 -07:00
Alberto Escolar Piedras f8455b410e west runner: Add exe file to configuration
Add the exe fle to the runnerconfiguration class,
so we can use it from runners which will need it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-10-10 15:26:09 +02:00
Evgeniy Paltsev 06b28fc4ea ARC: west: mdb runner: support 12 cores targets
Bump number of cores limit in mdb west runner.
As we are here - adjust core number in runner test closer to
the limit.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2023-09-25 09:49:50 +02:00
Yves Vandervennet 58e4df6460 west: runner: add support for NXP's linkserver
Linkserver is a utility for launching and managing GDB servers for NXP
debug probes, which also provides a command-line target flash programming
capabilities. Linkserver can be used with NXP MCUXpresso for Visual Studio
Code.

For more information about LinkServer, please visit the LinkServer web
page (link [1] below).

This commit adds a runner to west, supporting debug and flash commands.

Documentation is also added.

[1] - LinkServer web page:
    https://www.nxp.com/design/software/development-software/mcuxpresso-software-and-tools-/linkserver-for-microcontrollers:LINKERSERVER

Signed-off-by: Yves Vandervennet <yves.vandervennet@nxp.com>
2023-07-21 14:57:25 -05:00
Aleksander Wasaznik bb8b515ffa native_posix: Add support for `west debug`
This change adds the convenience of `west debug` to native builds.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-07-20 12:43:47 +02:00
Evgeniy Paltsev 15b46039b8 ARC: used 64bit MDB binary by default.
This significantly improve user experience as 32 bit mdb binary
require to install multiple libraries before it can be used on
modern linux distros.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2023-05-22 10:16:28 +02:00
Roman Dobrodii 2e0820f08c scripts: west: add silabs_commander runner
- Runs Silabs Commanders which is useful for SiLabs boards that
can not use J-Link for various reasons.
- Flash support only, no debug.

Signed-off-by: Roman Dobrodii <rdobrodii@antmicro.com>
2023-04-25 10:34:16 -07:00
Carles Cufi a7a9cb018a scripts: runners: tests: nrf: Refactor and add nrfutil runner tests
Refactor the existing nrfjprog tests to make them compatible with the
new nrfutil runner implementation, and extend them so that they are
exectued for both tools.

There is missing verification of the JSON generated by the nrfutil
runner, whcih will be added in a follow-up commit.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-04-17 09:29:04 -07:00
Carles Cufi a5e0cbc4fb scripts: runners: tests: nrf: Minor tweaks
- Rename the test file to test_nrf.py in preparation for future tests
  covering nrfutil as well
- Rename the test folder from nrfjprog/ to nrf/
- Change the id_fn returned string formatting so that it's compatible
  with executing a single test case via -k as a parameter (no spaces or
  commas)

You can now execute:
python -m pytest tests/test_nrf.py -k \
'test_nrfjprog_init[NRF51-pin_reset-override_snr-sector[anduicr]\
_erase-no_recover-no_tool_opt]'

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-04-17 09:29:04 -07:00
Evgeniy Paltsev 6599c3796d west: runners: mdb-hw: add hostlink-awareness
Add hostlink-awareness to mdb-hw runner. The mdb-nsim and arc-nsim
runners (as well as cmake scripting for nSIM boards) doesn't require
any changes.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2023-03-17 11:49:02 +01:00
Carles Cufi e073210ec2 scripts: runners: nrfjprog: Use --tool-opt in all operations
Pass on the tool-specific options to nrfjprog during all operations, and
not only when programming. This is useful when combined with options
like --ip, that allows west flash to be used over the network.

Fixes #55340.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-03-06 11:40:49 -08:00
Carles Cufi ba86759a79 scripts: runners: tests: nrfjprog: Test --tool-opt
Add tests for the --tool-opt command-line switch, to ensure that if the
user includes additional tool options those get passed on to nrfjprog at
the end of the command-line to override any preceding ones.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-03-06 11:40:49 -08:00
Carles Cufi 8fc87c87b8 scripts: runners: nrf: Add support for multiple nRF backends
Generalize the logic that was previously in nrfjprog.py into a new
nrf_common.py, which can then use specific tool subclasses, one of which
is nrfjprog.py, to implement the actual tool invocation.

This commit lays down the groundwork for the addition of a new backend
for nRF boards, the new nrfutil tool from Nordic. Both nrfjprog and
nrfutil will coexist in the immediate future, but nrfutil is expected to
be the sole tool for everything nRF in due time.  This is why the internal
representation of the operations is based in JSON and is using the exact
format that nrfutil expects when using the 'execute-batch' option, that
takes a JSON file with an array of operations to be executed.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-03-06 11:40:49 -08:00
Peter Johanson 26a04adb8b west: runners: uf2: Add new UF2 runner.
Add a new UF2 runner, supporting only the flash capability.

Searches for FAT partitions containing `INFO_UF2.TXT` files,
and can optionally filter on a matching `Board-ID` value in
that file.

Signed-off-by: Peter Johanson <peter@peterjohanson.com>
2023-02-20 12:50:38 +01:00
Evgeniy Paltsev c85e5438b9 ARC: west runner: mdb-hw: fix incorrect argument handling for jtag
Currently we just pass in case of the unsupported jtag adapter
is selected. Fix that by rising ValueError as we do in case of
other incorrect arguments.

While I'm at it add few missing test-cases for mdb west runners.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2023-02-02 09:05:18 -08:00
Evgeniy Paltsev 963c7a2d40 ARC: west runner: mdb: fix unexpected empty argument pass to MDB
Currently, in case of multi-core target or in case jtag adapter
auto-selectio, we pass unexpected empty argument (empty quotes `''`)
to MDB binary due to argument generation error.

Fix that.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2023-02-02 09:05:18 -08:00
Evgeniy Paltsev d2d5177e58 ARC: west runner: mdb: remove dead code
Remove code which looking for `cld` process pid - this functionality
isn't use anymore by twister. And as manual MDB termination is also
fixed now this functionality isn't required for anything now.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2023-02-01 10:06:26 -08:00
Evgeniy Paltsev 0206effb46 ARC: west runner: mdb: fix unusable console after flash / debug
Currently we try to start MDB (MetaWare Debugger) in background
with ignored sigint no matter if we are planing to do debug
session (via `west debug`) or just run something on HW or on
nSIM (via `west flash`)

That cause really bad user experience as after we do
`west debug` or `west flash` we can't terminate the debugger
from the console. Moreover even if we terminate the debugger
process from separate terminal the console stil would be
broken so we need to do `stty sane` in it to make it usable
again.

Fix all that by proper starting the debugger process.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2023-02-01 10:06:26 -08:00
Jamie McCrae ec7044437e treewide: Disable automatic argparse argument shortening
Disables allowing the python argparse library from automatically
shortening command line arguments, this prevents issues whereby
a new command is added and code that wrongly uses the shortened
command of an existing argument which is the same as the new
command being added will silently change script behaviour.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-01-26 20:12:36 +09:00
Fabio Baltieri 79856e7637 west: runners: blackmagicprobe: guess the gdb port based on the OS
Add some logic in blackmagicprobe.py to guess the GDB serial port based
on the OS instead of just trying the flag or /dev/ttyACM0.

The new logic explicitly looks for the well known path for BMP on Linux
(/dev/ttyBmpGdb), so that we can remove it from the board files that
have it set explicitly right now. At the same time it still allows
setting the port from the flag and also checks an environment variable,
so that it can be used for systems with multiple probes.

As a fallback, it looks for a valid serial port, picking the first one
(the probe creates two, the GDB one is the first one), and raise an
exception if nothing is found.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2023-01-19 10:16:00 +01:00
Fabio Baltieri dabfffaf26 west: runners: blackmagicprobe: update reset on connect command
Recently the blackmagicprobe command for "connect under reset" has been
updated from "connect_srst" to "connect_rst". Update the flag name in
the west blackmagicprobe binding, keep the old one as well for
compatibility with out of tree boards, and send both the old and new
commands to GDB so that it works with both the old and new firmware. GDB
is going to get a "command not supported by this target" for one of the
two and proceed with the other one.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2023-01-19 10:16:00 +01:00
Al Semjonovs a7d6ca2bd9 west: west twister integration
Add twister command to west.

Signed-off-by: Al Semjonovs <asemjonovs@google.com>
2023-01-13 15:39:04 -08:00
Henrik Brix Andersen d151424a6d scripts: west: runners: canopen: add SDO block transfer support
Add SDO block transfer support for the CANopen program download west
runner. SDO block transfers are experimental in the underlying CANopen for
Python.

Reduce the program download chunk size to half the program download buffer
size to avoid blocking IO.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-11 09:39:57 +01:00
Martí Bolívar 374411dfaf west: runners: improve pyocd runner test coverage
Make sure that this runner can handle multiple --tool-opt arguments,
and that the options specified for pyocd are passed to that tool in
order.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2022-12-29 10:36:02 +01:00
Gerhard Jörges 87a751c266 west: runners: add file argument
adds --file argument to west flash/debug as described in #52262.

Signed-off-by: Gerhard Jörges <joerges@metratec.com>
2022-12-01 06:53:58 -08:00
Gerard Marull-Paretas 2cee5ff519 scripts: west_commands: runners: remove deprecated options
The --snr (nrfjprog) --id (jlink) and --board-id (pyocd) options were
deprecated a long time ago in favor of --dev-id. It is time to remove
them.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-30 14:15:30 +01:00
Manuel Arguelles 31b3993d58 scripts: west: introduce Lauterbach TRACE32 runner
This patch introduces a West runner for flashing and debugging with
Lauterbach TRACE32 debuggers. The runner consists of a wrapper around
TRACE32 software, and allows a Zephyr board to execute a custom start-up
script (Practice Script) for the different commands supported, including
the ability to pass extra arguments from CMake. Is up to the board using
this runner to define the actions performed on each command.

The `debug` command launches TRACE32 GUI to allow debug the Zephyr
application, while the `flash` command hides the GUI and executes the
start-up script in a background process.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2022-10-14 09:51:14 +02:00
Andrzej Kaczmarek 868acfd505 scripts: Add ezFlashCLI runner
This adds support for ezFlashCLI tool to allow flashing DA1469x MCU
family from Renesas.

The tool is available at https://github.com/ezflash/ezFlashCLI or can
be installed via pip.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
Signed-off-by: Ben Lauret <ben.lauret.wm@renesas.com>
2022-08-31 20:32:03 +02:00
Martí Bolívar 65e3593bf9 west_commands: runners: reserve -O for --tool-opt
The --tool-opt runner option is the recommended practice for allowing
runners to take additional arguments that are passed on to the
underlying tool. It exists because we don't want to add one runner
option for every single tool option that users might want to tweak --
that would be a nightmare.

Enough runners are using this option that it's time to promote it to a
common runner capability with consistent behavior, the same way we did
for the --dev-id option in the past. This removes boilerplate from
individual runner files and ensures consistent argument handling for
this option when it is supported.

Since --tool-opt is a bit long to type, and we've had some complaints
about that, take this as an opportunity to standardize on -O as a
short option equivalent for it.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2022-08-03 05:06:53 +01:00
Anas Nashif 071f62cb75 west: remove intel_s1000_crb runners
Remove runners specific to the intel_s1000_crb board. it is no longer
available or supported in the zephyr tree.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-06-13 16:19:51 -04:00
Enjia Mai 12c44aaec7 scripts: runner: add a intel_adsp west runner
Add a intel_adsp west runner instead of using misc-flasher for
intel_adsp boards. Now running the test on intel_adsp_cavs by:

  west build -b intel_adsp cavs25 ...
  west flash --remote-host [remote hostname or ip addr] \
             --rimage-tool [path to rimage tool] \
             --config-dir [path to dir of .toml config file] \
             --key [path to signing key]

The intel_adsp west depends on the cavstool_server.py running
on the remote host machine.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-06-05 14:13:57 +02:00
Evgeniy Paltsev 554aa9cde3 ARC: west: mdb runner: change folder to run MDB
Make the build folder the place where MDB is run. Otherwise mdb
will store the .sc.project folder in the place where twister is
launched (so .sc.project folder will be shared across the runs)

For that we add **kwargs argument to popen_ignore_int method
so we can pass a cwd argument to the Popen constructor.

Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2022-06-02 13:09:51 +02:00
Esteban Valverde 74ae6f654e scripts: west_commands: runners: add runner for Cyclone V SoC FPGA DK
Add a runner to "flash" and "debug" Cyclone V SoC FPGA Development Kit
the runner is based on OpenOCD and GDB

Signed-off-by: Esteban Valverde <esteban.valverde.vega@intel.com>
2022-05-10 13:29:47 -04:00
Markus Swarowsky 9510f96179 west: runners: Fix verify warning from nrfjprog
nrfjprog prints out a warning if a device is programed without the
--verify option, which can be confusing.
So added the option when programming with nrfjprog.
Then west flash can be used without getting a warning.
Also changed the tests to only accept programming with --verify
option.

Signed-off-by: Markus Swarowsky <markus.swarowsky@nordicsemi.no>
2022-03-01 08:41:40 -08:00
Alex Kolosov f374d6b1f1 scripts: runners: Add west flash command for B91 platform
This commit implements west flash command for Telink B91 platform.
west flash command uses ICEman and SPI burn from AndeSight for flashing.

Signed-off-by: Alex Kolosov <rikorsev@gmail.com>
2021-12-06 07:28:38 -05:00
Fabio Baltieri d0377d30e3 scripts: runners: add connect_srst support for blackmagicprobe
Black Magic Probe supports a "monitor connect_srst" command [1] to
configure whether to assert reset when connecting to the target. This is
useful to reprogram a target that may be idling in a low power state,
with an otherwise unresponsive debug core.

Adding a --connect-srst runner option for enabling this for "flash" and
"debug" operations to ensure that programming works in that case, but
also explicitly disabling it for "attach", to allow attaching to a
running target without changing its state.

Not turning this on by default since apparently some MCUs disable the
SWD interface while in reset.

[1] https://github.com/blacksphere/blackmagic/wiki/Useful-GDB-commands

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-11-22 22:20:02 -05:00
Gerson Fernando Budke 0de934b2a7 scripts: runner: Introduce gd32isp flash runner
Add GigaDevice ISP console flash runner.  This tool enable uses ROM
bootloader to flash devices using serial port.

The GD32_ISP_Console tool can be found at
  http://www.gd32mcu.com/download/down/document_id/175/path_type/1

Signed-off-by: Gerson Fernando Budke <gerson.budke@atl-electronics.com>
2021-11-07 05:20:50 -05:00
Henrik Brix Andersen 10fb5c203b runners: canopen: poll for flash ready
Poll the flash status instead of just reading the flash status once. Add
support for controlling the number of SDO retries and the SDO timeouts.

These changes allows for greater control of the CANopen program
download, which is especially useful on noisy or congested CAN networks
and on devices with slower flash access.

Fixes: #39409

Signed-off-by: Klaus H. Sorensen <khso@vestas.com>
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-10-14 10:44:21 +02:00
Carles Cufi 2ccfd22594 runners: pyocd: Convert to -i/--dev-id
Remove the previous pyocd-specific --board-id option and switch to
the common -i/--dev-id one.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-10-11 20:56:27 -04:00
Gerson Fernando Budke c3db83ba58 scripts: runners: openocd: Enable thread awareness
Zephyr thread awareness is available for openocd but boards don't
have debuggers configuration.  This configure OpenOCD runner
automatically to complete configuration.

User still require enable CONFIG_DEBUG_THREAD_INFO=y to visualize
thread debug information.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-08-27 06:44:45 -04:00
Watson Zeng 91aedd964e arc: west: mdb: reverse the launch order for multi cores
The ARConnect Inter-core Debug Unit (ICD) provides
additional debug assist features in multi-core scenarios.
In master core(core 0) initial stage, we will program ICD to halt
all other cores based on a halt occurring in one ore more core.
And all cores are in halt mode on reset, so we need to make
sure other slave cores have launched and in running mode
before we enable ICD in master core.

Currently we launch master first, Let's reverse the launch
order, launch master last, to make sure slave cores have
launched before we program and enable ICD.

Signed-off-by: Watson Zeng <zhiwei@synopsys.com>
2021-07-01 13:33:34 -04:00
Gerson Fernando Budke f3a7f041bf scripts: runners: bossac: Add legacy mode
Add compatibility mode with old sam-ba flash bootloaders that don't have
offset capabilities.  These bootloaders flash to a pre-defined flash
region.  At end, bossac will suppress --offset parameter.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-05-21 21:20:58 +02:00
Martí Bolívar 778a18cb1a runners: tests: don't patch BuildConfiguration
Instead of mocking out the BuildConfiguration class, just create its
input file and let the real class do the work.

This in turn exposes a bug in the way the board name is being pulled
out of the BuildConfiguration, which we fix to keep the tests passing.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-05-03 09:55:33 -05:00