A bootloader may be used to handle in-system update procedures.
The bootloader has full access to the SoftDevice Application Programming Interface (API) and can be implemented like any application that uses the SoftDevice. In particular, the bootloader can make use of the SoftDevice API for Bluetooth® Low Energy communication.
The bootloader is supported in the SoftDevice architecture by using a configurable base address
for the bootloader in the application flash region. This address is referred to as BOOTLOADERADDR
(see MBR, SoftDevice, and bootloader architecture). The BOOTLOADERADDR address can be provided
either at the MBR_BOOTLOADER_ADDR
flash memory location, which is defined in
nrf_mbr.h, or in the UICR.NRFFW[0] register. Using the flash memory
location is the safest because it can be write protected protected. This is also the location that will be checked first
by the MBR. UICR.NRFFW[0] is checked only if MBR_BOOTLOADER_ADDR
has the default
value, which is 0xFFFFFFFF.
The bootloader is responsible for determining the start address of the application. It uses
sd_softdevice_vector_table_base_set(uint32_t address)
to tell the SoftDevice
where the application starts.
The bootloader is also responsible for keeping track and verifying the integrity of the firmware, including the application, SoftDevice, and the bootloader itself. If an unexpected reset occurs during a firmware update, the bootloader is responsible for detecting it and resuming the update procedure.