I have some code to mount the spiffs:
Code: Select all
bool mount_spiffs()
{
// fill out spiffs config object
esp_vfs_spiffs_conf_t conf;
conf.base_path = "/spiffs";
conf.partition_label = NULL;
conf.max_files = 5;
conf.format_if_mount_failed = true;
esp_err_t ret = esp_vfs_spiffs_register( &conf );
if( ret != ESP_OK )
{
if ( ret == ESP_FAIL ) {
ESP_LOGE( __func__, "Failed to mount or format filesystem" );
} else if ( ret == ESP_ERR_NOT_FOUND ) {
ESP_LOGE( __func__, "Failed to find SPIFFS partition" );
} else {
ESP_LOGE( __func__, "Failed to initialize SPIFFS (%d)", ret );
}
return false;
}
else
{
ESP_LOGI( __func__, "spiffs mounted successfully" );
return true;
}
}
void spiffs_task( void *pvParameters ) {
if ( !mount_spiffs() ) {
// This is a serious problem that the spiffs did not mount
// TODO - publish an error!
ESP_LOGE(__func__,"SPIFFS did not mount!!");
esp_restart();
} else {
ESP_LOGI(__func__,"Mounted SPIFFS");
xEventGroupSetBits(relevant_events,bit_spiffs_ready);
}
vTaskDelete(NULL);
}
Code: Select all
W (289) SPIFFS: mount failed, -10025. formatting...
Task watchdog got triggered. The following tasks did not reset the watchdog in time:
- IDLE (CPU 0)
Tasks currently running:
CPU 0: spiffs_task
Aborting.
abort() was called at PC 0x400d34eb on core 0
0x400d34eb: task_wdt_isr at /dev/esp32/Firmware/esp-idf/components/esp32/task_wdt.c:236