nRF51 SDK - S130 SoftDevice
|
The start address of the bootloader is stored in the UICR.BOOTLOADERADDR register, which is located at address 0x10001014. In the DFU bootloader example, writing the UICR.BOOTLOADERADDR is linked into the HEX file, so that it is automatically written when programming the bootloader (see Programming the DFU bootloader).
Note that UICR.BOOTLOADERADDR can only be written if you use nrfjprog.exe
as the tool for flash programming. Always erase the device before programming the bootloader, so that the value can be set correctly.
The following code in bootloader_util_arm.c
writes the bootloader start address to UICR.BOOTLOADERADDR:
BOOTLOADER_REGION_START must point to the correct location of the bootloader in the flash. In this example, this location is 0x0003C000.
You can change the start address of the bootloader if the size of your bootloader image exceeds the available memory. For example, changing the start address from 0x0003C000 to 0x00038000 increases the available bootloader size to 0x8000 (instead of 0x4000).
When selecting a new start address, keep in mind that all start addresses must be page aligned. The page size is 0x400 (1024) bytes. Also, start address and size of the memory for the bootloader must add up to 0x00040000 bytes (the end of the application area in the flash).
Complete the following steps to relocate the bootloader to a new start address:
dfu_types.h
.