All Projects → joltwallet → esp_littlefs

joltwallet / esp_littlefs

Licence: MIT license
LittleFS port for ESP-IDF

Programming Languages

c
50402 projects - #5 most used programming language
CMake
9771 projects
Makefile
30231 projects

Projects that are alternatives of or similar to esp littlefs

ESP DoubleResetDetector
ESP_DoubleResetDetector is a library for the ESP32/ESP8266 Arduino platform to enable trigger configure mode by resetting twice.
Stars: ✭ 34 (-76.22%)
Mutual labels:  spiffs, littlefs
ESPxWebFlMgr
Manage your ESP8266/ESP32 SPIFFS/LittleFS files with a simple web based interface
Stars: ✭ 33 (-76.92%)
Mutual labels:  spiffs, littlefs
littlefs2
Idiomatic Rust API for littlefs
Stars: ✭ 19 (-86.71%)
Mutual labels:  filesystem, littlefs
esp-idf-zh
ESP-IDF 中文文档
Stars: ✭ 102 (-28.67%)
Mutual labels:  esp-idf
s3-concat
Concatenate Amazon S3 files remotely using flexible patterns
Stars: ✭ 32 (-77.62%)
Mutual labels:  filesystem
Meteor-logger-file
🔖 Meteor Logging: Store application log messages into file (FS)
Stars: ✭ 24 (-83.22%)
Mutual labels:  filesystem
esp-epaper-display
ESP-IDF component for waveshare epaper displays
Stars: ✭ 16 (-88.81%)
Mutual labels:  esp-idf
Effortless-SPIFFS
A class designed to make reading and storing data on the ESP8266 and ESP32 effortless
Stars: ✭ 27 (-81.12%)
Mutual labels:  spiffs
react-file-manager
A file manager built in ReactJs
Stars: ✭ 40 (-72.03%)
Mutual labels:  filesystem
micro ros espidf component
micro-ROS ESP32 IDF component and sample code
Stars: ✭ 122 (-14.69%)
Mutual labels:  esp-idf
Gesture-Detecting-Macro-Keyboard
Glorified Bluetooth macro keyboard with machine learning (TensorFlow Lite for Microcontrollers) running on an ESP32.
Stars: ✭ 68 (-52.45%)
Mutual labels:  esp-idf
ccs811-esp-idf
CCS811 driver for ESP-IDF (ESP32)
Stars: ✭ 22 (-84.62%)
Mutual labels:  esp-idf
rorshach
A watchman for your directories. Rorshach allows you to listen to file system changes and run commands when these events occur.
Stars: ✭ 26 (-81.82%)
Mutual labels:  filesystem
Dazinator.Extensions.FileProviders
No description or website provided.
Stars: ✭ 34 (-76.22%)
Mutual labels:  filesystem
fswatch
File/Directory Watcher for Modern C++
Stars: ✭ 56 (-60.84%)
Mutual labels:  filesystem
BlynkGSM Manager
Simple GSM shield Manager for Blynk and ESP32 / ESP8266 boards, with or without SSL, configuration data saved in SPIFFS / EEPROM. This library enables user to include both Blynk GSM/GPRS and WiFi libraries in one sketch, run both WiFi and GSM/GPRS simultaneously, or select one to use at runtime after reboot.
Stars: ✭ 19 (-86.71%)
Mutual labels:  spiffs
ddlfs
Filesystem which represents Oracle Database objects as their DDL stored in .sql files
Stars: ✭ 31 (-78.32%)
Mutual labels:  filesystem
ssd1306-esp-idf-i2c
Sample code for driving 128x64 OLED display (SSD1306 driver) via ESP-IDF's I2C master driver
Stars: ✭ 93 (-34.97%)
Mutual labels:  esp-idf
RoverController
LoRa/WiFi remote controller for driving my rover
Stars: ✭ 87 (-39.16%)
Mutual labels:  esp-idf
ESP32 IMU BARO GPS VARIO
GPS altimeter/variometer with LCD display, routes with waypoints, data/gps track logging, bluetooth NMEA sentence transmission, wifi AP + webpage configuration
Stars: ✭ 72 (-49.65%)
Mutual labels:  esp-idf

LittleFS for ESP-IDF.

What is LittleFS?

LittleFS is a small fail-safe filesystem for microcontrollers. We ported LittleFS to esp-idf (specifically, the ESP32) because SPIFFS was too slow, and FAT was too fragile.

How to Use

There are two ways to add this component to your project

  1. As a ESP-IDF managed component: In your project directory run
idf.py add-dependency joltwallet/littlefs==1.5.1
  1. As a submodule: In your project, add this as a submodule to your components/ directory.
