ESP32 NVS Data to be programmed at factory

plrosa
Posts: 1
Joined: Thu May 30, 2019 8:26 pm

ESP32 NVS Data to be programmed at factory

Postby plrosa » Thu May 30, 2019 8:33 pm

Hi,

I need to know how we can program nvs data for mass production. I know there is esptools and an exe for that, but say I need to embed a different certificate for each device, how I can use esptools to program it and use high level nvs function to read it at bootup ?

Thanks

Zeni241
Posts: 86
Joined: Tue Nov 20, 2018 4:28 am

Re: ESP32 NVS Data to be programmed at factory

Postby Zeni241 » Fri May 31, 2019 4:45 am


Laurent Louf
Posts: 6
Joined: Wed May 29, 2019 9:03 am

Re: ESP32 NVS Data to be programmed at factory

Postby Laurent Louf » Fri May 31, 2019 4:41 pm

You will need a little bit more than esptool for that. You can use the utility mentioned by Zeni241 or make your own. The tool to generate NVS partitions from their CSV definition is nvs_partition_gen.py located in esp-idf/components/nvs_flash/nvs_partition_generator/ . So you basically have two choices : pre-generate the CSV with your security info in it and generate the binary just before flashing, or you can pre-generate the CSV and their associated binary. Unless you have very big NVS partitions, the difference in execution time should be negligible.

Then you just have to build a script that will basically call esptool with the right arguments : the first arguments for write_flash should stay the same, as well as the offset of the NVS partition offset, but the path to your security NVS partition will change. And that's it. Or you can build your script to copy-paste the NVS partition binaries in the right directory and never change the arguments of esptool.

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: ESP32 NVS Data to be programmed at factory

Postby Ritesh » Sat Jun 01, 2019 9:09 am

Zeni241 wrote:
Fri May 31, 2019 4:45 am
Have you seen this https://docs.espressif.com/projects/esp ... s_mfg.html ?
Great. Nice Concept. It can be used easily at time of production. Also It has security feature as well to generate it.
Regards,
Ritesh Prajapati

Who is online

Users browsing this forum: Baidu [Spider], pacucha42 and 93 guests