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>
Fixes for the following issues that a new version of mypy started
reporting recently:
runners/trace32.py:34: error: Incompatible default for argument
"startup_args" (default has type "None", argument has type
"List[str]") [assignment]
runners/trace32.py:137: error: Incompatible default for argument
"cfg" (default has type "None", argument has type "Path") [assignment]
runners/trace32.py:34: note: PEP 484 prohibits implicit Optional.
Accordingly, mypy has changed its default to no_implicit_optional=True
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
in some builds there is need to pass different value for -i parameter
and current code will override it to 3
Also in rimage i parameter is by default set to 3
Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
Since twister can make use of domains.py as well, refactor west's use
this file so that domains.py can be moved to a generic library folder.
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Currently, it is not possible to use a normal flash command to flash two
hex files that contain data in the UICR region, even though these
data don't conflict with each other.
However, that is not a technical limitation of the device, but of the
nrfjprog runner as it fails as soon as the hex file contained UICR data
and there was no --force/--erase/--recover used.
That approach was used in the past as program operation was used
without --verify, but as this option was added a while ago it is an
unnecessary limitation.
If the UICR wasn't erased before programming, the verify of the program
operation will now fail, so giving the user a warning in this case that
the hex files contain data in the UICR will still give the user a hint
of what might have caused the failing verify.
Additionally, it enables partial programming of the UICR without the
use of the --force option.
Signed-off-by: Markus Swarowsky <markus.swarowsky@nordicsemi.no>
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>
We need to give gdb slash-separated paths to ELF files on Windows.
Just make sure we always have slash-separated paths. We use this
technique in various places around the tree.
Fixes: #50789
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Instead of 'reset halt', default the command to reset and halt the target
to 'reset init'.
OpenOCD strictly requires 'reset init' to halt and prepare the device
before flash programming.
See https://openocd.org/doc/html/Flash-Commands.html chapter
"12.2 Preparing a Target before Flash Programming."
For targets implementing the init hook, it will allows to perform some
target specific init improvements (such as speed flash improvements).
Targets not implementing this hook will end up executing the usual and
previous 'halt'.
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Although 8644b333cd added support for some
missing commands an options, the bash completion file was still in bad
need for some cleanup, fixes and additions.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
With revision 7.70d, Segger changed the command line interface of the
jlink client, requiring some flash specific information, such as
the base address and the type of memory, e.g. QSPI.
This commit adds an optional argument to the West jlink runner,
'--loader' which passes the information to the jlink client.
This change is backward compatible with versions of jlink older
than v7.70d which introduces the CLI change.
Fixes: #50327
Signed-off-by: Yves Vandervennet <yves.vandervennet@nxp.com>
When using west runners with multi domains we want to warn users when
they user runner args on multi domain builds.
Therefore fix the `>1` to the correct `>0` which ensures the warning
is printed in all expected cases.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
As part of the overall work on improving west integration with Zephyr,
add support for zsh completion in the `west completion` command.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
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>
Allows to use the stm32cubeprogrammer runner on Linux to be executed
from any installation directory as long as the executable is found
in PATH.
Until now on Linux the programmer could only be used if it either has
been installed in the default location or if the executable path was
passed via the cli parameter.
Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
In preparation for the handling of taint flags in zephyr_module.py, move
blob-processing code from the west command to it.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Turns out that `Namespace.format` was not a good fix to the issue
described in f033040812, it was returning
the default format even when the user specified -f/--format.
Replace "getattr" with a simple logical operation.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
There were two issues with the original commit
e04487cad2:
- getattr() doesn't seem to work properly with args
- Comparison between bound methods with "is" seems not to work, so
replace it with a simpler string comparison
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Make some no-op log messages require 'west -v blobs ...'.
The current implementation won't scale as the number of blobs goes up.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This option does not apply to 'west blobs clean' or 'west blobs
fetch'. Error out if it is given to either of those.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Make it consistent with the usual argparse style by using lower case
and no period at the end.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The help text is mixing up 'blobs' with 'modules', and doesn't
document the new behavior that uses all modules when nothing is
mentioned. Fix both issues.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Without this patch, "west blobs -h" says:
{list,fetch,clean} Select the sub-command to execute. Sub-commands
available: - list: list binary blobs - fetch: fetch and store binary
blobs - clean: remove fetched binary blobs
With this patch:
{list,fetch,clean} sub-command to execute
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
It looks like the latest release, 0.14.2, changed the contents of
JLINK_SDK_NAME as it was before 0.14.0 release. That means that the
previous fix is only applicable to a couple of releases: 0.14.0/0.14.1.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The introduction of sysbuild and west build / flash / debug / etc.
support raises questions regarding how to handle user specified runner
arguments.
Some arguments may be acceptable for all domains, whereas others are
only valid for a single or few domains in a multi domain build.
Therefore, consider the usages of runner specific options experimental
when applied to multiple domains.
The following warning is printed to the user when using runner specific
arguments on multiple domains:
> WARNING: Specifying runner options for multiple domains is
> experimental.
> If problems are experienced, please specify a single domain using
> '--domain <domain>'
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
The `<module>/zephyr/blobs/` folder, as well as any additional
sub-folders that might be required under `blobs/` may not exist when
fetching a blob. Ensure that the folder exists, create it if it doesn't.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
The new "clean" blobs sub-command deletes any blobs present on the
filesystem.
Also improve the help text for sub-commands.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
To align with other commands, such as "west update", convert the
accumulative -m option into an nargs="*"-type one that takes the list of
modules directly without a flag.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Instead of both listing and fetching only the blobs in the
modules listed by the user in the command-line, default to
listing/fetching them all for ease-of-use and consistency with other
commands. Remove the --all options since it's meaningless now.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Remove ZEPHYR_BASE as default root in list_boards.py.
This allows list_boards.py to be used to only print boards at given
root(s) without printing Zephyr default boards.
Secondly it remove the need in list_boards.py to have any knowledge of
ZEPHYR_BASE.
The `west boards` command already has ZEPHYR_BASE knowledge and can
easily add ZEPHYR_BASE to the list of roots it is already constructing,
thus removing the need for knowing that ZEPHYR_BASE is always added.
Update boards.cmake to pass ZEPHYR_BASE as an additional arch root, as
arch.cmake has not yet been processed,which means ZEPHYR_BASE is missing
in ARCH_ROOT list at this point in time.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Add parameter for possible extending in the future, --tool-opt
passes arguments to execution of the run service.
Ex.
--tool-opt=--arg='white space' --tool-opt=-r --tool-opt=12345
will be parsed as ['--arg=white space', '-r', '12345']
Signed-off-by: Enjia Mai <enjia.mai@intel.com>
Add specifying the port for the remote cavstool remote service.
Ex.
west flash --remote-host {host}:{port} \
--pty {host}:{port}
Specify the port is optional when running west.
And another major change is now we have to specify the remote log
service by --pty to make it output the log message immediately.
Previously it will output directly. Why we make this change is
because this is more close to the behavior we use west flash.
Fixes. #46865
Signed-off-by: Enjia Mai <enjia.mai@intel.com>
This patch introduces the basic infrastructure to list and fetch binary
blobs. This includes:
- The new 'blobs' extension command
- An implementation of the `west blobs list` command
with custom formatting
- A very simple mechanism for loading fetchers
- A basic implementation of an HTTP fetcher
In order to ensure consistency among the west extension commands in the
main zephyr tree, we reuse a similar class factory pattern that is present
for ZephyrBinaryRunner instances in the ZephyrBlobFetcher case. This
could be achieved with a simpler mechanism, but opted for consistency
before simplicity.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
The boards command was not properly using the zephyr_module
functionality to obtain the board roots of all modules. Fix that by
moving the functionality required to the core zephyr_module file and
reuse it from external scripts.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
pylink 0.14.0 changed the class variable where JLink DLL library name
(libjlinkarm) is stored. This patch adds support for new pylink
libraries while keeping backwards compatibility.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit extends the west commands build, flash, and debug to support
--domain when having multiple domains (images) defined in a domains.yaml
build file.
The domains.yaml uses the following yaml format to specify the
build directory of each domain in the multi image build:
> default: <domain-n>
> domains:
> <domain-1>:
> build_dir: <build_dir-domain-1>
> <domain-2>:
> build_dir: <build_dir-domain-2>
> ...
`west <build|flash|debug>` has been extended to support
`--domain <domain>`.
`west build` calls CMake to create the build system, and if `--domain`
is given, then the build tool will be invoked afterwards for the
specified domain.
`west flash` will default flash all domains, but `--domain <domain>`
argument can be used to select a specific domain to flash, for example:
> west flash --domain mcuboot
`west debug` only a single domain can be debugged at any given time.
If `--domain` is not specified, then the default domain specified in the
domains.yml file will be used.
Users can still select a different domain, for example with:
> west debug --domain mcuboot
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
west build now support the sysbuild CMake project which allows users
to easily enable and build a bootloader together with any sample.
This will allow for cleaning up samples and boards which already does
custom multi image in a non-generic way, for example:
- mps2_an521 which includes a build for remote board
- samples/ipc/ which includes a samples for remote board
- esp32 which includes custom bootloaders
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
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>
Following changes has been made by this commit:
- fix issue when a binary is not able to be found by relative path
- implement "west debug" command
- implement --dt-flash option
Signed-off-by: Alex Kolosov <rikorsev@gmail.com>
A variable set by the user with `-DVAR=<val>` will be given the type
UNINITIALIZED.
This results in the variable not being read into the cmake_cache.
Support reading of CMake cache variables of type UNINITIALIZED.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
west flash invokes west build and we have no way to tell whether there
was any code change.
Also remove the rename() trick that achieved the same effect in a
a confusing way; just use copy() instead.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
When there is no rimage found in the path, don't invoke west sign with
"-tool-path None". This enhances the error message from the somewhat
cryptic:
ERROR: --tool-path None: not an executable
... to the user friendlier:
FATAL ERROR: rimage not found; either install it or provide --tool-path
Also log the complete west sign command at the "info" level before
running it to show that no signed firmware was found, to show which
rimage is used and in case other rimage problems arise. Invoking an
external command is an important "checkpoint".
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
When a hex file contains some data that needs to be programmed using
the QSPI peripheral (because it targets the XIP region), nrfjprog
needs to be provided with an option that specifies the QSPI erase
method to be used (otherwise, reprogramming will fail).
This commit adds the "--qspisectorerase" option when needed and it
also fixes the programming routine for nRF53, so that data for the
XIP region is not incorrectly interpreted as intended for the network
core.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Running west flash with the --openocd-search arg will result in the
openocd command being run with a -s param added for every character in
the passed DIR.
Fix the argparser to append all openocd-search DIRs into a list, instead
of just passing a string to the subcommand.
Signed-off-by: Jeremy Bettis <jbettis@google.com>
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>
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>
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>
Provide a way to specify the openocd target script handle used to
describe the core target.
In most target scripts '_TARGETNAME' is used, but it can happen that
'_TARGETNAME.foo' or '_CHIPNAME.bar' is used, specially on SoCs subject
to multicore.
Today, this option is required to enable rtos thread awareness,
using '$_TARGETNAME configure -rtos Zephyr' command, which is generated
by this runner.
It could be useful for similar needs in future.
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
The builtin list function `.sort()` sorts the list in-place and returns
None. As this is an invalid type for iteration, use the builtin `sorted`
function, which returns a sorted copy of the list, which we can iterate
over.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
When updating `sys.path` to allow importing the pickled edtlib instance,
add the path to the front of `sys.path`, not the end. This ensures that
the `devicetree.edtlib` module that is imported is the one relative
to the files being run, not some other version which may exist on the
path.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
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>
The list of files which are included in the `build.spdx` SPDX SBOM document
is based on the files recorded as build artifacts based on the CMake
file-based API metadata response.
In some situations, such as the case indicated in #42072, a build artifact
may be reported by CMake but no such file is present on the system
following the build. This results in the `build.spdx` SPDX SBOM being
invalid, as a result of trying to provide metadata for a non-existent
file (and specifically being unable to provide its checksum).
This commit fixes this bug by omitting files from `build.spdx` if they
do not exist on disk after the build is complete, even if the CMake
metadata claims that they should. The resulting SPDX document should
then be valid.
Fixes#42072
Signed-off-by: Steve Winslow <steve@swinslow.net>
Replaced hard-coded delay by wait for response during ICEman
connection.
Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
Signed-off-by: Alex Kolosov <rikorsev@gmail.com>
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>
west build supports specifying the board revision using @revision, but
it's not mentioned in the help text. This commit updates the help text
to describe how to specify the board revision.
Signed-off-by: Gregers Gram Rygg <gregers.gram.rygg@nordicsemi.no>
The -c option points rimage at its main and mandatory configuration
file ("signing schema"). The -c option passed by sign.py to rimage comes
from _two_ different places:
A. From the command line, example:
west sign -t rimage -- OTHER_ARGS_FOR_RIMAGE -c foo.toml
However passing -- -c signing_schema.toml on the west sign command line
has always been optional because:
B. west sign systematically adds another `-c bar.toml` option. The name
'bar' is found in the CMakeCache. Right now 'bar' comes from
a product specific `board.cmake` file.
There were two problems fixed by this commit:
1. The -c option from the command line was passed _first_ but the last
-c wins with rimage. The command line should have precedence.
2. The "last -c wins" behavior is not documented/official, it's an
rimage implementation deteail.
To fix both, simply scan the command line for a '-c' option. If any is
found then it takes precedence over the CMakeCache-based value which is
dropped.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
When using the west spdx functionality to create an SPDX SBOM
during a build, several SPDX Documents are created. In some
instances, the SPDX metadata field PackageLicenseInfoFromFiles
is required to be present according to the SPDX 2.2 spec, but is
being omitted from the build.spdx Document if no licenses were
detected.
This commit fixes this bug so that a NOASSERTION value is written
for this field for Packages that do not contain any detected
licenses.
Additionally, this ensures that Packages with a FilesAnalyzed
value of false do not have this field written, also in accordance
with the spec.
Fixes#42070
Signed-off-by: Steve Winslow <steve@swinslow.net>
CONFIG_OPENOCD_SUPPORT was deprecated in favor of
CONFIG_DEBUG_THREAD_INFO in Zephyr v2.6.0 and can now be removed.
Signed-off-by: Maureen Helm <maureen.helm@intel.com>
This print() call was introduced as part of commit 16571db029 ("soc:
esp32: add support to mcuboot build") probably as a leftover from
debugging stage. Remove that, so flash command is not printed by
default. Those commmands can be easily printed by passing -v flag to
`west -v flash ...` command.
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
Whenever build/zephyr/runners.yaml does not specify the location of the
openocd executable we seemd to be leaving the executable variable as
None. Instead, use its executable name.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Select configuration when mcuboot is enabled.
At this moment, only UNSIGNED image is supported as per
Espressif's mcuboot porting.
This also updates esp32 runner to use proper bin_file name
and updates default bootloader check.
Move CMakeLists.txt content from board to soc directory
as this support is for esp32 architecture and not board
specific.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
IDF bootloader requires partition table which is not a requirement for
MCUboot. Hence, esp32.py is updated to flash partition table only if it
exists.
Current implementation only allows flashing zephyr.bin. This commit adds
capability to flash binaries with other names as well
(e.g. - zephyr.signed.bin)
Signed-off-by: Shubham Kulkarni <shubham.kulkarni@espressif.com>
The presence of a separate build for the bootloader code has always
been a wart with this platform. Sharing of code between the two has
required great care. We've had bugs with mismatched include paths,
macro definitions and compiler flags, etc... And of course it's not
possible for one to see the other; in theory we'd like the ability to
call back into IMR code after startup, to use the space for temporary
storage, etc...
So let's finally do it. This really isn't that complicated when you
see it in isolation:
+ Move the module manifest metadata into an "rimage_modules.c", and
put them in their own NOLOAD section where we can grab them later
with objcopy.
+ Make a new "imr" memory region in the main linker and just paste the
bootloader linkage (which is now using its own specific sections) in
there.
+ After zephyr.elf is built and cache-remapped, we can extract the imr
sections and the appropriate manifest for the bootloader rimage
module, and then do the converse by excluding them for the main
image module.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
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>
Add yet another option, --verify-only, to west flash. This option
runs openocd with verify_image but without load_image.
Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
OpenOCD has verify_image command. Add `--verify` option to west flash
so that openocd can do vierfy_image right after load_image.
Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
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>
Removes hardcoded logic in the west signing script that translates
Zephyr board names to rimage target names. Instead, use a cached CMake
variable set at the board level to define its respective rimage target
name. This eliminates the need to modify the west signing script when
new SOF-supported boards are introduced to Zephyr.
Signed-off-by: Maureen Helm <maureen.helm@intel.com>
Fixes the following error:
ERROR: Build directory "<whatever>" is for application "<symbolic source
dir in CMakeCache.txt>", but source directory "<resolved source dir>"
was specified; please clean it, use --pristine, or use --build-dir to
set another build directory
FATAL ERROR: refusing to proceed without --force due to above error
Fixes initial commit ab82264ace ("scripts: add west build, flash, and
debug commands")
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
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>
Add "ExitOnError 1" argument that treats any command-error
as fatal thus in the case of a programming error the "west flash"
command will return the correct error code instead of the default 0. It
fixes the false positive return codes when e.g we call west flash
command without a connected programmer or with the disconnected board.
Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
Always add the boards/<arch>/<board>/support directory to the OpenOCD
runner search path if the directory exists.
This simplifies using custom --config <partial-board.cfg> runner
arguments without having to use the full path to the cfg file.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Currently, west spdx --init uses os.mknod to create an empty file
to enable the Cmake file-based API system. As reported in #39311,
Python on Windows does not implement os.mknod.
This commit switches to using open()/close() instead of os.mknod()
to address this issue.
Signed-off-by: Steve Winslow <steve@swinslow.net>
#38557 Reordered the argument for openocd, but we should not try
to call the init command before giving the board configuration
file stored in 'self.cfg_cmd'.
Move back this variable to it's original position.
Signed-off-by: Julien Massot <julien.massot@iot.bzh>
Commits 49bcc08033 introduced
a possible None object 'gdb_init', do not try to iterate over
this variable if it is a None object.
Signed-off-by: Julien Massot <julien.massot@iot.bzh>
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>
In order to allow for further options to be deprecated with minimal
impact, add a deprecation argparse Action and a callable instantiator
that can be used to deprecate options in favor of new ones.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
In an effort to standardize the way that a particular debugger or device
instance is identified when there are multiple present, introduce a new
-i/--dev-id option common to all runners that allows the user to specify
which device to interact with when there are multiple connected.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Debugging ESP32 SoCs is not possible if the commands
halt, target and load are enabled by default.
This MR allows this configs to be used as input parameters.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
If --no-manifest is specified, '-e' is still being passed
to rimage to build the extended manifest. Fix this so
that when --no-manifest is specified, '-e' is no longer
passed to rimage.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Add support for signing i.MX8QXP SOF with Zephyr images with rimage.
i.MX8QXP and i.MX8QM have the same board-level definitions,
so we use the generic imx8.
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
When enable thread awareness feature for OpenOCD the search path was
converted to a list. In some environments OPENOCD_DEFAULT_PATH may
not be defined. That create an empty search path list system fails.
This add a test to skips fill search_args with openocd_search values
when list is empty.
Fixes#38272.
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Add support for signing i.MX SOF with Zephyr images with rimage.
Note that, for i.MX, we don't need a bootloader nor the .elf.mod files
since there is no need to change the VMA/LMA of each uncached section
to the equivalent address in the cached area of memory.
For the above reasons, I've updated the arguments given to "west sign"
command.
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Add support for specifying a custom OpenOCD command to be used for
resetting and halting a target.
As noted in the OpenOCD documentation, not all targets support the
"reset halt" command for halt-on-reset.
Some targets support a software emulation via the "soft_reset_halt"
command. Other targets may require a custom command (e.g. a command
defined in the target configuration file).
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
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>
Some targets require no 'halt' to be issued i the gdb server command.
Add a --no-halt option to make it possible.
Keep use of halt as the default case.
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Add support for passing the --config argument to the openocd west runner
multiple times.
This allows for using modular openocd configuration files (e.g. CPU core
configuration in one file, independent of the selected JTAG interface
type).
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
Handle serial numbers provided from the command-line instead of forcing
the user to provide 'tool-opt' manually.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Current default serial port used for flashing is
/dev/ttyUSB0. This changes that to automatically detect the device
serial port or uses the one exported to the environment.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
So far only upstream boards were listed. Use just introduced
zephyr_module.parse_modules() function to get information about
out-of-tree board roots. Append them to user provided args.board_roots,
so out-of-tree boards from west modules are listed as well.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
by adding the soc specific files such: soc initialization code,
linker scripts and support for esp32c3 devkitm
Signed-off-by: Felipe Neves <ryukokki.felipe@gmail.com>
Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
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>
So when for instance adding some `import wrong_module` line to a sample
runner like bossac.py this adds the text between parentheses ( ) below:
The module for runner "bossac" could not be imported (No module named
'wrong_module'). This most likely means it is not handling its
dependencies properly. Please report this to the zephyr developers.
Test tip: changes to bossac.py do not trigger a fast, incremental doc
build. touch doc/guides/west/build-flash-debug.rst does it instead.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Allow the use of build configurations from testcase/sample yaml files.
This addition makes it easy to build a sample or a test with the options
provided in the test file by pointing to the test section to be built on
the command line of `west build`.
Fixes#31993
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
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>
Fixes compatibility with the Arduino bootloader reset mechanism when
using `west flash` on Darwin hosts.
stty is used to set the serial port in the bossac runner to 1200 baud on
Arduino ATSAMD21 bootloaders. The `-F` argument to stty is a GNU
coreutils addition, and thus it is missing from Darwin's BSD stty, so
change the flag to `-f` when we're not running on Linux.
On Darwin, set DEFAULT_BOSSAC_PORT to None and ask the user to select
one from a list of IOCalloutDevices reported by ioreg, modelled on the
get_board_snr from the nrfjprog runner. This is because serial port TTYs
are generated by the device driver, and therefore there is no safe
default.
Tested with an Arduino Nano 33 IoT board.
Signed-off-by: George White <me@galexite.uk>
Fix bug where if `CONFIG_BOOTLOADER_MCUBOOT` is set sign.py incorrectly
shows warning `CONFIG_BOOTLOADER_MCUBOOT is not set to y...`.
Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
This adds support to generate SPDX 2.2 tag-value documents via the
new west spdx command. The CMake file-based APIs are leveraged to
create relationships from source files to the corresponding
generated build files. SPDX-License-Identifier comments in source
files are scanned and filled into the SPDX documents.
Before `west build` is run, a specific file must be created in the
build directory so that the CMake API reply will run. This can be
done by running:
west spdx --init -d BUILD_DIR
After `west build` is run, SPDX generation is then activated by
calling `west spdx`; currently this requires passing the build
directory as a parameter again:
west spdx -d BUILD_DIR
This will generate three SPDX documents in `BUILD_DIR/spdx/`:
1) `app.spdx`: This contains the bill-of-materials for the
application source files used for the build.
2) `zephyr.spdx`: This contains the bill-of-materials for the
specific Zephyr source code files that are used for the build.
3) `build.spdx`: This contains the bill-of-materials for the built
output files.
Each file in the bill-of-materials is scanned, so that its hashes
(SHA256 and SHA1) can be recorded, along with any detected licenses
if an `SPDX-License-Identifier` appears in the file.
SPDX Relationships are created to indicate dependencies between
CMake build targets; build targets that are linked together; and
source files that are compiled to generate the built library files.
`west spdx` can be called with optional parameters for further
configuration:
* `-n PREFIX`: specifies a prefix for the Document Namespaces that
will be included in the generated SPDX documents. See SPDX spec 2.2
section 2.5 at
https://spdx.github.io/spdx-spec/2-document-creation-information/.
If -n is omitted, a default namespace will be generated according
to the default format described in section 2.5 using a random UUID.
* `-s SPDX_DIR`: specifies an alternate directory where the SPDX
documents should be written. If not specified, they will be saved
in `BUILD_DIR/spdx/`.
* `--analyze-includes`: in addition to recording the compiled
source code files (e.g. `.c`, `.S`) in the bills-of-materials, if
this flag is specified, `west spdx` will attempt to determine the
specific header files that are included for each `.c` file. This
will take longer, as it performs a dry run using the C compiler
for each `.c` file (using the same arguments that were passed to it
for the actual build).
* `--include-sdk`: if `--analyze-includes` is used, then adding
`--include-sdk` will create a fourth SPDX document, `sdk.spdx`,
which will list any header files included from the SDK.
Signed-off-by: Steve Winslow <steve@swinslow.net>
Support this when debugging also.
Tweak the style for brevity also while we're here by propertizing the
supports_nogui method, etc.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This makes it easier for runners to check if the binary has thread
info support turned on, allowing automatic configuration of the
underlying tool to support threads, if possible.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Set options that are definitely true or false to True or False in the
options dict. Add a 'getboolean' method that also allows a fallback to
False in case the option is not mentioned in .config due to unmet
dependencies. This allows calling code to just ask about the option
they are interested in, even if the .config file doesn't mention the
option at all.
Propagate this to users within the runners package and 'west sign',
taking advantage of the new build_conf property.
Rename the 'bcfg' internal variable in sign.py to 'build_conf' to
match other source files that use BuildConfiguration instances, to
make it easier to grep for users.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
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>
This is really verbose, and I doubt anyone cares unless there is a
problem. Keep it around when run as 'west -v flash' to allow for
debugging, though.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Defer loading .config until we really need it, when we are flashing a
binary. Pre-emptively loading it is wasted effort if we're flashing a
.hex, which has been the default behavior when possible since
dcaabb860f ("west: runners: jlink: prefer .hex over .bin").
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Put it all in one log message rather than splitting it up.
This makes it look cleaner now that each log message is prefixed with
'runners.link:'.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
JLink versions like 'V7.0a' do not conform to PEP 440 version
conventions; the 'a' part is used by PEP 440 compliant versions for
alphas. It gets parsed to a legacy type by the packaging library,
which always is treated as a lower value when compared with a
conforming version string.
To fix, get the version from the shared library distributed with the
JLink tools. This has the side benefit of making the code work on
Windows. That's merely a nice to have for -nogui 1 detection for now,
but will be essential in the next commit.
Reported-by: Jake Mercer <jake.mercer@civica.co.uk>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Make it easier to get a BuildConfiguration from runner code.
Stash the result so it only has to be computed once.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This option has existed since the beginning of the runners package,
which greatly predates the way DT is used in zephyr right now. It
never really worked the way I wanted it to but it's too much work to
fix it now. Try to improve the help a bit at least while I'm looking
at it again.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Copy a fix from test_nrfjprog.py to the other runner test suites. The
current code will enter an infinite recursion if you hit the path
where os.path.isfile is called, since it's been patched to
os_path_isfile_patch in the calling context. The fix is to cache the
'real' version in the parent scope and call it directly as a fallback.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Today, there is a build target is added for each runner: flash, debug,
debugserver, attach.
And those runners will have a dependency to Zephyr logical target that
is built before invoking `west <runner>`.
This design has some flaws, mainly that additional dependencies directly
on the target will not be built when running `west <runner>` directly.
That generator expressions cannot be used for the DEPENDS argument.
Instead, the build target `<runner>` will not have any dependencies, and
will raise a build error if a dependency is added to the target.
Due to how `add_dependencies()` work, this must be done as a build time
check, and not configure time check.
`west <runner>` will invoke a build before executing the runner, and
this way ensure the build target is up-to-date, which again removes the
need for a dedicated `west_<runner>_target`.
It also minimizes the risk of developer errors, as developers no longer
need to consider the need for adding additional dependencies.
If a custom target is part of the default `all` build, then it's ensured
to be up-to-date.
Fixes: Issue reported on slack.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
The commit fixes problem with nrfjprog runner for west flash,
that has been introduced with latest changes to BuildConfiguration
class.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The ImgtoolSigner.sign() is passed a BuildConfiguration object instance
that holds all of Kconfig options that have been defined for a build;
yet it has been reading the .config file once again, with the
load_dot_config, to check some of these options.
The commit replaces the code that has been using the load_dot_config
obtained data with the code that uses the BuildConfiguration object.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The body of load_dot_config method has been reimplemented in
BuildConfiguration.get(), replacing the previous code.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The BuildConfiguration.path attribute has been added that stores path
to .config file which has been used as source for options collected to
BuildCOnfiguration object.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
PR #33746 introduced changes to the devicetree python file
that requires changes in the python code that imports the
devicetree module.
This was omitted in the west sign command implementation.
Signed-off-by: Mikkel Jakobsen <mikkel.aunsbjerg@prevas.dk>
We are now in the process of extracting edtlib and dtlib into a
standalone source code library that we intend to share with other
projects.
Links related to the work making this standalone:
https://pypi.org/project/devicetree/https://python-devicetree.readthedocs.io/en/latest/https://github.com/zephyrproject-rtos/python-devicetree
This standalone repo includes the same features as what we have in
Zephyr, but in its own 'devicetree' python package with PyPI
integration, etc.
To avoid making this a hard fork, move the code that's being made
standalone around in Zephyr into a new scripts/dts/python-devicetree
subdirectory, and handle the package and sys.path changes in the
various places in the tree that use it.
From now on, it will be possible to update the standalone repository
by just recursively copying scripts/dts/python-devicetree's contents
into it and committing the results.
This is an interim step; do NOT 'pip install devicetree' yet.
The code in the zephyr repository is still the canonical location.
(In the long term, people will get the devicetree package from PyPI
just like they do the 'yaml' package today, but that won't happen for
the foreseeable future.)
This commit is purely intended to avoid a hard fork for the standalone
code, and no functional changes besides the package structure and
location of the code itself are expected.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The jlink runner performs a version check which is skipped on
Windows. If running inside WSL we also need to skip.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Allow a custom (remote) gdb host passed as a debug argument
which tries to connect to an existing one instead of creating one.
This also allows to run the gdb server outside of a WSL
in Windows and the debugger inside of the WSL environment.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
The nrfjprog utility is not capable of flashing a hex file which
affects the flash memories of both coprocessors of the nRF53 family of
SoCs.
However, the user is capable of creating such a hex file using the
HEX_FILES_TO_MERGE build system variable.
An example use case is to build a bluetooth controller application for
the network core, then use the zephyr.hex file in that build directory
as the HEX_FILES_TO_MERGE argument for a separate Bluetooth
application build targeting the app core.
Work around this by detecting the situation and doing the right thing
by splitting the hex file back up again, even if thats a bit awkward.
Splitting the hex into app and network core components allows them to
be flashed separately. This is the only way we can get the job done
with nrfjprog.
This is arguably nicer since there's just one 'west flash' invocation.
At least in the use case named above, you wouldn't need to rebuild the
controller application very often, so this is a simpler user workflow.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
We need all available runners to be defined as subclasses of
runners.core.ZephyrBinaryRunner in order to be able to look them up by
name at runtime. We do this by importing them from runners.__init__.
This process periodically fails when some runner or other cannot be
imported, usually because it is trying to import something outside of
stdlib and not handling ImportError.
Rather than letting this bring down the entire Python process, catch
and log the error. Sort the list again while we're here.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Runners may not import anything outside of stdlib unless they handle
the possible ImportError.
Apply this rule to the bossac runner. The general pattern is to have a
MISSING_REQUIREMENTS global that we handle at the beginning of
do_run(), but in this case this isn't a missing pip package, but a
misconfiguration. Just log a warning; it won't happen in practice.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Runners can (and many should) depend on the devicetree to decide what
to do, especially as it relates to the flash layout. Make it so that
they do not have to manipulate sys.path to get a hold of the edtlib
directory by doing it in one place, before importing any of them.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>