PlatformIO Community

Problems using Littlefs and esp32


I’m trying to follow the instructions on the library’s github and having absolutely no luck.

I pasted the mklittlefs.exe file on the root directory as well as the file. I also edited the platformio.ini file like shown.

The mklittlefs file does not have a .exe extention.

This is how the .py file reads in VSCode:


This is my .ini

I also get this error when I try to “Build Filesystem Image” ESP32 no connected yet.

Any help will be appreciated.

1 Like

IntelliSense errors on SCons scripts on these functions are completely ignorable. Import() is run-time injected function, so VSCode has no way of knowing it’s there. The code is runnable.

So what happens when you drop the .exe from the script?

Max!! Thanks for the support!

Same, thinks it’s a command.


Show your current please.


Copyed and pasted it from the library’s readme file.

Yes but there’s a .exe in there that you need to remove if your file is not called mklittefs.exe.


This is my project’s root. The .exe file that has to be downloaded is that Mklittlefs file. For what I red, its supposed to go there, right? Both the .py and the .exe.

Do you mean I should remove it?

The error the compiler throws says it’s an unrecognized command. :disappointed: They make it look simple everywhere! :joy:

Take a slow breath. Re-read all previous posts. Look at the script you’re using. It tells PlatformIO to use mklittlefs.exe by changing the MKSPIFFSTOOL environment variable.

env.Replace (MKSPIFFSTOOL = "mklittefs.exe")

so, if you are on Linux and the tool executable is just called mklittlefs without any extension, you must adapt the script to also use that name.

env.Replace (MKSPIFFSTOOL = "mklittefs")

Im on a Mac.

I just tryed what you suggested, changing the .py and remove the .exe from the third line. And same result.



One thing that I missed was that the Library’s instructions say to Open LITTLEFS_PlatformIO folder.


Maybe I need to create such folder? But where? :roll_eyes:

  • Where does your mklittlefs come from exactly?
  • is the file executable? (ls -l and check for x bit)
  • when you open a CLI and type ./mklittlefs, does something appear?

The .exe file was downloaded here:

If I execute the .exe file on my mac:


If I ls -l :

The screenshot is cut off… does it say “Abort trap 6” there? So the executable isn’t even runnable when you do ./mklittlefs? It should say

$ ./mklittlefs 
             Required arguments missing: list, unpack, create, image_file

Brief USAGE: 
   ./mklittlefs  {-c <pack_dir>|-u <dest_dir>|-l} [-d <0-5>] [-a] [-b
                 <number>] [-p <number>] [-s <number>] [--] [--version]
                 [-h] <image_file>

For complete USAGE and HELP type: 
   ./mklittlefs --help

Correct. It says Abort trap: 6

That’s weird, so the binary doesn’t seem functional.

Can you compile yourself? GitHub - earlephilhower/mklittlefs: Utility for creating littlefs for upload on the ESP8266

That goes a little beyond my current capabilities.

What errors do you get when you open a bash / commandline and do

git clone --recursive
cd mklittlefs
make dist


make: *** No rule to make target `dist’. Stop.

That’s weird, it works for me.

What does

tail -n +80 Makefile

output in the mklittefs directory?

If I run it like you suggest… No such file or directory. If I run it on the file:

tail -n +80 mklittlefs

I get… the matrix:


I might be doing something wrong someplace else. I tryed following the steps on the library and on the espressif documentation. But I might have missed something.

Then you were in the wrong folder when you executed make.

The git clone should have created a mklittlefs folder. Note that that should have been done in a separate bash instance outside your PIO project folder as to not overlap with the file mklittlefs. Can you try that again?