I need to do a DFU via BLE but I do not have enough memory.
For the past few months I have been working on a custom bootloader that would use an external memory to do the DFU.
The problem is that the new bootloader is bigger than the previous one and requires me to change the allocated memory.
Current Memory Layout | New Memory Layout | |
Bootloader Settings Page | 0x3F000 to 0x40000 | 0x3F000 to 0x40000 |
MBR Params Page | 0x3E000 to 0x3F000 | 0x3E000 to 0x3F000 |
Bootloader | 0x38000 to 0x3E000 | 0x37000 to 0x3E000 |
I only have two options:
- Allocate only 0x500 for the settings page and params page so that they will fit between 0x3F000 and 0x40000.
- Move the bootloader start address
I know this is not recommended but I have no choice in this case.
I cant change the hardware, I already have tens of thousands of devices with the clients that can only be updated through BLE DFU.
As it was mentioned in another public ticket, for SoftDevice versions beyond 6.1, the bootloader start address is stored in the MBR.
I need to know how can I modify this address correctly.
For now i have disabled the memory flash protection of the MBR, in main.c, so that I can modify the value.
Then in nrf_bootloader_fw_activation.c, i modify that value right before the MBR is called to replace the bootloader by calling this function:
- nrf_nvmc_write_word(MBR_BOOTLOADER_ADDR, (uint32_t) 0x37000);
However, if I read the value stored in MBR_BOOTLOADER_ADDR, it is not necessarily the value I have written.
How can I change this value?
If this is actually impossible, can I reduce the allocated size for the params and settings pages? they only need 800 bytes each but they allocate 4096 each.