How to Reserve specific area in flash (2 sectors) and map variables to this section?

I'm using multi-image and want to reserve a space (2 sectors) in Application and map some constant data to these section? I believe I don't have to edit partition manager layout as I need this area  to be part of the application. I believe I need to edit the linker script but I don't know how to do so.

Board: NRF52840DK

SDK: NRF Connect 2.1.0

Thanks in advance! 

  • Since working with linkers can be complicated, I am trying to find another way to do this first.

    I will give one more suggestion:

    What if you first use the partition manager to create a custom partition.
    Then you can use our NVMC driver to read and/or write to addresses of this area.

    And in production, you can flash the needed data to this area, but not as part of the application.

    Regards,
    Sigurd Hellesvik

  • Okay, good suggestion. 

    How to do so? 

    I believe I would have to reserve memory double of 2 sectors as we take sector from the app, we have to reserve also another sector from the mirrored area reserved for the OTA update. 

  • ahmedwahdan said:

    How to do so? 

    I believe I would have to reserve memory double of 2 sectors as we take sector from the app, we have to reserve also another sector from the mirrored area reserved for the OTA update. 

    Yes, that makes sense.

    If you create a pm_static.yml file with only the custom sector, the partition manager will dynamically generate the other partitions with this restriction.
    Then you can read the addresses from the partition manager by including pm_config.h into your source code.
    Use these addresses to write with NVMC drivers.

    I do not have time to make a sample to showcase that this week, since I will have the next two days off, but if you are interested I can do so next week?

    For production, the writing to flash needs a script, and it depends on which software you will use for production programming.

    Regards,
    Sigurd Hellesvik

Related