Littlefs: LittleFS on an Arduino's EEPROM

Created on 10 Jul 2020  路  3Comments  路  Source: littlefs-project/littlefs

Hi everyone,

Thanks very much for LittleFS!

I'd very much like to use LittleFS on my Arduino (MEGA)'s EEPROM. I'm already using LittleFS on my ESP8266s and for compatibility reasons would really like to have it on my Arduinos as well.

I couldn't really find anything to start with:

It surely is possible to use LittleFS on an EEPROM, right? It just seems nobody has ever attempted to do it on an Arduino? Or am I just blind?

Any ideas?

Cheers,

Yann

question

All 3 comments

It's perfectly possible to port LittleFS to pretty much any system capable of compiling the code (as you yourself have highlighted, since you're using it on an ESP8266). At the lower level you just make the appropriate calls to littleFS. (If you look at some of the issues, many if not most of the contributors are running littleFs in a variety of environments; not just mbedOS).
At the hardware level its up to you to write drivers which interface between littleFs and your memory; these are relatively simple (close to the sort of thing you might write to test the hardware setup). And hardware is so variable that the lack of examples should come as no surprise. The documentation of what is required is pretty good (extremely good for an open source project, IMO) and there are further explanations in responses to some of the issues. So I suggest you get reading; here, and in the lfs.h file.
Main thing with EEPROM (as with flash) is that it takes a finite time to program, so you have to manage that appropriately. And you can run with a minimum block size of 128 bytes.

@e107steved those are good highlights.

The documentation is one thing I do want to improve, (especially around porting).


Two extra points:

  1. Look at the struct lfs_config, this is where littlefs gets its runtime configuration including block device functions:
    https://github.com/ARMmbed/littlefs/blob/master/lfs.h#L151
  2. If your compiler is special you may also need to modify lfs_util.h. If you don't already know that your compiler is special, I would try compiling as is, and then only change things if it's not compiling. If you're desperate, LFS_NO_INTRINSICS will fall back to software-only implementations of intrinsics.
    https://github.com/ARMmbed/littlefs/blob/master/lfs_util.h

It surely is possible to use LittleFS on an EEPROM, right?

How large is the EEPROM?

From my experience with EEPROM it's one of the easiest storage devices to use, but also the least dense. So littlefs should work fine, except if you have less than say ~2KiB, you may run into problems.

From my experience with EEPROM it's one of the easiest storage devices to use,

I actually use FRAM, which is even easier! Basically non-volatile SRAM, so byte at a time access, and no special requirements for writing. But it does cost rather more than EEPROM.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

joel-felcana picture joel-felcana  路  13Comments

keck-in-space picture keck-in-space  路  11Comments

roceh picture roceh  路  4Comments

eastmoutain picture eastmoutain  路  6Comments

iverdiver picture iverdiver  路  5Comments