Hi All,
I have problem in reading the nvs_keys partition when its flashed with existing binary files. let me describe it in the following steps:
1 - I have a requirement where some default keys are needed as part of the firmware initial process
2 - All keys were created with a firmware have default values
3 - Read back the nvs_key partition using the `parttool.py --port "COM1" read_partition --partition-type=data --partition-subtype=nvs_keys --output "nvs_keys.bin"`
4 - After this all flash is erased and as part of board programming process `nvs_keys.bin` is flashed using the parttool
5 - So far so good everything is working and firmware is running but when it comes to reading the NKS Keys, firmware return as those default kays does not even exist in nvs_key partition while reading the nvs_key partion return the same binary as it was written
Is there something that needs to be done as part of this process or am I missing some steps?
Thanks
NVS Key values pairs
-
- Posts: 9709
- Joined: Thu Nov 26, 2015 4:08 am
Re: NVS Key values pairs
Not sure what's wrong, but the canonical way to do this is to use the esp-idf build system to generate the partition so you're sure you have an entirely clean one. Perhaps try that?
Re: NVS Key values pairs
Did you try this tool?
https://github.com/espressif/esp-idf-nvs-partition-gen
It is easy way to build manufacturing partition with values you want.
Also, can you post partition table you are using?
https://github.com/espressif/esp-idf-nvs-partition-gen
It is easy way to build manufacturing partition with values you want.
Also, can you post partition table you are using?
Re: NVS Key values pairs
@ ESP_Sprite Yes I have tried to use that build system to generate the partition but the default size for the partition in build system is 0x3000 while my partition size is just 0x1000. I have generated the partition using the build system and obviously it was failure while flashing to the board due to size issue. Also as a next step I have compared the generated partition and read back partition they appear to be same upto address 4096.
@chegewara Here is the partition table i am using is:
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x4000
otadata, data, ota, 0xd000, 0x2000
phy_init, data, phy, 0xf000, 0x1000
ota_0, app, ota_0, , 0x180000
ota_1, app, ota_1, , 0x180000
nvs_key, data, nvs_keys, , 0x1000
@chegewara Here is the partition table i am using is:
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x4000
otadata, data, ota, 0xd000, 0x2000
phy_init, data, phy, 0xf000, 0x1000
ota_0, app, ota_0, , 0x180000
ota_1, app, ota_1, , 0x180000
nvs_key, data, nvs_keys, , 0x1000
-
- Posts: 9709
- Joined: Thu Nov 26, 2015 4:08 am
-
- Posts: 167
- Joined: Sun May 22, 2022 2:42 pm
Re: NVS Key values pairs
Is this requirement documented?ESP_Sprite wrote: ↑Fri Sep 06, 2024 10:13 amThat may be your problem: NVS needs at least 3 sectors and you're only giving it one.
-
- Posts: 9709
- Joined: Thu Nov 26, 2015 4:08 am
Re: NVS Key values pairs
Doesn't look like it. I'll file an internal issue.
Re: NVS Key values pairs
I will verify this by changing the partition table size.ESP_Sprite wrote: ↑Fri Sep 06, 2024 10:13 amThat may be your problem: NVS needs at least 3 sectors and you're only giving it one.
Re: NVS Key values pairs
This does not seems to be the issue. I have updated the partition table allocating 3 sectors to nvs_key partition and still I am getting the same result.ESP_Sprite wrote: ↑Fri Sep 06, 2024 10:13 amThat may be your problem: NVS needs at least 3 sectors and you're only giving it one.
Who is online
Users browsing this forum: No registered users and 268 guests