if you look in esp-idf/components/esp32/cpu_start.c you can see nvs_flash_init() inside a "if defined" clause. I'm guessing you call nvs_flash_init() when you don't define or define CONFIG_ESP32_PHY_AUTO_INIT to 0 in your sdkconfig.
nvs is the non volatile storage, the flash chip on the esp32. you will probably want to use it.
Code: Select all
ESP_ERROR_CHECK(esp_wifi_set_storage(WIFI_STORAGE_FLASH));//instead of WIFI_STORAGE_RAM
Can be set to flash for example.
Yes app_main is called from a task called main_task spawned in cpu_start.c
Lets say you are going to run a big program and need a lot of stack space, you can either redefine CONFIG_MAIN_TASK_STACK_SIZE in skdconfig which defines the main_task stack. Or start a new task and define your own stack space, after which you can delete the main_task.
I think you can track what happens from cpu_start.c if you wanna know what background stuff is happening. The wdt is also started.
This is all I figured out, please correct me if i'm wrong =)