When implementing a mechanism to perform a Device Firmware Update, you must be aware of where in the device memory the different firmware components are located.
During system start-up, the Master Boot Record will determine the start address of the bootloader by checking the address that is defined at UICR.NRFFW[0] (which can also be accessed by UICR.BOOTLOADERADDR on nRF51 devices). See Relocating the bootloader for information on how to change the start address of the bootloader.
The MBR will then initiate the bootloader. During initialization, the bootloader will either enter DFU mode to perform a firmware update or request the SoftDevice to start the application. The application is located right after the SoftDevice, so the SoftDevice is aware of its start address.
Firmware updates can be performed as dual-bank or single-bank updates. See Dual-bank and single-bank updates for more information and a detailed description of the update process.
Application data can be preserved during an update. See Preserving application data for instructions.
SoftDevices have different sizes. For example, the S13x SoftDevice v2.0.0-7.alpha ends at 0x0001B000.
The following figure displays the default memory layout of a 256 kB nRF51 device:
The following table shows the memory layout on a 256 kB nRF51 device with the S130 SoftDevice v2.0.0-7.alpha:
Memory range | Usage |
---|---|
0x0003C000 - 0x00040000 | DFU Bootloader and data |
0x0001B000 - 0x0003C000 | Application code, free/swap, and application data |
0x00001000 - 0x0001B000 | SoftDevice |
0x00000000 - 0x00001000 | Master Boot Record (MBR) |
The following figure displays the default memory layout of a 512 kB nRF52 device:
The following table shows the memory layout on a 512 kB nRF52 device with the S132 SoftDevice v2.0.0-7.alpha:
Memory range | Usage |
---|---|
0x0007A000 - 0x00080000 | DFU Bootloader, data, and MBR parameters |
0x0001B000 - 0x0007A000 | Application code, free/swap, and application data |
0x00001000 - 0x0001B000 | SoftDevice |
0x00000000 - 0x00001000 | Master Boot Record (MBR) |