Migrating from SPIFFS to LittleFS

Published on 4 April 2022 at 18:12

I have an RFID door entry system built around a D1 Mini Pro that uses SPIFFS to store details of RFID tags assigned to the system and whether they are currently enabled.

I was doing some work on the software recently, and was getting tired of the SPIFFS deprecated messages in the compiler, so I thought I'd take a look at exactly how much work was going to be needed to migrate to LittleFS. I'd looked at this before, but I'd found that I was quickly getting sucked-in to discussions about system overhead larger file sizes so didn't take it any further.

 

So today I had a look at the ESP8266 core documentation here:

https://arduino-esp8266.readthedocs.io/en/latest/filesystem.html

and looked through the SPIFFS commands and methods that I'd used in my project.

It looked like it might be pretty straightforward, so I made a copy of my project, replaced <#include "FS.h"> with <#include "LittleFS.h"> and did a find/replace of "SPIFFS" with "LittleFS", hit the "Verify/Compile" button and sat back - fully expecting the compiler to throw-up dozens of compilation messages and warnings.

But WOW! - the code just compiled, and what's more when I uploaded it it just worked!

 

Unsurprisingly, given what I'd read about the different file strictures, LittleFS couldn't read the existing SPIFFS file that was on the Wemos, but formatting the file system, re-creating the file and re-populating it (all of which is done via Node-Red flows sending commands to the Wemos) was all I needed to do to get everything back to how it was.

In less than 15 minutes I'd migrated from SPIFFS to LittleFS. If I'd know it was going to e that easy I'd have done it months ago.

 

My system doesn't do a lot of intensive reading and writing with the file system, but  the small number of read-write operations that are done are noticeably quicker with LittleFS.

Add comment

Comments

André De Souza Martines
a year ago

Pete, please.
I know there are channels for this, but I'm not able to move forward. I'm stagnant, it seems that I'm always very close to solving it but it doesn't.
My issue is onboard esp8266 provisioning in ATMega2560. I already used it in Blynk V1.0, but I can't use it in the new version.
I upload it, I get information on the serial monitor, but adding a device to Blynk, I get the message blynk device is unable to connect the router.

Create Your Own Website With Webador