Banging my head against the wall

wevets
Posts: 112
Joined: Sat Mar 09, 2019 2:56 am

Banging my head against the wall

Postby wevets » Fri Sep 25, 2020 6:39 am

I am trying to set up a factory NVS partition that will hold data that will not be erased across reset to factory. This is covered in https://docs.espressif.com/projects/esp ... uring.html and several other sites. The process is to convert a .csv file with the persistent data to a .bin file, then to write the .bin file to a factory NVS partition separate from the modifiable configuration NVS partition. I've written a prototype .cvs file named PBmfgCfg for testing the process that looks like this:

Code: Select all

key,type,encoding,value
fctryNS,namespace,,
BinID,data,string,UBinID
BinSer,data,string,USerNum
The conversion of this .csv file to a .bin file is supposed to be done by invoking nvs_partion_gen.py, which I have done from where it lives in the esp-idf as well as from my project directory, (where I copied the utility to avoid typing any path), and I get the same error result regardless.

I invoke the following command line in cmd.exe as follows:

Code: Select all

python nvs_partition_gen.py generate PBmfgCfg.csv PBmfgCfg.bin 0x6000
which according to "nvs_partion_gen.py -h", is the correct way call the program with args, (the 0x6000 is the size of the factory NVS partition table segment) and get the following error result:

Code: Select all

Creating NVS binary with version: V2 - Multipage Blob Support Enabled
Traceback (most recent call last):
  File "nvs_partition_gen.py", line 1026, in <module>
    main()
  File "nvs_partition_gen.py", line 1022, in main
    args.func(args)
  File "nvs_partition_gen.py", line 907, in generate
    if len(row["key"]) > 15:
KeyError: 'key'
What is the problem here? What am I doing wrong?

ESP_Shivani
Posts: 11
Joined: Mon May 20, 2019 8:45 am

Re: Banging my head against the wall

Postby ESP_Shivani » Fri Sep 25, 2020 9:56 am

Hi,

Is the line `key,type,encoding,value` the first line of your file ?

Thanks

wevets
Posts: 112
Joined: Sat Mar 09, 2019 2:56 am

Re: Banging my head against the wall

Postby wevets » Sat Sep 26, 2020 5:46 pm

Yes, the first line of my .csv file was "key,type,encoding,value", at least as viewed in my text editor and in excel. But you gave me a clue, so I looked at the file in a hex editor, and somewhere along the line, probably in excel where I initially created the file, a couple of non-printing characters ended up before the 'k' in "key", invisible in either my text editor or excel. I removed those characters and things started working. Thanks for the pointer.

On the other hand, at one point I mis-typed something on one run and got an error message that the cryptography package was not installed. I'm taking this one step at a time and not messing with encrypting the factory segment as I learn about this. But the message also suggested looking at the ESP 'getting started' docs to install the crypto package. I can find no reference to a crypto package in 'getting started.' I've done a vanilla install of the IDF and there's no crypto package that nvs_partition_gen.py finds. When I'm ready for it, how do get the crypto package?

ESP_Shivani
Posts: 11
Joined: Mon May 20, 2019 8:45 am

Re: Banging my head against the wall

Postby ESP_Shivani » Thu Oct 01, 2020 7:12 am

Hi,

Great ! You're welcome.

As for the crypto package, you can see the cryptography package added in the requirements.txt.
To easily install all requirements and package dependencies, if you are running >IDF v4.0, you can do the following:

Code: Select all

./install.sh
. ./export.sh
Thanks

ESP_Shivani
Posts: 11
Joined: Mon May 20, 2019 8:45 am

Re: Banging my head against the wall

Postby ESP_Shivani » Mon Oct 05, 2020 7:10 am

ESP_Shivani wrote:
Thu Oct 01, 2020 7:12 am
Hi,

Great ! You're welcome.

As for the crypto package, you can see the cryptography package added in the requirements.txt.
To easily install all requirements and package dependencies, if you are running >=IDF v4.0, you can do the following:

Code: Select all

./install.sh
. ./export.sh
Thanks

Who is online

Users browsing this forum: Bing [Bot] and 165 guests