Hi all -
I'm porting an app to the ESP32. It currently stores all of its configuration settings in a struct, which it reads and writes in its entirety. I can read and write the blob from the app, using NVS calls. What I need to do is figure out how to initialize it. My original idea is to write a second program (that would run on the desktop) to produce a binary file, that I could specify in my .csv file, and use the partition generator to create the .bin, and flash that using esptool write_flash.
This seems like it would work, but it seems rather circuitous. Am I overlooking an easier way to do this?
Thanks...
(solved) how to encode binary (blob) in .csv file?
(solved) how to encode binary (blob) in .csv file?
Last edited by mzimmers on Thu Nov 11, 2021 6:09 pm, edited 2 times in total.
-
- Posts: 46
- Joined: Thu Oct 03, 2019 10:52 pm
Re: initializing a blob for NVS
Erase specified NVS partition and open specified NVS partition.
nvs_flash_erase_partition()
nvs_flash_init_partition()
nvs_open_from_partition()
-------------------------------------------
Erase key-value pair with given key name.
nvs_erase_key()
-------------------------------------------
Erase all key-value pairs in a namespace.
nvs_erase_all()
nvs_flash_erase_partition()
nvs_flash_init_partition()
nvs_open_from_partition()
-------------------------------------------
Erase key-value pair with given key name.
nvs_erase_key()
-------------------------------------------
Erase all key-value pairs in a namespace.
nvs_erase_all()
Re: initializing a blob for NVS
I'm trying to encode a default value for the blob in my .csv file, not create it programmatically. The customer needs to provision data like run schedules at manufacture.
Anyone have an idea for doing this?
Thanks...
Anyone have an idea for doing this?
Thanks...
Re: how to encode binary (blob) in .csv file?
Figured it out:
where schedule.hex is a text file with hex representations (with no formatting):
Evidently, you can only initialize scalars directly in the .csv file; aggregates have to go into files.
Code: Select all
NVS_KEY_SCH,file,hex2bin,schedule.hex
Code: Select all
44656661756C74205363686564756C6500000...
-
- Posts: 46
- Joined: Thu Oct 03, 2019 10:52 pm
Re: (solved) how to encode binary (blob) in .csv file?
There is how to do a "Create Unique Factory Data Image".
You can use nvs_partition_gen.py to create NVS partitions.
Data such as the serial number can be written to the second NVS area.
https://blog.espressif.com/building-pro ... 642832a7a3
You can use nvs_partition_gen.py to create NVS partitions.
Data such as the serial number can be written to the second NVS area.
https://blog.espressif.com/building-pro ... 642832a7a3
Who is online
Users browsing this forum: No registered users and 137 guests