How do I get the littlefs library?

I have tried using the littlefs in an esp32 project iwth board_build.filesystem = littlefs in platformio.ini. With this code …

#include "Arduino.h"
#include "LittleFS.h"
File root ="/", "r");

… I get 'LittleFS was not declared in this scope .

So I assumed I have to load a library with littlefs. I went into Libraries in quick access and searched for littlefs. All I got was “lorol/LittleFS_esp32” which is incompatible with all littlefs code I have found.

What am I supposed to do?

That’s not a valid configuration option for ESP32, only for ESP8266. The only official filesystem type for ESP32 in PlatformIO is SPIFFS.

Native LittleFS support is an open issue (Add LittleFS and FFat filesystem support · Issue #570 · platformio/platform-espressif32 · GitHub).

That does not mean you can’t use LittleFS with ESP32 and PlatformIO, you just have to use a library.

1 Like