I'm using the IoT bootloader from NRF52 SDK 14.2. When the bootloader has nothing to do and starts the main application, the FDS calls all fail in the main application. When I clear the UICR (nrfjprog -f nrf52 --eraseuicr), my main application launches (without using the bootloader) and the FDS calls work, it is only when the main application is launched through the bootloader that they fail. What am I missing?
I figured out the issue. The FDS library normally uses the top of flash (0x7F000-0x7FFFF) to store the data, but when a bootloader is present, it always stores itself in a page directly under the bootloader. In my case, my bootloader was at 0x78000 and therefore FDS was looking for my previously stored data in 0x77000-0x77FFF instead of 0x7F000-0x7FFFF. The FDS library determines where it can store the data by looking at the BOOTLOADER_ADDR UICR. I hacked the FDS library to always look for data in the top of flash (0x7F000-0x7FFFF) regardless of the BOOTLOADER_ADDR UICR setting. I just have to make sure that my bootloader start address is such that it doesn't extend into the FDS data area. Hope this helps someone else.
Careful: NRF Bootloaders can use these pages for bookeeping, e.g. when replacing SD+BL via MBR.
Good point, but I am not doing firmware updates using BLE, only through SD card. The flash functions use the NVMC not the soft device for flash writes, so hopefully, this will allow me to update the application and the softdevice. We'll see.