Unable to upload the LittleFS file system with platformIO

Hello everyone,

I was using SPIFFS and I moved to LittleFS.
Every thing works expect the data upload to my esp8266.
I can upload LittleFS with the arduinoIDE plugin “ESP8266LittleFS Data Upload”
but cannot succeed with platformIO.
My configutation is Core 5.0.3 Home 3.3.1
extract from my ini file :
platform = espressif8266@2.6.2
board = d1
framework = arduino
board_build.filesystem = LittleFS
board_build.ldscript = eagle.flash.4m2m.ld

when I start the upload with pio run --target uploadfs or with the menu task “Uplad File System Image” I got the following answers :

Processing d1 (platform: espressif8266@2.6.2; board: d1; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/d1.html
PLATFORM: Espressif 8266 (2.6.2) > WEMOS D1 R1
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES:
 - framework-arduinoespressif8266 3.20704.5 (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)
Converting myprog.ino
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 91 compatible libraries
Scanning dependencies...
Dependency Graph
<.....>
Building in release mode
Filesystem LittleFS is not supported!

So I am wondering why I got such an error “Little FS is not supported” ???
It should be supported since 2.6.0 if I am right?

Do you have a clue on such a problem ?
Is there something wrong in my configuration ?

Thanks a lot

You must use the correct names here as the documentation tells you. littlefs, not LittleFS.

The error message is thrown in the Espressif8266 platform code and here you can also see exactly why.

1 Like

Thank you Maxgerhardt ! That was the problem !
I was writting it like in the library.

Now I am able to uplad the data with pio run -t uploadfs,
however the menu command task “Uplad File System Image” disappeared from the PIO menu.
It should be under PROJECT TASKS /myenv/Plaform but Platform does not show up.

Any idea ?

Thanks again

No problems for me here.

Try the project task default → Miscellaneous → Rebuild IntelliSense index, then re-open VSCode.

What does does the list of platform tasks for your environment look like?

At might also be that you just need to press “Build” once to download that exact platform version.

Great !
Rebuiding the intelliSense index did the job

I can again see Platform with the “Uplad File System Image” command.

Looks good you solved my issues. Many thanks.

Hello,

I tried rebuilding the intelliSense index, and it seems like everything is uploading, however, when trying to connect to my ESP32 and going to the local ip address it doesn’t seem to have the index.html page for me.

This is the message I get when building and uploading.

Processing adafruit_feather_esp32s3_tft (platform: espressif32; board: adafruit_feather_esp32s3_tft; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/adafruit_feather_esp32s3_tft.html
PLATFORM: Espressif 32 (6.2.0) > Adafruit Feather ESP32-S3 TFT
HARDWARE: ESP32S3 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-builtin, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 @ 3.20008.0 (2.0.8)
 - tool-esptoolpy @ 1.40501.0 (4.5.1)
 - tool-mkfatfs @ 2.0.1
 - tool-mklittlefs @ 1.203.210628 (2.3) 
 - tool-mkspiffs @ 2.230.0 (2.30)
 - toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
 - toolchain-xtensa-esp32s3 @ 8.4.0+2021r2-patch5
Warning! An extra UF2 bootloader image is already added!
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ deep, Compatibility ~ soft
Found 49 compatible libraries
Scanning dependencies...
Dependency Graph
|-- STM32duino VL53L4CD @ 1.0.2
|-- GFX Library for Arduino @ 1.3.5
|-- Adafruit ST7735 and ST7789 Library @ 1.10.0
|-- ESPAsyncWebServer-esphome @ 3.0.0
|-- Adafruit GFX Library @ 1.11.5
|-- LittleFS @ 2.0.0
|-- SPI @ 2.0.0
|-- WiFi @ 2.0.0
|-- Wire @ 2.0.0
Building in release mode
Building FS image from 'data' directory to .pio\build\adafruit_feather_esp32s3_tft\littlefs.bin
/.Rhistory
/index.html
/script.js
/style.css
Looking for upload port...
Auto-detected: COM10
Forcing reset using 1200bps open/close on port COM10
Waiting for the new upload port...
Uploading .pio\build\adafruit_feather_esp32s3_tft\littlefs.bin
esptool.py v4.5.1
Serial port COM9
Connecting...
Chip is ESP32-S3 (revision v0.1)
Features: WiFi, BLE
Crystal is 40MHz
MAC: f4:12:fa:59:a9:e0
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00310000 to 0x003fffff...
Compressed 983040 bytes to 2791...
Writing at 0x00310000... (100 %)
Wrote 983040 bytes (2791 compressed) at 0x00310000 in 8.4 seconds (effective 937.4 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
========================================================================================= [SUCCESS] Took 15.52 seconds =========================================================================================

This is what’s contained in my platform.ini

[env:adafruit_feather_esp32s3_tft]
platform = espressif32
board = adafruit_feather_esp32s3_tft
framework = arduino
lib_deps = `Preformatted text`
	stm32duino/STM32duino VL53L4CD@^1.0.2
	moononournation/GFX Library for Arduino@^1.3.5
	adafruit/Adafruit ST7735 and ST7789 Library@^1.10.0
	ottowinter/ESPAsyncWebServer-esphome@^3.0.0
monitor_speed = 115200
board_build.filesystem = littlefs
lib_ldf_mode=deep

Is it possible that the problem is the setup not calling the littlefs file system correctly?

// Replaces placeholder with sensor values
String processor(const String& var){
  //Serial.println(var);
  getSensor1Reading(status1, NewDataReady1);
  if(var == "DISTANCE"){
    return String(sensor1);
  }
  else if(var =="OFFSET"){
    return String(offset);
  }
  return String();
  getSensor2Reading(status2, NewDataReady2);
  if(var == "DISTANCE"){
    return String(sensor2);
  }
  else if(var =="OFFSET"){
    return String(offset);
  }
  return String();
}

/* Setup ---------------------------------------------------------------------*/
void setup()
{
  // Initialize serial for output.
  SerialPort.begin(115200);
  SerialPort.println("Starting...");

  initLittleFS();
  initWifi(); 
  // Route for root / web page
  server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
    request->send(LittleFS, "/index.html", String(), false, processor);
  });

  // Route to load style.css file, and script.js file
  server.serveStatic("/", LittleFS, "/");

  server.on("/distance", HTTP_GET, [](AsyncWebServerRequest *request){
    getSensor1Reading(status1, NewDataReady1);
    request->send_P(200, "text/plain", String(sensor2).c_str());
  });

    server.on("/offset", HTTP_GET, [](AsyncWebServerRequest *request){
    request->send_P(200, "text/plain", String(offset).c_str());
  });

  server.on("/zero", HTTP_GET, [] (AsyncWebServerRequest *request){
  zero(sensor1);
  Serial.println("Sensor Zeroed");
  });

  server.on("/reset", HTTP_GET, [] (AsyncWebServerRequest *request){
  offset = 0;
  Serial.println("Offset Reset");
  });

  server.begin();
  
  // Initialize I2C bus.
  DEV_I2C.begin();
  
  initSensors(sensor1_vl53l4cd_sat, sensor2_vl53l4cd_sat, sensor1add, sensor2add);
}