Add LittleFS support for internal flash storage#263
Add LittleFS support for internal flash storage#263ThomasFarstrike wants to merge 10 commits intoducalex:devfrom
Conversation
It seems access() doesn't work on littlefs, while stat() works on both littlefs and fat. This was initially noticed in prboom-go, because it does an access() to check if the WAD exists and this one gave an "IWAD not found".
|
I included esp_littlefs as a git submodule to avoid copy-paste. But I'm not sure whether you'd prefer a git submodule or a source copy instead. I'm starting to suspect the latter, otherwise you have to clone with "git clone --recurse-submodules". Let me know if you want me to change it :-) |
|
Or rg_tool.py doing the clone? |
|
I tested this with esp-idf 5.4 , which worked fine except for a few deprecation warnings. |
Because access() isn't compatible with littlefs.
|
I think I would prefer to vendor in esp_littlefs (source copy) instead of using a submodule! I'm reluctant to add external remote dependencies to retro-go for multiple reasons, and that one is small and self-contained so it should be fine to copy it. |
- Use fast access() method by default for better performance - Fall back to stat() only when RG_STORAGE_FLASH_PARTITION_LITTLEFS is defined This maintains LittleFS compatibility while preserving performance on FAT.
|
Sure, that makes sense. Done! I also added a little README.md in the components folder to explain what is there; especially the exact versions of the source copies. |
|
A bit of a tangent but do you know why esp_littlefs doesn't implement I imagine that littlefs has no concept of permissions but it could always return success on |
3df5df1 to
6ff291c
Compare
Hmmm, no I don't know why that is... |
ea87924 to
745c140
Compare
7a55bb6 to
fa7ea78
Compare
Overview
This PR adds optional LittleFS support to retro-go's internal flash storage subsystem, allowing retro-go to use LittleFS as an alternative to FAT for managing internal flash partitions.
Motivation
During development of the fri3d-2024 target, we encountered unexplained sporadic incompatibility issues between retro-go and MicroPython when both were sharing the same internal storage partition. These issues appeared to stem from differences in filesystem implementations—potentially due to different FAT versions, wear-leveling layer configurations, or other compatibility settings.
Since MicroPython defaults to LittleFS for internal storage (the modern standard for embedded systems), the most pragmatic solution is to add LittleFS support to retro-go. This way, we achieve good interoperability when both systems need to access the same internal storage.
Why LittleFS?
LittleFS is an excellent fit for microcontroller applications:
Changes
RG_STORAGE_FLASH_PARTITION_LITTLEFSconfiguration flagTesting
This implementation has been tested with:
Backward Compatibility
The changes are fully backward compatible. Existing configurations continue to use FAT by default. LittleFS support is opt-in via the
RG_STORAGE_FLASH_PARTITION_LITTLEFSconfiguration flag.