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

sd_flash_write implementation without Softdevice

Hello,

I am starting to create a bootloader and I want it to be independant of the SoftDevice. Is there any open source implementation of a flash_write function that I could use? I've noticed that the official bootloader is using sd_mbr_command to initiate the copy process with the help of the softdevice. How is this copy process implemented?

  • Does it begin from the lowest page of the source and does it copy pagewise? E.g. what happens when the image starts at page 100, is 50 pages long and should be moved to page 80.

Thanks, Marius

Parents
  • Hello, attached some simple code I've made earlier that accesses the NVMC directly (blocking). This code can be used when the softdevice is disabled. Note that there is no memory alignment checks implemented here, so make sure to only used word aligned addresses when doing writes, and page aligned addresses when erasing.

    The MBR does not support the scenario you describe. Flash pages has to be erased before storing any new data, which is not the case when reaching the 100th page.The point of having the MBR is to allow the bootlaoder to safely update itself and the SD (SDK bootloader depends on SD to perform DFU). It is not used for application update.

  • Perfect, that helped. My bootloader is now happily moving data and then accesses an address that is located at the end of the Softdevice + 1024 bytes. This is where I've stored a pointer to my app's main function. This one is started as soon as the copy process is done.

Reply Children
No Data
Related