nRF5 SDK v15.3.0
Bootloader for background DFU
This information applies to the following SoftDevice: S132

The bootloader for the background DFU must be implemented using Bootloader and DFU modules. The main role of the bootloader is to check application integrity and, in case of dual bank updates (see Dual-bank and single-bank updates), to transfer the new image to the active bank. Unlike the BLE Secure DFU Bootloader, the bootloader for background DFU should not initialize any transports. Therefore, DFU is not possible in the bootloader. If a valid application is missing, the bootloader enters an infinite loop.

During system startup, the Master Boot Record (MBR) is responsible for starting the bootloader. MBR may be provided as part of the SoftDevice (if application uses a SoftDevice) or as a stand-alone binary firmware (if application does not use a SoftDevice). To start the bootloader, the MBR must know the start address of the bootloader. This start address is defined either in the MBR itself or in UICR.BOOTLOADERADDR. This must be set to the correct value when you program the bootloader. See the S132 SoftDevice Specification for more details.

By default, the background DFU bootloader will start the application on the device. DFU Swap mode is started if indicated in bootloader settings. The bootloader settings contain a variable that defines if a new valid application, SoftDevice, or bootloader is present in the flash memory.

Note
The background DFU bootloader is based on the current DFU solution available in this SDK.
Once the application is programmed, the bootloader assumes the application is valid. Flashing an application for the first time in DFU mode is not necessary, as it is in standard DFU implementation.

Memory layout

When implementing a mechanism to perform a Device Firmware Update, be aware where the different firmware components are located in the device memory.

The following figure displays the default memory layout of a 512 kB nRF52 device:

iot_dfu_layout_boot_nRF52.svg
Figure 1. IoT Bootloader Memory Layout

SoftDevices have different sizes. For example, the s1xx-iot-prototype3_nrf52 ends at 0x0001F000. The following table shows the memory layout on a 512 kB nRF52 device with the S132 SoftDevice:

Memory range Usage
0x0007D000 - 0x00080000 DFU Bootloader and data
0x0001F000 - 0x0007D000 Application code, free/swap, and application data
0x00001000 - 0x00026000 SoftDevice
0x00000000 - 0x00001000 Master Boot Record (MBR)
Note
Bootloader for Background DFU is smaller than in the standard DFU implementation.

During system start-up, the Master Boot Record (MBR) will determine the start address of the bootloader by checking the address that is defined at UICR.BOOTLOADERADDR. For information on how to change the start address of the bootloader, see Programming the bootloader.

The MBR will then initiate the bootloader. During initialization, the bootloader will either enter DFU swap mode to swap the old firmware with the new one or start the application.

Firmware updates can be performed only as a dual-bank update. For more information, see Dual-bank and single-bank updates.

Bootloader project

The example project of Bootloader for Background DFU can be found in the following folder: <InstallFolder>/examples/iot/bootloader

Note
The bootloader has to be present to successfully swap an old firmware image with a new one.

Documentation feedback | Developer Zone | Subscribe | Updated