We have a running project with nRF52840 + S140 7.2.0 - SDK: 17.0.2 + Bootloader.
I need to change the size of our bootloader in a production environment. This update must be done OTA (no option for SWD).
After reading some post on Nordic support, it's clear that this needs to be a 3 step process:
Step 1: Write OTA a custom bootloader that changes the UICR->NRFFW[0] address to the new location of the incoming bootloader and enter into DFU waiting for the image. This bootloader should save the other registers and restore back, since we will issue an eraseuic command.
Step 2: Receive the new bootloader with increased size.
Step 3: Receive the new application (kinda optional since the app start address did not change).
The current bootloader uses the default Nordic start address 0x000F8000 and size of 0x6000 (24kB). This bootloader does not have enough memory to future updates, whence we need to increase it's size.
The new bootloader was increased in size to 0xB000 (45kB) and start address of 0x000F3000.
I was able to create the step 1 bootloader and enter into DFU and receive the second bootloader with no errors (had to fix an image size check that was giving error 4 - insufficient resources).
After the nRFConnect finished the update, the second bootloader does not run, and the device is bricked.
Reading back the memory of the device, I can see that the UICR->NRFFW[0] is correctly set to 0x000F3000, indicating that the first bootloader did fix the start address for the incoming bootloader.
However, when I read the 0x000F3000 address it is blank, and data only starts at the old bootloader address of 0x000F8000.
It seems that when the firmware is running the bootloader activation procedure (bl_activate), the function nrf_dfu_mbr_copy_bl is copying the bootloader to the wrong destination.
After long hours of research, I confirmed on the SD documentation, that the sd_mbr_command SD_MBR_COMMAND_COPY_BL should use as the destination address of the copy, the value written in UICR->NRFFW[0], which in my case is correct. So I was expecting the copy to be done in the correct destination address.
Can you please help me to understand what might be wrong?