|
@@ -2,27 +2,28 @@
|
|
|
|
|
|
## LittleFS library for arduino-esp32
|
|
|
|
|
|
-- A LittleFS wrapper for Arduino ESP32 of [Mbed LittleFS](https://github.com/ARMmbed/littlefs)
|
|
|
+- A LittleFS wrapper for Arduino ESP32 of [ARMmbed LittleFS](https://github.com/ARMmbed/littlefs)
|
|
|
- Based on [ESP-IDF port of joltwallet/esp_littlefs](https://github.com/joltwallet/esp_littlefs) , thank you Brian!
|
|
|
-- See also the [LillteFS library for ESP8266 core](https://github.com/esp8266/Arduino/tree/master/libraries/LittleFS)
|
|
|
-- Functionality is similar to SPIFFS
|
|
|
+- As a reference, see [LillteFS library for ESP8266 core](https://github.com/esp8266/Arduino/tree/master/libraries/LittleFS)
|
|
|
- [PR at esp32 core development](https://github.com/espressif/arduino-esp32/pull/4096)
|
|
|
- [PR at esp-idf development](https://github.com/espressif/esp-idf/pull/5469)
|
|
|
-```diff
|
|
|
-! Warning: This wrapper depends on ESP-IDF version the esp32 core is built on
|
|
|
-```
|
|
|
-- Tested with esp32 cores built on IDFv3.2, IDFv3.3 and IDFv4 - IDFv4.3
|
|
|
-- See LITTLEFS_time example with file timestamps that works with esp32 core on IDF v3.3
|
|
|
+- The functionality is similar to SPIFFS
|
|
|
|
|
|
### Installation
|
|
|
|
|
|
-- If it gets accepted for [Arduino Library Manager](https://github.com/arduino/Arduino/wiki/Library-Manager-FAQ ), take it from there. The release 1.0 is compatible to core 1.0.4 and PlatformIO
|
|
|
-- Use git or copy **LITTLEFS** to Arduino IDE **/libraries** folder (File > Preferences > Sketchbook location) and adjust ```//#define CONFIG_LITTLEFS_FOR_IDF_3_2``` in **esp_littlefs.c** if needed. For all higher version, it should be commented.
|
|
|
+- Use **Arduino Library Manager** to check if its available there.
|
|
|
+- Or download / use **git** to have latest repository of **LITTLEFS** added to Arduino IDE **/libraries** folder
|
|
|
+(File > Preferences > Sketchbook location).
|
|
|
+- See ``` #define CONFIG_LITTLEFS_FOR_IDF_3_2 ``` in **esp_littlefs.c**.
|
|
|
+On IDF newer than 3.2, it **can** be commented to enable file timestamp feature.
|
|
|
+See LITTLEFS_time example. If it is uncommented, it builds with esp32 core based on any IDF 3.2 - 4.3
|
|
|
+- The other ``` #define CONFIG_LITTLEFS_xxxxx ``` are set to optimal default values.
|
|
|
+Read [here](https://github.com/joltwallet/esp_littlefs/blob/master/Kconfig) and [here](https://github.com/ARMmbed/littlefs/blob/master/README.md) if you want to modify.
|
|
|
|
|
|
### Usage
|
|
|
|
|
|
- Use LITTLEFS same way as SPIFFS
|
|
|
-- A quick startup based on your existing code you can re-define SPIFFS like this
|
|
|
+- A quick startup based on your existing code you can re-define SPIFFS
|
|
|
```
|
|
|
#define USE_LittleFS
|
|
|
|
|
@@ -34,9 +35,11 @@
|
|
|
#include <SPIFFS.h>
|
|
|
#endif
|
|
|
```
|
|
|
+ - Note, this may not work if your sketch uses other libraries that use SPIFFS themselves.
|
|
|
+
|
|
|
### Differences with SPIFFS
|
|
|
|
|
|
-- LittleFS has folders, you need need to iterate files in folders
|
|
|
+- LittleFS has folders, you need need to iterate files in folders. See **To Do** below.
|
|
|
- At root a "/folder" = "folder"
|
|
|
- Requires a label for mount point, NULL will not work
|
|
|
- maxOpenFiles parameter is unused, kept for compatibility
|
|
@@ -60,7 +63,7 @@
|
|
|
- Restart Arduino IDE.
|
|
|
|
|
|
### PlatformIO
|
|
|
- (notes from [BlueAndi](https://github.com/BlueAndi) )
|
|
|
+ ( notes from [BlueAndi](https://github.com/BlueAndi) )
|
|
|
- Add to _platformio.ini_:
|
|
|
`extra_scripts = replace_fs.py`
|
|
|
|
|
@@ -74,8 +77,15 @@
|
|
|
|
|
|
- Add _mklittlefs.exe_ to project root directory as well.
|
|
|
|
|
|
-
|
|
|
## Credits and license
|
|
|
|
|
|
-- This work is based on [Mbed LittleFS](https://github.com/ARMmbed/littlefs) , [ESP-IDF port of joltwallet/esp_littlefs](https://github.com/joltwallet/esp_littlefs) , [Espressif Arduino core for the ESP32, the ESP-IDF - SPIFFS Library](https://github.com/espressif/arduino-esp32/tree/master/libraries/SPIFFS)
|
|
|
+- This work is based on [ARMmbed LittleFS](https://github.com/ARMmbed/littlefs) , [ESP-IDF port of joltwallet/esp_littlefs](https://github.com/joltwallet/esp_littlefs) , [Espressif Arduino core for the ESP32, the ESP-IDF - SPIFFS Library](https://github.com/espressif/arduino-esp32/tree/master/libraries/SPIFFS)
|
|
|
- Licensed under GPL v2 ([text](LICENSE))
|
|
|
+
|
|
|
+## To Do
|
|
|
+ - [x] Submit to be added to Arduino Library Manager
|
|
|
+ - [ ] Decide on more compatibility (or not) with SPIFFS' lack of folders, similar to esp8266' way:
|
|
|
+ - [recursive folders auto creation](https://github.com/esp8266/Arduino/blob/master/libraries/LittleFS/src/LittleFS.cpp#L60) when a new file is created at non-existing path
|
|
|
+ - [recursive folders auto deletion](https://github.com/esp8266/Arduino/blob/master/libraries/LittleFS/src/LittleFS.h#L149) on "last file" deletion (SPIFFS cannot have "folder w/o file")
|
|
|
+ - review other differences: opendir(), rmdir(), unlink()
|
|
|
+ - [ ] Follow-up / eventually retire this library if LittleFS gets implemented through IDF / esp32 Arduino core.
|