git submodule add https://github.com/joltwallet/esp_littlefs.git
git submodule update --init --recursive

The library can be configured via idf.py menuconfig under Component config->LittleFS.

Example

User @wreyford has kindly provided a demo repo showing the use of esp_littlefs. A modified copy exists in the example/ directory.

Documentation

See the official ESP-IDF SPIFFS documentation, basically all the functionality is the same; just replace spiffs with littlefs in all function calls.

Also see the comments in include/esp_littlefs.h

Slight differences between this configuration and SPIFFS's configuration is in the esp_vfs_littlefs_conf_t:

  1. max_files field doesn't exist since we removed the file limit, thanks to @X-Ryl669
  2. partition_label is not allowed to be NULL. You must specify the partition name from your partition table. This is because there isn't a define littlefs partition subtype in esp-idf. The subtype doesn't matter.

Filesystem Image Creation

At compile time, a filesystem image can be created and flashed to the device by adding the following to your project's CMakeLists.txt file:

littlefs_create_partition_image(partition_name path_to_folder_containing_files)

For example, if your partition table looks like:

# Name,   Type, SubType,  Offset,  Size, Flags
nvs,      data, nvs,      0x9000,  0x6000,
phy_init, data, phy,      0xf000,  0x1000,
factory,  app,  factory,  0x10000, 1M,
graphics,  data, spiffs,         ,  0xF0000, 

and your project has a folder called device_graphics, your call should be:

littlefs_create_partition_image(graphics device_graphics)

Performance

Here are some naive benchmarks to give a vague indicator on performance.

Formatting a ~512KB partition:

FAT:         963,766 us
SPIFFS:   10,824,054 us
LittleFS:  2,067,845 us

Writing 5 88KB files:

FAT:         13,601,171 us
SPIFFS*:    118,883,197 us
LittleFS**:   6,582,045 us
LittleFS***:  5,734,811 us
*Only wrote 374,784 bytes instead of the benchmark 440,000, so this value is extrapolated
**CONFIG_LITTLEFS_CACHE_SIZE=128
***CONFIG_LITTLEFS_CACHE_SIZE=512 (default value)

In the above test, SPIFFS drastically slows down as the filesystem fills up. Below is the specific breakdown of file write times for SPIFFS. Not sure what happens on the last file write.

SPIFFS:

88000 bytes written in 1325371 us
88000 bytes written in 1327848 us
88000 bytes written in 5292095 us
88000 bytes written in 19191680 us
22784 bytes written in 74082963 us

Reading 5 88KB files:

FAT:          3,111,817 us
SPIFFS*:      3,392,886 us
LittleFS**:   3,425,796 us
LittleFS***:  3,210,140 us
*Only read 374,784 bytes instead of the benchmark 440,000, so this value is extrapolated
**CONFIG_LITTLEFS_CACHE_SIZE=128
***CONFIG_LITTLEFS_CACHE_SIZE=512 (default value)

Deleting 5 88KB files:

FAT:         934,769 us
SPIFFS*:      822,730 us
LittleFS**:   31,502 us
LittleFS***:  20,063 us
*The 5th file was smaller, did not extrapolate value.
**CONFIG_LITTLEFS_CACHE_SIZE=128
***CONFIG_LITTLEFS_CACHE_SIZE=512 (default value)

Tips, Tricks, and Gotchas

  • LittleFS operates on blocks, and blocks have a size of 4096 bytes on the ESP32.

  • A freshly formatted LittleFS will have 2 blocks in use, making it seem like 8KB are in use.

Running Unit Tests

To flash the unit-tester app and the unit-tests, clone or symbolicly link this component to $IDF_PATH/tools/unit-test-app/components/littlefs. Make sure the folder name is littlefs, not esp_littlefs. Then, run the following:

cd $IDF_PATH/tools/unit-test-app
idf.py menuconfig  # See notes
idf.py -T littlefs -p YOUR_PORT_HERE flash monitor

In menuconfig:

  • Set the partition table to components/littlefs/partition_table_unit_test_app.csv

  • Double check your crystal frequency; my board doesn't work with autodetect.

To test on an encrypted partition, add the encrypted flag to the flash_test partition in partition_table_unit_test_app.csv. I.e.

flash_test,  data, spiffs,    ,        512K, encrypted

Also make sure that CONFIG_SECURE_FLASH_ENC_ENABLED=y in menuconfig.

The unit tester can then be flashed via the command:

idf.py -T littlefs -p YOUR_PORT_HERE encrypted-flash monitor

Breaking Changes

  • July 22, 2020 - Changed attribute type for file timestamp from 0 to 0x74 ('t' ascii value).

Acknowledgement

This code base was heavily modeled after the SPIFFS esp-idf component.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].