Write Data in flash and use same data address in secure bootloader file

Hello, 

I am working on nRF52832 with using SDK nRF5 15.3.0 version in Segger Embedded Studio.

I  have one application in which I have 64byte data received from BLE and store it in flash. This stored data I needs to use in secure bootloader project using stored data's flash address.

I sucessfully done data storing part in flash with reference to flashwrite example code. I am using last 2 page of my application area to store data (0x0007e000 starting address). Now I needs to use this data in secure bootloader file fatching from flash address. But In debugging time, I can see only 0x00 or 0xFF written in this area. Also I checked application data reserved area in secure bootloader file but not able to identify perticular range.

So kindly help me out which address range needs to use as a flash to store data and how to fetch data from flash in secure bootloader file. 

Parents
  • Hi,

    You can read any part of the flash from the bootloader, and that can be as simple as dereferencing a pointer. If for instance you wrote your 64 byte array at 0x00040000, that is where you would read it from. For instance, print the first bye like this:

    NRF_LOG_INFO("First byte: 0x%x", *(volatile uint8_t*)0x00040000);
    This should be straight-forward.
    There is another issue here, though. You write that you are using two pages starting at 0x0007e000, and that will not work with the bootloader. The last two pages are used for MBR params (second to last) and bootloader settings (very last), and cannot be used for anything else. You need to pick a page that is actually unused. See memory layout in the bootloader documentation for details.
Reply
  • Hi,

    You can read any part of the flash from the bootloader, and that can be as simple as dereferencing a pointer. If for instance you wrote your 64 byte array at 0x00040000, that is where you would read it from. For instance, print the first bye like this:

    NRF_LOG_INFO("First byte: 0x%x", *(volatile uint8_t*)0x00040000);
    This should be straight-forward.
    There is another issue here, though. You write that you are using two pages starting at 0x0007e000, and that will not work with the bootloader. The last two pages are used for MBR params (second to last) and bootloader settings (very last), and cannot be used for anything else. You need to pick a page that is actually unused. See memory layout in the bootloader documentation for details.
Children
Related