LittleFS Library ESP32?

Hey,
I used to use the arduino ide 2.0
Since a few weeks I’m using platform IO and I like it a lot

But a strange behaviour comes to me when using littlefs.

#include <Arduino.h>
#include <LittleFS.h>

void setup() {
  // put your setup code here, to run once:
}

void loop() {
  // put your main code here, to run repeatedly:
}

I got the following error


  • Looking for LittleFS.h dependency? Check our library registry!
  • CLI > platformio lib search “header:LittleFS.h”
  • Web > PlatformIO Registry

But LittleFs should be in the Core of the ESP32???

Also the URL is dead: PlatformIO Registry
What do I miss here?

thanks for u help

The new Arduino core maybe. Not the 1.0.6 PlatformIO is using, see Support for the latest Arduino v2.0 · Issue #619 · platformio/platform-espressif32 · GitHub.

Also they have arduino-esp32/libraries/LittleFS/examples/LITTLEFS_PlatformIO at master · espressif/arduino-esp32 · GitHub as a PlatformIO-ready example.

1 Like

Actually this example will throw some compiling errors.

Try this code with the ini settings below.

[platformio]

default_envs = esp32

[env:esp32]

framework = arduino

platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.3rc1/platform-espressif32-2.0.3.zip

board = esp32dev

board_build.partitions = min_spiffs.csv

monitor_filters = esp32_exception_decoder

monitor_speed = 115200

The result should be:

Listing directory: /
FILE: test.txt SIZE: 0 LAST WRITE: 1970-01-01 00:00:00
Creating Dir: /mydir
Dir created
Writing file: /mydir/hello2.txt

  • file written
    Create missing folders of: /mydir/newdir2/newdir3/hello3.txt
    Writing file to: /mydir/newdir2/newdir3/hello3.txt

  • file written
    Listing directory: /
    DIR : mydir LAST WRITE: 1969-12-31 23:59:59
    Listing directory: mydir

  • failed to open directory
    FILE: test.txt SIZE: 0 LAST WRITE: 1970-01-01 00:00:00
    Deleting file: /mydir/hello2.txt

  • file deleted
    Deleting file and empty folders on path: /mydir/newdir2/newdir3/hello3.txt

  • file deleted
    Removing all empty folders on path: /mydir/newdir2/newdir3/hello3.txt
    Removing Dir: /mydir
    rmdir failed
    Listing directory: /
    FILE: test.txt SIZE: 0 LAST WRITE: 1970-01-01 00:00:00
    Writing file: /hello.txt

  • file written
    Appending to file: /hello.txt

  • message appended
    Reading file: /hello.txt

  • read from file:
    Hello World!
    Renaming file /hello.txt to /foo.txt

  • file renamed
    Reading file: /foo.txt

  • read from file:
    Hello World!
    Deleting file: /foo.txt

  • file deleted
    Testing file I/O with /test.txt

  • writing…/components/esp_littlefs/src/littlefs/lfs.c:561:error: No more free space 77
    ./components/esp_littlefs/src/littlefs/lfs.c:561:error: No more free space 77
    …/components/esp_littlefs/src/littlefs/lfs.c:561:error: No more free space 77
    ./components/esp_littlefs/src/littlefs/lfs.c:561:error: No more free space 77
    .
    .
    .
    …/components/esp_littlefs/src/littlefs/lfs.c:561:error: No more free space 77

  • 1048576 bytes written in 3829 ms

  • reading

  • 0 bytes read in 0 ms
    Deleting file: /test.txt

  • file deleted
    Test complete

1 Like

Thanks for you replys.

It’s surprising, but in this case I will use SPIFFS because it’s straigt forward to use and when it completly replaced with littlefs I’m changing the code :slight_smile:

Happy coding