Best way to write persistent data in factory

Hi, team.

I am trying to find a way to write some persistent data in factory.

The data is a couple of certificates and should be written differently for each devices.

What is the best way to achieve this?

I am considering to use NVS and zephyr settings libraries to save certificates, but want to know whether the better/recommended way exists.

And also, let me know some guideline how to make suitable format (like .hex, maybe?) for writing to flash with well-known flash writing tools like nrfprog or Programmer.

I tried to make my own CLI interface via UART, etc., but currently, target device is lack of resources, and can't afford for it.

Parents
  • Hi,

     

    You're free to choose the filesystem that fits your needs the best.

    NVS is good for lightweight storing of arbitrary data, while other filesystems are designed for larger spaces (using in conjunction with external flash for instance)

     

    This sample might be of help: https://docs.zephyrproject.org/3.2.0/samples/drivers/flash_shell/README.html

    And also, let me know some guideline how to make suitable format (like .hex, maybe?) for writing to flash with well-known flash writing tools like nrfprog or Programmer.

    If you declare a specific region as a defined area using "partition manager":

    https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/scripts/partition_manager/partition_manager.html#adding-a-static-partition

     

    And also, let me know some guideline how to make suitable format (like .hex, maybe?) for writing to flash with well-known flash writing tools like nrfprog or Programmer.

    If you shall write defined data to your device, you can write it to a untouched flash area of the chip, and load it in your application. 

    You can set a-side a defined area, by creating "pm_static.yml" in your own application folder.

    for example, in file my_application/pm_static.yml, you can add:

    my_defined_area:
      address: 0xf8000
      end_address: 0x100000
      region: flash_primary
      size: 0x8000

     

    This is provided that you intend on using "partition manager" (which is default in-use when you trigger a multi-image build, by for instance adding mcuboot).

     

    Kind regards,

    Håkon

Reply
  • Hi,

     

    You're free to choose the filesystem that fits your needs the best.

    NVS is good for lightweight storing of arbitrary data, while other filesystems are designed for larger spaces (using in conjunction with external flash for instance)

     

    This sample might be of help: https://docs.zephyrproject.org/3.2.0/samples/drivers/flash_shell/README.html

    And also, let me know some guideline how to make suitable format (like .hex, maybe?) for writing to flash with well-known flash writing tools like nrfprog or Programmer.

    If you declare a specific region as a defined area using "partition manager":

    https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/scripts/partition_manager/partition_manager.html#adding-a-static-partition

     

    And also, let me know some guideline how to make suitable format (like .hex, maybe?) for writing to flash with well-known flash writing tools like nrfprog or Programmer.

    If you shall write defined data to your device, you can write it to a untouched flash area of the chip, and load it in your application. 

    You can set a-side a defined area, by creating "pm_static.yml" in your own application folder.

    for example, in file my_application/pm_static.yml, you can add:

    my_defined_area:
      address: 0xf8000
      end_address: 0x100000
      region: flash_primary
      size: 0x8000

     

    This is provided that you intend on using "partition manager" (which is default in-use when you trigger a multi-image build, by for instance adding mcuboot).

     

    Kind regards,

    Håkon

Children
Related