SPIFFS not Mounted (ESP8266)

I wrote About one year before a lot of Projects with ESP8266 using SPIFFS. Now I want to update a little bit, but SPIFFS doesn’t work anymore. Using Expressif8266 Version 1.8.0 all is ok, but with upgrade to 2.2.2 the same Code Fails. Not mounted and no Format is possible…

#include <FS.h>

if (SPIFFS.begin()) {

** Serial.println(F("\nSPIFFS not mounted."));**
** SPIFFS.format();**
** }**

My platformio.ini

env_default = d1_mini

platform = espressif8266
board = d1_mini
framework = arduino

build_flags = -Wl,-Teagle.flash.2m.ld
upload_speed = 921600
; Serial Monitor options
monitor_speed = 115200

Any ideas ?

This selects a linker file in which has 0 Bytes of memory available for SPIFFS.

/* Flash Split for 2M chips */
/* sketch @0x40200000 (~1019KB) (1044464B) */
/* empty  @0x402FEFF0 (~1008KB) (1032208B) */
/* spiffs @0x403FB000 (~0KB) (0B) */
/* eeprom @0x403FB000 (4KB) */
/* rfcal  @0x403FC000 (4KB) */
/* wifi   @0x403FD000 (12KB) */

Why do you do that? d1_mini by default has a linker file with a 4MB flash with 1MB dedicated for SPIFFS.

1 Like


you are right, thanks. Now it’s ok, but in case of upload files with OTA in into the filesystem comes the error
Update error: ERROR[10]: Magic byte is wrong, not 0xE9 ?
Former i used the build_flags = -Wl,-Tesp.flash.2m.ld and there was place for spiffs!!! with the same name „flash.2m“.
/* Flash Split for 2M chips /
sketch 1019KB /
spiffs 1004KB /
eeprom 20KB */

dport0_0_seg : org = 0x3FF00000, len = 0x10
dram0_0_seg : org = 0x3FFE8000, len = 0x14000
iram1_0_seg : org = 0x40100000, len = 0x8000
irom0_0_seg : org = 0x40201010, len = 0xfeff0

PROVIDE ( _SPIFFS_start = 0x40300000 );
PROVIDE ( _SPIFFS_end = 0x403FB000 );
PROVIDE ( _SPIFFS_page = 0x100 );
PROVIDE ( _SPIFFS_block = 0x2000 );

INCLUDE “…/ld/eagle.app.v6.common.ld”

I use the 2MB linker file, that all my chips have the same filesystem



Seems like you instruct OTA to do a firmware upgrade instead of a SPIFFS upgrade? See Spiffs OTA Update - Magic byte is wrong · Issue #220 · me-no-dev/ESPAsyncWebServer · GitHub. What is the code you’re running?

Then the file content must have been changed during revisions, hm. But every other file with the format xMB.ld has 0 SPIFFS, see eagle.flash.4m.ld or eagle.flash.1m.ld. Maybe the 2MB was inconsistent and fixed.

Back in mid-late 2018, when they (ESP8266 Arduino core developers) started using the board generator script to create the ld scripts, and also provide a few more default configurations (another 7 or so IIRC), there was only the one 2M ld script, and it defined a ~1MB SPIFF partition. There are now five, with the one which matches your old functionality being eagle.flash.2m1m.ld:

/* Flash Split for 2M chips */
/* sketch @0x40200000 (~1019KB) (1044464B) */
/* empty  @0x402FEFF0 (~4KB) (4112B) */
/* spiffs @0x40300000 (~1000KB) (1024000B) */
/* eeprom @0x403FB000 (4KB) */
/* rfcal  @0x403FC000 (4KB) */
/* wifi   @0x403FD000 (12KB) */