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

Reset safety of sd_mbr_command(SD_MBR_COMMAND_INIT_SD)?

I don't have a particular issue right now, just a concern that I have because my device needs to be bulletproof when it comes to reset behavior.

When sd_mbr_command(SD_MBR_COMMAND_INIT_SD) is called, what happens in terms of memory operations? Because the function's effects persist through a reset, it must be writing to flash, and if it's doing that, wouldn't it have to erase a page in order for any data to be re-written? If a crucial page of memory is erased when a device loses power, that can brick a device, and I don't see anything in the documentation that explicitly states that this won't happen.

The bootloader seems to need SD_MBR_COMMAND_INIT_SD to jump to the app, but the MBR documentation only says that COPY_BL and VECTOR_TABLE_BASE_SET need a dedicated BOOTLOADER_MBR_PARAMS_PAGE_ADDRESS page, so I don't allocate one (yet).

Parents
  • Hi Elias,

    Yes, the sd_mbr_command() function writes to a dedicated flash page, (BOOTLOADER_MBR_PARAMS_PAGE_ADDRESS).The command( copy_sd, copy_bl, compare, .. ) passed with the function is written to the page before any memory operation is started. If the device loses power before the command is written to flash, then no memory operations are performed and once the device is powered the MBR will pass execution to the bootloader.

    If the device loses power during the copy_sd and copy_sd operations, then the device will upon boot read the MBR params page and countinue with the pending operation untill it is completed and then pass execution to the bootloader.

    -Bjørn

  • Ah, so the reset triggered by bootloader_util_app_start() at the end of the bootloader routine is only a soft reset, which doesn't power RAM down?

Reply Children
No Data
Related