This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Protect bootloader from overwrite/erase

I am using Nordics sample bootloader and I really want to make sure that given a freak accident in sending it the firmware or in the firmware code itself that the bootloader is never erased or overwritten. In its current state, is the bootloader protected against that or are there measures I can take to accomplish it?

I have also noticed the call sd_flash_protect, but I am not sure if that is the proper approach and if so how to use it.

Thanks,

Parents
  • You can use the registers PROTENSETx to protect you bootloader. If you have enabled the softdevice these registers are accessed through the sd_flash_protect call. PROTENSETx enables you to protect 64 different blocks of the memory. For the nRF51x22 these blocks are 4 k big.

    Update: main.c I edited the standard .../nRF6310/S110/bla_app_hrs example. The main file is above here. I added code to set the PROTENSET and protect the upper half of flash and then try to write to that area. It fails and gives me an error code.

    UPDATE 2: Always make sure that you are using nRF51 of second revision if you are using sd_flash_protect() or PROTENSET. On nRF51 revision 1 this functionality is not available.

  • I added an attachment to my initial reply here. Please have a look at that main.c file.

    If I understand you correctly you also set sd_flash_protect(0,0xFFFFFFFF) but are still allowed to write to that upper half of the memory? Any chance you could share the flash write routine that you use?

Reply
  • I added an attachment to my initial reply here. Please have a look at that main.c file.

    If I understand you correctly you also set sd_flash_protect(0,0xFFFFFFFF) but are still allowed to write to that upper half of the memory? Any chance you could share the flash write routine that you use?

Children
No Data
Related