Added automatic KMU key provisioning, when keyfile.json
file exists in the build directory.
This enables automated key provisioning during the
flashing process to enable testing nRF54L aplications using Twister.
Only applicable on nrfutil runner.
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
The code invoking nrfutil was not checking the return code of the
subprocess, which meant that if the underlying tool was exiting with a
failure error code it remained undetected.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
The erase mode for any external memory that is mapped to the address
space of the MCU is derived from the internal non-volatile memory erase
mode. In order to allow users to override the default value, add a new
--ext-erase-mode command-line option that takes an erase mode just like
--erase-mode does.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Instead of providing an `--erase-pages` command, generalize it to a new
`--erase-mode` one that can be set to `none`, `ranges`, or `all`. This
gives the user full control over the erase mode that will be passed on
to nrfutil.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
The Nordic nRF54L series ICs use RRAM instead of flash. This implies
that erasing the internal storage before writing the new firmware is not
required anymore (unlike NOR flash, which does).
Note that RRAM on nRF54L devices is not physically paged, and paging is
only artificially provided, with a page size of 4096 bytes, for an easier
transition of nRF52 software to nRF54L devices.
In order to speed up the flashing operation and avoiding doing wasteful
write operations on the RRAM, default to ERASE_NONE for ICs in these
series.
A new ``--erase-pages`` command-line switch has been added to allow
users to keep erasing the pages that will be written to the firmware.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
In order to enable the use case where the underlying flash tool supports
bulk-flashing using multiple device IDs, augment the core runner class
with this new runner capability and implement it in the nrfutil runner,
since the nrfutil tool supports it natively.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This acts in a similar way to nrfjprog's --qspiini parameter introduced
in 7eb364b, but works slightly differently in nrfutil: it requires a
config file in JSON format instead of .ini, and it is passed along to
the `execute-batch` command instead of providing it together with the
`program` command.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
The Nordic nRF52 series have a peculiarity that is not shared with any
other Nordic families of SoCs: the reset pin can be reconfigured as a
regular GPIO. This has an unintended consequence: if the user has
reconfigured the pin in Devicetree to be a GPIO, `west flash` will
override that and configure the IC to use it as a reset pin, and the
firmware at boot won't be able to switch it back to GPIO, because that
requires a UICR erase. This behavior is very confusing to users, because
the GPIO does not work at all, since it is now just a reset line.
With this patch, `west flash` defaults to using soft reset instead of
pin reset for the nRF52 family of devices, to avoid overwriting the
reset pin configuration that the user includes in the image.
In order to be able to continue to use pin reset for users that so
desire it, a new option `--pinreset` is added that forces the use of pin
reset. The existing `--softreset` option is left exactly as it was, but
it is now applicable only to families other than the nRF52.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
The `erase` command was being used but there was no "backend"
implementation for it in nrfutil nor nrfjprog. Simplify the syntax and
implement it for both tools.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Instead of pre-generating the JSON batch to then execute it, use
command-line arguments and --x-append-batch to generate the JSON file
tht will then be passed to x-execute-batch.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
With the recent introduction of the SUIT manifest starter binary blob,
it is now possible to use it with the nRF54H20 during the flashing
procedure in order to provide a valid SUIT manifest to the system.
This PR introduces the code that handles programming the SUIT manifest
starter, as well as a new --suit-manifest-starter command-line option.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
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>
nrfutil runner uses the batch-mode, so no live feedback is provided to
the user. However, batch-mode reports batch progress containing
human-readable strings of the operation being done. This patch changes
the _exec() implementation to parse the subprocess output in real-time,
logging to info the 'batch_update' reports. Note that only the first
batch update of a sequence (percentage = 0) is logged because first,
percentage resolution seems to be pretty bad, and, because logging
messages cannot be easily _appended_.
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
Some of the runners in the tree have been adding their own,
class-specific versions of a switch to instruct the runner to reset or
not the device after flashing.
In order to better support multi-image builds that require more than one
flash operation, introduce a new --reset,--no-reset command-line
parameter that is part of the RunnerCaps so taht this functionality can
be accessed in a standardized manner.
Implementations for the new parameter are provided for the runner
classes that were already configurable in this regard.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Signed-off-by: Jamie McCrae <jamie.mccrae@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>