Page 1 of 2
Custom partition table make slow boot
Posted: Thu Mar 22, 2018 5:03 pm
by urbanze
I am doing an internal LOG using NVS and needed to change the size of the partition. The default is 24K and now I put 1M, however, the boot takes ~ 7 seconds to happen (when the device starts, an indicative LED go ON).
Did I do something wrong? Does changing the factory to the first one on the list do any issue?
How to fix this slow boot?
Code: Select all
# Name, Type, SubType, Offset, Size, Flags
factory, app, factory, 0x10000, 1M,
nvs, data, nvs, , 1M,
phy_init, data, phy, , 4K,
Re: Custom partition table make slow boot
Posted: Thu Mar 22, 2018 7:23 pm
by loboris
Your partition table is wrong.
See the
Partition table documentation
Re: Custom partition table make slow boot
Posted: Thu Mar 22, 2018 8:02 pm
by urbanze
Where? I only change offset, size and order.
Offset is automatic, size is my choise and order..?
nvs need to be first? If it's wrong, why work?
Re: Custom partition table make slow boot
Posted: Thu Mar 22, 2018 8:31 pm
by fly135
Did you notice this line in the partition file?
"# Note: if you change the phy_init or app partition offset, make sure to change the offset in Kconfig.projbuild"
I guess they mean the "defaults" in ...components/partition/Kconfig.projbuild. But if you ran make menuconfig and assigned the correct values then I figure you are good.
John A
Re: Custom partition table make slow boot
Posted: Fri Mar 23, 2018 3:55 am
by ESP_igrr
Initializing a 1MB NVS partition can take quite a large amount of time. nvs_flash_init will need to read through all the partition, build the list of 256 pages, and figure out if there are any errors in data.
Re: Custom partition table make slow boot
Posted: Fri Mar 23, 2018 11:08 am
by urbanze
ESP_igrr wrote:Initializing a 1MB NVS partition can take quite a large amount of time. nvs_flash_init will need to read through all the partition, build the list of 256 pages, and figure out if there are any errors in data.
I thought about this possibility, however, I refuted the fact that when I use OTA, there are two 1MB partitions and this does not delay the boot.
What can I do to reduce this gigantic delay? 7 seconds is a long time.
I need this NVS with 1MB and also that it is faster.
Re: Custom partition table make slow boot
Posted: Fri Mar 23, 2018 1:02 pm
by Markus Becker
executing
Code: Select all
ESP_LOGI( TAG, "Initializing NVS..")
esp_err_t err = nvs_flash_init();
if (err == ESP_ERR_NVS_NO_FREE_PAGES) {
// NVS partition was truncated and needs to be erased
// Retry nvs_flash_init
ESP_ERROR_CHECK(nvs_flash_erase());
err = nvs_flash_init();
}
ESP_ERROR_CHECK(err);
ESP_LOGI( TAG, "NVS up.")
having a large NVS partition of
Code: Select all
nvs, data, nvs, 0x310000, 0x0f0000
prints in monitor
Code: Select all
I (45) APP: Initializing NVS..
I (120) APP: NVS up.
which means, initialization completes within 75ms if formating is not needed. I did not test 1M size though.
Best
Markus
Re: Custom partition table make slow boot
Posted: Fri Mar 23, 2018 1:30 pm
by urbanze
Markus Becker wrote:executing
Code: Select all
ESP_LOGI( TAG, "Initializing NVS..")
esp_err_t err = nvs_flash_init();
if (err == ESP_ERR_NVS_NO_FREE_PAGES) {
// NVS partition was truncated and needs to be erased
// Retry nvs_flash_init
ESP_ERROR_CHECK(nvs_flash_erase());
err = nvs_flash_init();
}
ESP_ERROR_CHECK(err);
ESP_LOGI( TAG, "NVS up.")
having a large NVS partition of
Code: Select all
nvs, data, nvs, 0x310000, 0x0f0000
prints in monitor
Code: Select all
I (45) APP: Initializing NVS..
I (120) APP: NVS up.
which means, initialization completes within 75ms if formating is not needed. I did not test 1M size though.
Best
Markus
The delay is before app_main() begin, see how the print of the log was.
Code: Select all
I (177) cpu_start: Pro cpu up.
I (177) cpu_start: Starting app cpu, entry point is 0x40081244
0x40081244: call_start_cpu1 at /home/ze/esp/esp-idf/components/esp32/./cpu_start.c:225
I (0) cpu_start: App cpu up.
I (180) heap_init: Initializing. RAM available for dynamic allocation:
I (187) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (193) heap_init: At 3FFB8E80 len 00027180 (156 KiB): DRAM
I (199) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (205) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (212) heap_init: At 4008E270 len 00011D90 (71 KiB): IRAM
I (218) cpu_start: Pro cpu start user code
I (235) cpu_start: Starting scheduler on PRO CPU.
[b]I (0) cpu_start: Starting scheduler on APP CPU.
I (12606) ESP32: Initializing NVS..
I (12606) ESP32: done[/b]
Re: Custom partition table make slow boot
Posted: Fri Mar 23, 2018 8:40 pm
by urbanze
fly135 wrote:Did you notice this line in the partition file?
"# Note: if you change the phy_init or app partition offset, make sure to change the offset in Kconfig.projbuild"
I guess they mean the "defaults" in ...components/partition/Kconfig.projbuild. But if you ran make menuconfig and assigned the correct values then I figure you are good.
John A
Yes, I did this change.
How can I increase boot time with large NVS? Help guys
Re: Custom partition table make slow boot
Posted: Sat Mar 24, 2018 3:59 pm
by fly135
Can you create a fat file system in a 1M partition and save your data there instead? Then you won't get the last delay on boot.
John A