Huge littlefs.bin file

Hi,

When I m trying to upload file system image (Data folder) to Wemos d1 mini pro board the generated image file (littlefs.bin) is huge. More than 4gb and of course I m getting ERR: ERROR[4]: Not Enough Space. On Wemos d1 mini board everything working fine.

I checked it in Vscode macOs Catalina (pio core 4.4.0b1 and 4.3.4), Ubuntu desktop 20.04.1 LTS Vscode (pio core 4.3.4), Ubuntu server 18.04.4 LTS (pio core 4.3.4) and Win 10 Vscode (pio core 4.3.4).

Platformio.ini:

[platformio]
default_envs = d1_mini_pro

[env]
platform = espressif8266
framework = arduino
board_build.filesystem = littlefs
monitor_speed = 115200
upload_protocol = espota
upload_port = 10.0.0.35
lib_deps = 
	ESPAsyncTCP
	ESP Async WebServer

[env:d1_mini]
board = d1_mini

[env:d1_mini_pro]
board = d1_mini_pro

And my logs in both cases:

>Executing task in folder ESP8266_webserver_spiffs: platformio run --target uploadfs <
    Processing d1_mini_pro (board: d1_mini_pro; platform: espressif8266; framework: arduino)
--------------------------------------------------------------------
    Verbose mode can be enabled via `-v, --verbose` option
    CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/d1_mini_pro.html
    PLATFORM: Espressif 8266 (2.6.2) > WeMos D1 mini Pro
    HARDWARE: ESP8266 80MHz, 80KB RAM, 16MB Flash
    PACKAGES: 
     - framework-arduinoespressif8266 3.20704.0 (2.7.4) 
     - tool-esptool 1.413.0 (4.13) 
     - tool-esptoolpy 1.20800.0 (2.8.0) 
     - tool-mklittlefs 1.203.200522 (2.3) 
     - tool-mkspiffs 1.200.0 (2.0) 
     - toolchain-xtensa 2.40802.200502 (4.8.2)
    LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 31 compatible libraries
    Scanning dependencies...
    Dependency Graph
    |-- <ESPAsyncTCP> 1.2.2
    |   |-- <ESP8266WiFi> 1.0
    |-- <ESP Async WebServer> 1.2.3
    |  |-- <ESPAsyncTCP> 1.2.2
    |  |  |-- <ESP8266WiFi> 1.0
    |  |-- <Hash> 1.0
    |  |-- <ESP8266WiFi> 1.0
    |-- <ArduinoOTA> 1.0
    |  |-- <ESP8266WiFi> 1.0
    |  |-- <ESP8266mDNS> 1.2
    |  |  |-- <ESP8266WiFi> 1.0
    |-- <ESP8266WiFi> 1.0
    |-- <LittleFS(esp8266)> 0.1.0
    Building in release mode
    Building file system image from 'data' directory to .pio/build/d1_mini_pro/littlefs.bin
    /index.html
    /main.html
    /style.css
    skipping .DS_Store
    /src/css/doc.css
    /src/css/scheduler.css
    /src/js/scheduler.js
    Uploading .pio/build/d1_mini_pro/littlefs.bin
    21:51:55 [DEBUG]: Options: {'esp_ip': '10.0.0.35', 'host_ip': '0.0.0.0', 'esp_port': 8266, 'host_port': 19920, 'auth': '', 'image': '.pio/build/d1_mini_pro/littlefs.bin', 'spiffs': True, 'debug': True, 'progress': True}
    21:51:55 [INFO]: Starting on 0.0.0.0:19920
    21:52:17 [INFO]: Upload size: 4292845568
    21:52:17 [INFO]: Sending invitation to: 10.0.0.35
    21:52:17 [ERROR]: Bad Answer: ERR: ERROR[4]: Not Enough Space

> Executing task in folder ESP8266_webserver_spiffs: platformio run --target uploadfs <
Processing d1_mini (board: d1_mini; platform: espressif8266; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/d1_mini.html
PLATFORM: Espressif 8266 (2.6.2) > WeMos D1 R2 and mini
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES: 
 - framework-arduinoespressif8266 3.20704.0 (2.7.4) 
 - tool-esptool 1.413.0 (4.13) 
 - tool-esptoolpy 1.20800.0 (2.8.0) 
 - tool-mklittlefs 1.203.200522 (2.3) 
 - tool-mkspiffs 1.200.0 (2.0) 
 - toolchain-xtensa 2.40802.200502 (4.8.2)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 31 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <ESPAsyncTCP> 1.2.2
|   |-- <ESP8266WiFi> 1.0
|-- <ESP Async WebServer> 1.2.3
|   |-- <ESPAsyncTCP> 1.2.2
|   |   |-- <ESP8266WiFi> 1.0
|   |-- <Hash> 1.0
|   |-- <ESP8266WiFi> 1.0
|-- <ArduinoOTA> 1.0
|   |-- <ESP8266WiFi> 1.0
|   |-- <ESP8266mDNS> 1.2
|   |   |-- <ESP8266WiFi> 1.0
|-- <ESP8266WiFi> 1.0
|-- <LittleFS(esp8266)> 0.1.0
Building in release mode
Building file system image from 'data' directory to .pio/build/d1_mini/littlefs.bin
/index.html
/main.html
/style.css
skipping .DS_Store
/src/css/doc.css
/src/css/scheduler.css
/src/js/scheduler.js
Uploading .pio/build/d1_mini/littlefs.bin
21:49:09 [DEBUG]: Options: {'esp_ip': '10.0.0.35', 'host_ip': '0.0.0.0', 'esp_port': 8266, 'host_port': 57786, 'auth': '', 'image': '.pio/build/d1_mini/littlefs.bin', 'spiffs': True, 'debug': True, 'progress': True}
21:49:09 [INFO]: Starting on 0.0.0.0:57786
21:49:09 [INFO]: Upload size: 1024000
21:49:09 [INFO]: Sending invitation to: 10.0.0.35

Thank you.

Now that’s a really large number, 4GB minus 2072 kilobytes. It reminds me of issue mkspiffs crashes when invoked with negative size parameter · Issue #190 · platformio/platform-espressif8266 · GitHub which however occured with SPIFFS but with the same d1_mini_pro board. The size calculation code may have been copy-pated from the SPIFFS version and still exhibit the same bug though.

Workaround may still be valid by forcing the usage of only 8MB of flash of which 7MB is the filesystem.

board_build.ldscript = eagle.flash.8m7m.ld

@valeros could you have a look at this?

Yes, this workaround is still valid.

Thanks @maxgerhardt !