Since some time (platformio 4), I experience errors when uploading SPIFFS image (pio run --target uploadfs) to ESP-07. However, SPIFFS files seem to be readable by the ESP application (at least some small files). But when writing to SPIFFS from the application the file is corrupted.
The problem occures with all my ESP-07 (=1MB flash size), but not with other modules (ESP12 / standard Wemos D1 Mini (4MB flash size)).
Has anyone experienced similar problems?
Possible causes could be:
The complete batch of my ESP-07 has a broken flash (real flash size < 1 MB).
There is a regression in the SPIFFS filesystem sources that corrupt data when writing to small SPIFFS partition (=64KB)
There is something wrong with the linker scripts. (That’s why I ask here in the platformio forum)
pio run --target=uploadfs:
Configuring flash size...
Auto-detected Flash size: 1MB
Compressed 65536 bytes to 185...
Wrote 65536 bytes (185 compressed) at 0x000eb000 in 0.0 seconds (effective 25971.4 kbit/s)...
A fatal error occurred: Timed out waiting for packet header
*** [uploadfs] Error 2
–> After this, the SPIFFS file are readable. However, they are very small (two config files less < 1KB) and I haven’t tested larger files yet.
For testing writing to SPIFFS I use a very simple function:
After this, the SPIFFS file is corrupted and reading it (immediatly after writing or after reset) results in reading many 0-Bytes. Other files on SPIFFS (that were uploaded by platformio) are still readable.
So I think the wear leveling function of SPIFFS writes to a locations that is somehow invalid.
My immediate thought on this is it’s probably a question worth asking on the esp8266/Arduino issue tracker also, as PlatformIO uses their linker scripts, etc… so it’s just as likely it’s a regression introduced with the recent SPIFFs/LittleFS changes as some incompatibility with PlatformIO. Have you tried reverting to an earlier espressif8266 platform to see if it’s related to a specific version of the core?