Page 1 of 1

Trying to change partition table

Posted: Fri Jul 21, 2017 4:37 pm
by Josh_T
Hello, I'm having trouble trying to change the partition table to use the rest of our 16M flash chip with espressif's nvs api.

I created the custom .csv and specified its location in menuconfig, where I also updated the app start address and saved the sdkconfig file. Next, I run "make partition_table" which generates the binary partition table from the custom csv. when I run make and flash the esp32, the chip is stuck in a reset loop that appears to come from nvs_flash_init_custom() (based on the printed Backtrace). This suggests that the application image is being loaded correctly, but the nvs driver does not have the correct symbols defined to properly initialize its flash partition.

I've played with the order, size, and offsets of the three lines in the default singleapp_partition table to get a custom csv. typically these attempts look something like...

Code: Select all

# Name,   Type, SubType, Offset,  Size, Flags	
phy_init, data, phy,     0xf000,  0x1000,
factory,  app,  factory, 0x10000, 1M,
nvs,      data, nvs,     ,  	  12M,
note: I get the following warning when exiting menuconfig...
/sdkconfig:84:warning: symbol value '' invalid for PHY_DATA_OFFSET
sdkconfig line 84 appears to supply no value for CONFIG_PHY_DATA_OFFSET, and this is overwritten whenever make is invoked. My guess is that there is an additional setting file I need to edit or my project structure is somehow throwing off the make system.

Josh

Re: Trying to change partition table

Posted: Sat Jul 22, 2017 7:44 am
by ESP_igrr
That is probably a bug in NVS. Please open an issue on GitHub, attaching your code, sdkconfig, and the partition table. I won't have access to any 16M boards to debug this for another 2-3 weeks, but if you log your issue on GitHub it will not be forgotten by then.

Re: Trying to change partition table

Posted: Mon Aug 14, 2017 5:54 pm
by Josh_T
OK, bug was posted. Is anyone looking at this? Seems like something that should be fixed if it is a legit bug and not something dumb on my part.

https://github.com/espressif/esp-idf/issues/834

Re: Trying to change partition table

Posted: Wed Aug 16, 2017 11:09 am
by ESP_igrr
Thanks for reporting this. The issue seems to be present only for large partitions, which is not a common use case for NVS, this is why this issue did not receive high priority. We'll definitely fix the crash in the next IDF version, but operations with such partition may still be very slow.

Re: Trying to change partition table

Posted: Wed Aug 23, 2017 8:12 pm
by Josh_T
So I have a couple questions on this. First, what are the practical limits to what I can allocate for the nvs? You mentioned that performance falls off for larger partitions, so if I am able to get 1 or 2M working, will it be unbearably slow? Second, is there any documentation for accessing the Flash outside the partition table directly? I note that flash_ops.c seems to have a lot of the functions I would expect for doing this.

Re: Trying to change partition table

Posted: Thu Aug 24, 2017 2:50 am
by ESP_Sprite
On your second question: the first part of the API reference on this page has all the flash access methods that are public.

Re: Trying to change partition table

Posted: Mon Sep 04, 2017 5:03 am
by ESP_igrr
Small update on NVS performance for large partition sizes. Currently we need to read every flash sector when initializing NVS. Changing this would require significant modifications of NVS (adding an index, for example), at which point it will stop being a simple log-based storage. The time it takes to read single page in flash is around 400-500us, if SPI flash is working at 80MHz frequency. Multiply that by the number of 4-kilobyte sectors in the partition, and you will get the absolute minimum init time for NVS. Currently it is slightly worse than that because we read in blocks smaller than 4kB, but this part can be optimized.