Hieromon / AutoConnect

An Arduino library for ESP8266/ESP32 WLAN configuration at runtime with the Web interface
https://hieromon.github.io/AutoConnect/
MIT License
911 stars 190 forks source link

SPIFFS: mount failed -10025 #589

Closed DitroniX closed 1 year ago

DitroniX commented 1 year ago

Have just setup as a quick 'test environment', in order to evaluate AutoConnect as an user option for my SDK boards:

Probably having a grey moment but note the below unexpected error. Tried on different boards and the same.

Any thoughts please?

Output rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:1 load:0x3fff0030,len:1184 load:0x40078000,len:13220 ho 0 tail 12 room 4 load:0x40080400,len:3028 entry 0x400805e4

**E (1039) SPIFFS: mount failed, -10025**

Many thanks Dave

wspitts2 commented 1 year ago

You might need to format the spiff folder: my setupSPIFF returns true if I don't get an error and false if I get an error. I relaunch spiffsSetup after formatting. That seems to do the trick for me.

if(!setupSPIFF()){ Serial.println("SPIFFS needs to be formatted and trying again"); SPIFFS.format(); if(!setupSPIFF()){ Serial.println("SPIFFS error try #2. Not sure, look into this...."); } }

DitroniX commented 1 year ago

Many thanks for the reply, will investigate.

Hieromon commented 1 year ago

@DitroniX The SPIFFS file system must be pre-formatted and will fail to begin if not formatted. You can also leave the SPIFFS formatting to the SPIFFS.begin API. You can automatically perform formatting as a file system by providing true as the first argument to SPIFFS.begin.

SPIFFS.begin(true);

The ESP32's SPIFFS file system is allocated in the flash area. It is defined as a spiffs partition and is distinct from the app partition that stores sketch binaries. It is not initialized by sketch upload. To use SPIFFS as a file system, it must be initialized separately from the sketch upload.

In particular, after performing an erase flash with esptool.py, the file system allocated on the spiffs partition is also erased. The first argument of the SPIFFS.begin API ensures the utility for mounting SPIFFS without having to initialize the SPIFFS file system every time.

Some examples of SPIFFS.begin(true) implementation in sketches can be found in the AutoConnect example.

wspitts2 commented 1 year ago

Well that is more elegant than what I was doing for sure! I guess RTFM a little deeper would have helped.

Hieromon commented 1 year ago

This is not within the scope of AutoConnect; it is a specification of the ESP32 Arduino Core's SPIFFS wrapper. Please raise this in the ESP32 forum for documentation.