This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Softdevice Update Procedure

Hello,

For the softdevice update, is it the responsibility of the bootloader to make sure, that the softdevice was copied correctly?

If for example the bootloader calls sd_mbr_command() and the device powers down during that copy operations. Is it's up to the bootloader to restart / complete the copy action or will the MBR take care of it (like I hope it does when copying a bootloader)?

The reason, why I ask is because I try to copy the SD with a single call to sd_mbr_command() and it looks like, I end up with a few kByte of SD missing at the beginning, which leads to a bootloader that crashes when it tries to start the SD.

This are the parameters, I use to call the sd_mbr_command():

(gdb) p/x copy_sd_command
$1 = {command = 0x1, params = {copy_sd = {src = 0x23000, dst = 0x1000, len = 0x8800}, compare = {ptr1 = 0x23000, ptr2 = 0x1000, len = 0x8800}, copy_bl = {
  bl_src = 0x23000, bl_len = 0x1000}, base_set = {address = 0x23000}, irq_forward_address_set = {address = 0x23000}}}

If it is the responsibility of the bootloader, to make sure, the SD gets copied correctly, what is the purpose of the MBR command, to copy the SD then?

I think I've overlooked something obvious (again).

Kind regards and thanks in advance,

Torsten

Parents
  • Hi Torsten,

    We use the MBR to copy the softdevice because the softdevice +MBR area can be protected and requires the flash operation to be called from inside the protected area, not from the bootloader.

    The SD_MBR_COMMAND_COPY_SD will do an erase, then write the new softdevice and then do a memcmp() to check, before returning NRF_SUCCESS or NRF_ERROR_INTERNAL.

    So it's the responsibility of the bootloader to check if the call with SD_MBR_COMMAND_COPY_SD return with NRF_SUCCESS or not before moving to the next step.

Reply
  • Hi Torsten,

    We use the MBR to copy the softdevice because the softdevice +MBR area can be protected and requires the flash operation to be called from inside the protected area, not from the bootloader.

    The SD_MBR_COMMAND_COPY_SD will do an erase, then write the new softdevice and then do a memcmp() to check, before returning NRF_SUCCESS or NRF_ERROR_INTERNAL.

    So it's the responsibility of the bootloader to check if the call with SD_MBR_COMMAND_COPY_SD return with NRF_SUCCESS or not before moving to the next step.

Children
Related