This information applies to the following SoftDevice: S132
Tools
nrfutil is a PC tool which allows for creating and signing firmware packages, as well as for performing the firmware update process using a PC. For details on possible ways to install the tool, see nrfutil installation.
Creating a firmware package
Firmware packages for background DFU are created using the same method as in the BLE Secure DFU Bootloader. To find out how to create a firmware package, refer to Creating a firmware package with nrfutil.
To create a firmware image, follow these steps:
- Create cryptographic keys for the example. For information about key generation, see Working with keys.
- Create a private key.
nrfutil keys generate priv.pem
- Create a public key in code format and store it in a file named
dfu_public_key.c
. nrfutil keys display --key pk --format code priv.pem --out_file dfu_public_key.c
- Copy the
dfu_public_key.c
file to the project folder <InstallFolder>\examples\dfu\dfu_req_handling
, replacing the existing file. - Note
- Do not copy the key to the folder containing your example. Use the path provided above.
- Prepare the background DFU client application.
- Compile the background DFU client.
- Generate a bootloader settings HEX file.
nrfutil settings generate --family NRF52 --application \<PathToHexFile\> --application-version 1 --bootloader-version 1 --bl-settings-version 1 settings.hex
- Use mergehex (part of the nRF5x Command Line Tools) to merge the background DFU client HEX file and the bootloader settings HEX file:
mergehex -m \<PathToHexFile\> settings.hex -o dfu_client.hex
- Prepare the firmware to update.
- Compile the new version of the background DFU client.
- Prepare a firmware package. For more information, see Creating a firmware package with nrfutil.
nrfutil pkg generate --hw-version 52 --sd-req \<RequiredSoftDeviceVersion\> --application-version 2 --application \<PathToNewHexFile\> --key-file priv.pem app_dfu_package.zip