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

Device not booting after bootloader copy

Hi,

Slight problem here with bootloader updates : right after download, I copy from SWAP (0x16000) to normal location (0x38000 in my case).

sd_mbr_cmd.command               = SD_MBR_COMMAND_COPY_BL;
sd_mbr_cmd.params.copy_bl.bl_src = 0x16000
sd_mbr_cmd.params.copy_bl.bl_len = settings.bl_image_size;
sd_mbr_command(&sd_mbr_cmd);

After this operation , the bootloader is correctly copied. However, my device doesn't boot any more. Flash dumps indicate that the two last pages of s110 (0x0800 to 0x0FFF) have been updated, as indicated in this thread : devzone.nordicsemi.com/.../

the updated data parts are :

0x800 : 00 00 00 00 00 60 01 00  20 35 00 00 04 98 03 00
0xC00 : 00 00 00 00 FF FF FF FF  FF FF FF FF FF FF FF FF

Any idea why this happens ?

Parents
  • @Jean: I found maybe a bug in your code.

    In your bootloader code, you have modified bootloader_dfu_sd_update_continue() to again do a dfu_bl_image_swap() if p_bootloader_settings->bl_image_size != 0, this is not enough. You should combine it with a SD_MBR_COMMAND_COMPARE (dfu_bl_image_validate) to check if the image is already copied correctly or not. If it already copied correctly, don't do another dfu_bl_image_swap() or you will stay in a loop forever.

    The reason for that is when you call dfu_bl_image_swap(), it's a kamikaze call. The MBR will take over, swap the bootloader and do a reset. The result is that you will reset back to bootloader, and if you do another swap you will stay in a dead loop.

    When you finished with updating the bootloader (validate return success), you should erase the swap area (0x16000).

    However, I tried to fix that in your code, and ended up the bootloader being erased (0xFFFFF). I 'm running out of time for futher debug for now, but I would suggest you to look into the bug I mentioned above.

    If the MBR succeed in swaping the BL, data at address 0xC00 should = 0xFFFFFFFF. Otherwise it will stuck in updating the BL.

  • @hungbui Indeed, it was exactly that. I hadn't realized that the MBR swap meant to reset. Thank you very much !

Reply Children
No Data
Related