Page 1 of 1

ESP32 NVS Data to be programmed at factory

Posted: Thu May 30, 2019 8:33 pm
by plrosa
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

Re: ESP32 NVS Data to be programmed at factory

Posted: Fri May 31, 2019 4:45 am
by Zeni241

Re: ESP32 NVS Data to be programmed at factory

Posted: Fri May 31, 2019 4:41 pm
by Laurent Louf
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.

Re: ESP32 NVS Data to be programmed at factory

Posted: Sat Jun 01, 2019 9:09 am
by Ritesh
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.