LittleFS for ESP-IDF.
# What is LittleFS?
[LittleFS](https://github.com/ARMmbed/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
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 `make menuconfig` under `Component config->LittleFS`.
### Example
User @wreyford has kindly provided a demo repo showing the use of `esp_littlefs`:
https://github.com/wreyford/demo_esp_littlefs
# 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.
# 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, run
```
make tests
```
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:
```
make TEST_COMPONENTS='src' 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.
没有合适的资源?快使用搜索试试~ 我知道了~
esp_littlefs:用于ESP-IDF的LittleFS端口.zip
共20个文件
c:5个
mk:3个
txt:2个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 196 浏览量
2023-10-11
20:50:05
上传
评论
收藏 33KB ZIP 举报
温馨提示
esp_littlefs:用于ESP-IDF的LittleFS端口.zip
资源推荐
资源详情
资源评论
收起资源包目录
esp_littlefs:用于ESP-IDF的LittleFS端口.zip (20个子文件)
T
esp_littlefs-master
partition_table_unit_test_app.csv 796B
include
esp_littlefs.h 3KB
CMakeLists.txt 405B
component.mk 140B
Makefile 353B
src
littlefs
littlefs_api.h 4KB
esp_littlefs.c 50KB
test
CMakeLists.txt 129B
component.mk 87B
test_benchmark.c 8KB
test_littlefs.c 32KB
littlefs_api.c 2KB
LICENSE 1KB
Kconfig 5KB
sdkconfig.defaults 3KB
.gitmodules 105B
unit_tester
component.mk 0B
main.c 540B
.gitignore 31B
README.md 4KB
A
5
共 20 条
- 1
资源评论
N201871643
- 粉丝: 909
- 资源: 2296
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功