nrfutil pkg generate --hw-version 52 \
# i.e. nRF52 Hardware Family
--sd-req 0x91 \
--debug-mode \
--key-file ../../keys/private.pem \
--application beaconPlus/s132/armgcc/_build/ruuvi_firmware.hex $zipname.zip
> nrfutil version
nrfutil version 6.1.2
--hw-version nn |
settings |
nrfutil settings generate [options] file.hex
--family |
:02 0000 04 0007 F3 extended liner address 7000 0000 :10 E000 00 05B9D86F010000000100000001000000 08 i.e. 0007 E000 :10 E010 00 0000000000000000C005020052E00B0F ED :10 E020 00 01000000000000000000000000000000 EF :10 E030 00 00000000000000000000000000000000 E0 :10 E040 00 00000000000000000000000000000000 D0 :0C E050 00 000000000000000000000000 C4 :10 F000 00 05B9D86F010000000100000001000000 F8 7F000 :10 F010 00 0000000000000000C005020052E00B0F DD :10 F020 00 01000000000000000000000000000000 DF :10 F030 00 00000000000000000000000000000000 D0 :10 F040 00 00000000000000000000000000000000 C0 :0C F050 00 000000000000000000000000 B4 :00 0000 01 FF EOF
nrfutil settings displayContents of a bootloader settings page that is present in a HEX file.
To read the bootloader settings page from a programmed IC,
use nrfjprog
to dump the flash memory of the IC (where file.hex
is the name of the resulting HEX file):
nrfjprog --readcode file.hex
nrfjprog --readcode t.hex Reading flash. Storing data in 't.hex'. 1,474,709 20:48 t.hex nrfutil settings display t.hex Bootloader DFU Settings: * File: t.hex * Family: nRF52 * Start Address: 0x00000000 * CRC: 0x58DF607A * Settings Version: 0x00000001 (1) * App Version: 0x00000000 (0) * Bootloader Version: 0x00000000 (0) * Bank Layout: 0x00000000 * Current Bank: 0x00000000 * Application Size: 0x00017278 (94840 bytes) * Application CRC: 0x3D23365A * Bank0 Bank Code: 0x00000001After generating the bootloader settings page,
mergehex
and nrfjprog
(or
j-link
) to flash it to the device.
Example, application app.hex installed in the IC
nrfutil settings generate --family NRF52840 --application app.hex --application-version 3 --bootloader-version 2 --bl-settings-version 1 settings.hexto display the contents of the generated HEX file:
nrfutil settings display settings.hex
138 Jul 21 20:42 ruuvi_firmware.dat 13652 Jul 21 20:42 ruuvi_firmware.bin 153 Jul 21 20:42 manifest.json manifest.json { "manifest": { "application": { "bin_file": "ruuvi_firmware.bin", "dat_file": "ruuvi_firmware.dat" } }
hexdump -C ruuvi_firmware.dat 00000000 12 87 01 0a 41 08 01 12 3d 08 ff ff ff ff 0f 10 00000010 34 1a 02 91 01 20 00 28 00 30 00 38 d4 6a 42 24 00000020 08 03 12 20 6b b8 e1 02 f1 fc f4 55 11 c2 6f ad 00000030 45 55 bb 35 b1 dc f6 8a 04 a9 17 ab 2d f6 1e 1a 00000040 6b 49 aa 3e 48 01 10 00 1a 40 41 63 f4 72 fe a6 00000050 c0 13 a3 d2 62 cd af d9 b0 1e e0 18 c6 d0 ef 20 00000060 da eb e9 86 68 69 cf b5 d6 b5 8d d8 3d 09 07 92 00000070 19 1c 20 98 54 28 bb fc 08 47 d5 eb b0 36 81 c0 00000080 3c b7 71 fa 6e 12 3c bb 4b 7d 0000008a hexdump -C ruuvi_firmware.bin 00000000 00 00 01 20 dd 20 02 00 05 21 02 00 07 21 02 00 00000010 09 21 02 00 0b 21 02 00 0d 21 02 00 00 00 00 00 00000020 00 00 00 00 00 00 00 00 00 00 00 00 0f 21 02 00 00000030 11 21 02 00 00 00 00 00 13 21 02 00 15 21 02 00 00000040 29 fa 01 00 17 21 02 00 17 21 02 00 35 01 02 00 00000050 17 21 02 00 e5 1d 02 00 c9 fa 01 00 39 03 02 00 00000060 d9 01 02 00 31 02 02 00 89 02 02 00 17 21 02 00 00000070 17 21 02 00 11 00 02 00 17 21 02 00 17 21 02 00 00000080 39 f5 01 00 79 15 02 00 17 21 02 00 17 21 02 00 00000090 3d 16 02 00 17 21 02 00 ad 20 02 00 17 21 02 00 000000a0 17 21 02 00 17 21 02 00 e1 02 02 00 0d 1d 02 00 000000b0 17 21 02 00 17 21 02 00 00 00 00 00 00 00 00 00 000000c0 17 21 02 00 17 21 02 00 17 21 02 00 17 21 02 00 000000d0 81 00 02 00 17 21 02 00 17 21 02 00 00 00 00 00 000000e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * 00000400 10 b5 05 4c 23 78 33 b9 04 4b 13 b1 04 48 af f3 … … … 00003420 f8 bc 08 bc 9e 46 70 47 38 2c 00 20 3a 49 4e 46 |.....FpG8,. :INF| 00003430 4f 3a 47 65 6e 65 72 61 74 69 6e 67 20 66 61 69 |O:Generating fai| 00003440 6c 75 72 65 0d 0a 00 00 4d 41 49 4e 3a 49 4e 46 |lure....MAIN:INF| 00003450 4f 3a 4c 45 44 73 20 69 6e 69 74 0d 0a 00 00 00 |O:LEDs init.....| 00003460 78 2d 00 20 54 2d 00 20 20 00 00 00 01 00 00 00 |x-. T-. .......| 00003470 00 00 00 00 00 00 ff ff de c0 ad de fe 01 1e f1 00003480 de c0 ad de ff 01 1e f1 41 50 50 5f 45 52 52 4f |........APP_ERRO| 00003490 52 3a 45 52 52 4f 52 3a 46 61 74 61 6c 0d 0a 00 |R:ERROR:Fatal...| 000034a0 48 41 4c 5f 4e 46 43 3a 49 4e 46 4f 3a 52 65 69 |HAL_NFC:INFO:Rei| 000034b0 6e 69 74 69 61 6c 69 7a 65 0d 0a 00 00 00 00 00 |nitialize.......| 000034c0 80 cf ff 7f 01 00 00 00 00 00 00 00 00 00 00 00 000034d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * 00003520 00 00 00 00 00 00 00 00 00 90 d0 03 25 f4 01 00 00003530 01 f4 01 00 00 10 00 00 00 30 08 00 69 f5 01 00 00003540 00 00 00 00 00 00 00 00 00 00 00 00 e9 11 02 00 00003550 0a ff 00 00 00003554
Nordic/nRF5x-CL-Tools/mergehex/mergehex
-m |
This small tool is used to merge two or three hex files.
Example : Merge Nordic SoftDevice and BootLoader
mergehex -m SD.hex BL.hex -o SD+BL.hexNow Merge that with settings and application
mergehex -m SD+BL.hex \ $zipname.settings.hex \ _build/ruuvi_firmware.hex -o $zipname.full.hex
On Mac OC Nordic Python utilities reside in
/Library/Python/2.7/site-packages/nordicsemi