Smart Remote 3 nRF52 v1.2
Generating custom firmware packages for DFU

This section provides information about preparing firmware packages used for the OTA-DFU process. When preparing firmware packages, you must install nrfutil.

Public key

Smart Remote uses cryptographic keys to sign and validate a firmware package used during a DFU procedure. The public key is located in Source\Configuration\bootloader_key.c and it must match the private key that is used during the generation of a firmware package.

Warning
The private key is not provided. A new key pair must be generated by the user prior to the generation of DFU packages.


Warning
When preparing a custom firmware for your device, make sure to generate your own key pair and replace the public key stored in the above-mentioned file.


Warning
Remember to safely store the private key as it is needed to generate a valid firmware package for your device. If the private key is lost, you will be unable to update your device with newly generated firmware packages.

To generate a new private key, run the following command with nrfutil installed. This generates a new key file in the folder where you have run the command.

nrfutil keys generate private-key.pem

Replace the existing public key (Source\Configuration\bootloader_key.c) with the new one that is generated from the new private key:

nrfutil keys display --format code --out_file "Source\Configuration\bootloader_key.c" --key pk private-key.pem

To allow evaluation of the DFU process, precompiled firmware images and matching DFU packages are provided in the installation package.

Preparing the bootloader

In Smart Remote, the OTA-DFU process is performed by the bootloader. The bootloader must be present on the device and the application must boot through it.

To generate a new bootloader, compile the SR3_Bootloader project. Use the project and target that matches your SoC version and board. Flash the compiled bootloader onto the board. When the bootloader is flashed to memory, the UICR register is also modified with the address of where the bootloader resides. This address is part of the generated HEX file.

Note
When the location of the bootloader changes (after memory layout modification), make sure to correctly clear the UICR register prior to executing the bootloader flashing procedure to assure that the bootloader address is correctly updated.

OTA-DFU package

To prepare a firmware package used for the OTA-DFU procedure, use the nrfutil pkg generate command. The tool can prepare a package containing one or more firmware components. For more information, refer to nrfutil documentation.
Example:

nrfutil pkg generate --application Projects\Firmware_nRF52832\arm5_no_packs\_build\PCA63519-SR3_nRF52832_Shield.hex --application-version 0 --hw-version 0x63519 --sd-req 0xA5 --key-file private-key.pem dfu-app.zip
nrfutil pkg generate --application Projects\Firmware_nRF52810\arm5_no_packs\_build\PCA20031-SR3_nRF52810_Product_Example.hex --application-version 0 --hw-version 0x20031 --sd-req 0xA6 --key-file private-key.pem dfu-app.zip

Version requirements

When generating a new firmware package, version of the components and of the hardware are provided. These versions determine whether it will be possible to perform a DFU process. DFU is only possible if:

The provided precompiled firmware has the following version information:

Note
HW version used by the bootloader during the DFU procedure is defined in the target-specific configuration header (sr3_config_nrf*.h). Refer to CONFIG_DFU_HW_VERSION.

Manual Firmware Assembly

A firmware package which supports OTA-DFU and which can be uploaded to your device through a cable connection, for example during manufacturing, must consist of the following four elements:

Bootloader Settings

Bootloader settings is a special area in the bootloader that contains information about the DFU process, versions of the application and of the bootloader, and the application checksum. You must generate your own bootloader settings file for your custom firmware. See nrfutil documentation for information on how to generate the bootloader settings file. Refer to Version requirements and make sure that you set the correct versions when generating the bootloader settings file.

Note
The bootloader settings file is required only when preparing a package for a cable connection update.

DFU process

When your custom package is ready, follow the procedure in Running a DFU.


Documentation feedback | Developer Zone | Subscribe | Updated