This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

DFU settings HEX-file generated by nrfutil not word-aligned

When using nrfutil to generate a DFU settings page (with backup page) of settings version 2, the .hex-file generated by nrfutil is not word-aligned, i.e. the number of bytes in both the settings page and the backup page is uneven. This results in e.g. the LOAD command in Keil uVision to fail with the following error message:

LOAD $LBootloaderSettings.hex
Erase Done.
Programming Failed!
Error: Flash Download failed  -  "Cortex-M4"

The settings page is generated using the following command-line

nrfutil settings generate --family NRF52 --application <path_to_application.hex> --application-version <app_version> --bootloader-version <bl_version> --bl-settings-version 2 BootloaderSettings.hex

This results in the following .hex file:

BootloaderSettings.hex

As you can see, lines 52...:

:03E32000000000FA

...and 103...:

:03F32000000000EA

both represent the end of the respective settings areas but both contain an uneven amount of bytes.

Changing these lines to

:04E32000000000FFFA

and

:04F32000000000FFEA

makes the files work seamlessly with Keil uVision's LOAD command again without modifying the contents of the settings page.

It would be much appreciated if you could make nrfutil generate a word-aligned HEX-file.

EDIT: I actually created a pull-request in pc-nrfutil:
https://github.com/NordicSemiconductor/pc-nrfutil/pull/301

Related