rimage always requires a key argument even when it does not use it.
Some configurations (IMX) use rimage only for "stitching" the image but
not for signing. These were failing to build directly from west with
pretty cryptic stack trace, see below. This has never been a problem for
the SOF project because it has always worked around this rimage
limitation by providing a bogus -k argument - very much like the one
added by this commit.
```
File "zephyrproject/zephyr/scripts/west_commands/sign.py", in sign
extra_ri_args += [ '-k', str(sof_src_dir / 'keys' / cmake_default_key) ]
TypeError: unsupported operand type(s) for /: 'PosixPath' and 'NoneType'
ninja: build stopped: subcommand failed.
```
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Internal bootloader will only run application image if valid product
header is present on flash. This means product header is required for
application that are not linked to code partition. Other applications
that are linked to code partition are meant to be run by MCUboot and
should not touch product header, with the exception of MCUboot itself
which is also run by internal bootloader so requires product header.
Default flash load offset for applications not linked to code partition
is set to 0x2400 as this is where internal bootloader looks for an
application image to run based on product header written by flasher.
Flash load offset for MCUboot is set from boot partition.
Valid product header is added by ezFlashCLI when using "flash_image"
command.
Co-authored-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
Signed-off-by: Niek Ilmer <niek.ilmer.aj@renesas.com>
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>
sign.py has an internal and indirect way to compute a default -c signing
schema option and pass it to rimage. It is built by appending
`$platform.toml` to whatever `rimage/config/` location was
found. Defaults are very convenient but in this case this computed -c
option can conflict with an explicit -c option spelled out by the user.
Scan for any explicit -c coming directly from the user. If any found,
ignore the default we computed. This is what is already being done for -k.
The precedence across rimage parameters coming from different places is
too complicated. Not passing multiple -c options simplifies the logic a
little bit.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Adds a Kconfig option which controls the version of the application
to use when the image is signed using imgtool.
When an application VERSION file is present, the default value will be
identical to the application version, else it will be 0.0.0+0, but a
project may still decide another value, if it so prefers.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Adjust WEST_PYTHON to posix path to be consistent with other Python
scripts which passes paths to the Zephyr CMake build system.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
The now legacy --nrf-family parameter takes the "raw" family name as
nrfjprog accepts it. But now we use an intermediate representation with
{FAMILY}_FAMILY as the format, so covert to it as required.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
- 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>
The '%ProgramFiles%' is not guaranteed to be 'C:\Program Files' on
Windows x64.
The value will be 'C:\Program Files (x86)' if the west is executed by
32-bit Python.
To correct the issue '%ProgramW6432%' must be used.
Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
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>
- 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>
Add support for Nordic's new nRF Util tool, aka nrfutil. Via its
"device" command, nrfutil now supports most of the functionality offered
by nrfjprog.
The tool itself can be found here:
https://www.nordicsemi.com/Products/Development-tools/nrf-util
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
In order to better support the ability of the upcoming nrfutil runner to
defer all operations and execute them all at once, defer flushing right
until the end, when everything has been queued up (recover, program and
reset) instead of forcing execution at the program stage.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Standardize to nrfutil error codes instead of nrfjprog ones. This is
because nrfutil has a wider range of functionality and will eventually
be the default runner for all nRF devices. It is also consistent with
the internal operation representation, which is now using the nrfutil
format already.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Invoking `west sign` in `west build` accelerates twister because `west
build` is run in parallel, see rationale in superseded and very
different (CMake-based) PR #52942.
To maximize backwards compatibility:
- `west sign` is optional in `west build`
- `west flash` will sign (again) if any rimage --option is passed
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Moving `west sign` from `west flash` to `west build` for rimage has
multiple advantages (including a bit more consistency with
imgtool). However it makes `west build` fail when rimage is missing.
To avoid forcing every CI and developer who never used it before to
install rimage, make signing optional when passing new `west sign`
option --if-tool-available. A clear warning is printed.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Make RIMAGE_SIGN_KEY a CMake CACHE variable so `west sign` can find it
and use it as a default value.
Fixes https://github.com/thesofproject/sof/issues/6917
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Reduce duplication, no functional change except for a shorter log
statement with slightly less information.
This is required by the next commits.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
The --tool parameter is not required anymore thanks a [sign] entry in
west config like this one:
```
[sign]
tool = imgtool
```
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
An explicit import of edtlib is not required when using
pickle.load() and creates a duplicate module object.
Local testing shows that pickle.load() throws the ModuleNotFoundError if
the sys.path cannot find the edtlib or associated modules.
Signed-off-by: Keith Short <keithshort@google.com>
Add an escape hatch so users can insert a customizable delay
between asking the board to reboot into bootloader mode and
trying to program the new image. This lets people account for
OS-specific enumeration time done after the board resets.
Fixes: #56540
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Writing '-S foo' is a convenience shorthand for adding snippets at
CMake time without having to add '-- -DSNIPPET=foo' to the west build
command line. It is worth adding a new one-letter command line option
because snippets are anticipated to be a very commonly used feature.
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
the options --verify and --verify-only where only used when flashing elf
files and were ignored for flashing hex files for example when using
openocd runner.
The command to verify the image is now dependant on the presence of
--verify or --verify-only, and the load command is not executed if
--verify-only is provided.
Signed-off-by: Nicolas VINCENT <nicolas.vincent@vossloh.com>
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>
The QSPI erase switch is not part of the "firmware" dict, but rather
placed in the overall operation dict.
Fixes#55625.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Fixes#37538 by correctly detecting WSL and blocking bossac from running
on that platform, but allowing it to run on Windows native.
Signed-off-by: João Dullius <joaodullius@bpmrep.com.br>
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>
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>
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>
Allow for multiple levels of inheritance in the runners in order to make
it possible to share common infrastructure in similar runners.
Also check if the class can be instantiated (i.e. it is not abstract) to
avoid returning abstract base classes.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
MCUmgr no longer uses DTS node property label to identify
slots for image upload and running application. It now uses DTS node
labels for that purpose.
This commit moves `west sign` from using label properties
to DTS node labels, same way the MCUmgr does.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
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>
This commit fixes#54492 where return code 1 is returned
when twister tests fail when twister is called directly and
return code 0 in similar scenario but twister is invoked using
west.
Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
This is a partial revert of commit
2cee5ff519
("scripts: west_commands: runners: remove deprecated options").
I remarked at the time that the removal of the older way of writing
things from the runners themselves seemed gratuitous since they are
easy to continue to support indefinitely and people may have been used
to the old way of doing things. It didn't seem worth the fight to push
for a revert at the time, though.
Since then I've run into real problems that their removal has caused
in the wild and I am convinced that this part of that patch was wrong.
Restore the original, undeprecated forms of these options, but make it
clear in the command line help that they're just obsolete alternative
spellings at this point.
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
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>
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>
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>
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>
This will allow something like this:
west build -b qemu_x86 -T samples/hello_world/sample.basic.helloworld
instead of:
cd samples/hello_world
west build -b qemu_x86 -T sample.basic.helloworld
Using this option will allow to take twister output and just pass it to
west to reproduce failures.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
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>