Skip to content

Commit cf60cf4

Browse files
authored
Adding LITTLEFS after esp_littlefs (IDF) is built-in (espressif#4483)
Tools idea: https://github.com/lorol/arduino-esp32fs-plugin
1 parent b5b45cd commit cf60cf4

19 files changed

+1130
-4
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ set(LIBRARY_SRCS
5252
libraries/FS/src/vfs_api.cpp
5353
libraries/HTTPClient/src/HTTPClient.cpp
5454
libraries/HTTPUpdate/src/HTTPUpdate.cpp
55+
libraries/LITTLEFS/src/LITTLEFS.cpp
5556
libraries/NetBIOS/src/NetBIOS.cpp
5657
libraries/Preferences/src/Preferences.cpp
5758
libraries/SD_MMC/src/SD_MMC.cpp
@@ -130,6 +131,7 @@ set(includedirs
130131
libraries/FS/src
131132
libraries/HTTPClient/src
132133
libraries/HTTPUpdate/src
134+
libraries/LITTLEFS/src
133135
libraries/NetBIOS/src
134136
libraries/Preferences/src
135137
libraries/SD_MMC/src
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.pio
2+
.vscode
3+
mklittlefs.exe
4+
mklittlefs
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# How to run on PlatformIO IDE
2+
3+
- Download and extract to this project root a **mklittlefs** executable for your OS [from a zipped binary here](https://github.com/earlephilhower/mklittlefs/releases)
4+
- Open **LITTLEFS_PlatformIO** folder
5+
- Run PlatformIO project task: **Upload Filesystem Image**
6+
- Run PlatformIO project task: **Upload and Monitor**
7+
- You will see a Serial output like:
8+
```
9+
--- Miniterm on COM5 115200,8,N,1 ---
10+
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
11+
ets Jun 8 2016 00:22:57
12+
13+
rst:0x1 (POWERON_RESET),boot:0x13 (Snfigsip: 0, SPIWP:0xee
14+
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
15+
mode:DIO, clock div:2
16+
load:0x3fff0018,len:4
17+
load:0x3fff001c,len:1044
18+
load:0x40078000,len:10044
19+
load:0x40080400,len:5872
20+
entry 0x400806ac
21+
Listing directory: /
22+
FILE: /file1.txt SIZE: 3 LAST WRITE: 2020-10-06 15:10:33
23+
DIR : /testfolder LAST WRITE: 2020-10-06 15:10:33
24+
Creating Dir: /mydir
25+
Dir created
26+
Writing file: /mydir/hello2.txt
27+
- file written
28+
Listing directory: /
29+
FILE: /file1.txt SIZE: 3 LAST WRITE: 2020-10-06 15:10:33
30+
DIR : /mydir LAST WRITE: 1970-01-01 00:00:00
31+
Listing directory: /mydir
32+
FILE: /mydir/hello2.txt SIZE: 6 LAST WRITE: 1970-01-01 00:00:00
33+
DIR : /testfolder LAST WRITE: 2020-10-06 15:10:33
34+
Listing directory: /testfolder
35+
FILE: /testfolder/test2.txt SIZE: 3 LAST WRITE: 2020-10-06 15:10:33
36+
Deleting file: /mydir/hello2.txt
37+
- file deleted
38+
Removing Dir: /mydir
39+
Dir removed
40+
Listing directory: /
41+
FILE: /file1.txt SIZE: 3 LAST WRITE: 2020-10-06 15:10:33
42+
DIR : /testfolder LAST WRITE: 2020-10-06 15:10:33
43+
Listing directory: /testfolder
44+
FILE: /testfolder/test2.txt SIZE: 3 LAST WRITE: 2020-10-06 15:10:33
45+
Writing file: /hello.txt
46+
- file written
47+
Appending to file: /hello.txt
48+
- message appended
49+
Reading file: /hello.txt
50+
- read from file:
51+
Hello World!
52+
Renaming file /hello.txt to /foo.txt
53+
- file renamed
54+
Reading file: /foo.txt
55+
- read from file:
56+
Hello World!
57+
Deleting file: /foo.txt
58+
- file deleted
59+
Testing file I/O with /test.txt
60+
- writing................................................................
61+
- 1048576 bytes written in 12006 ms
62+
- reading................................................................
63+
- 1048576 bytes read in 547 ms
64+
Deleting file: /test.txt
65+
- file deleted
66+
Test complete
67+
```
68+
- If you have a module with more than 4MB flash, you can uncomment **partitions_custom.csv** in **platformio.ini** and modify the csv file accordingly
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
aaa
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bbb

libraries/LITTLEFS/examples/LITTLEFS_PlatformIO/include/.placeholder.txt

Whitespace-only changes.

libraries/LITTLEFS/examples/LITTLEFS_PlatformIO/lib/.placeholder.txt

Whitespace-only changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Import("env")
2+
env.Replace( MKSPIFFSTOOL=env.get("PROJECT_DIR") + '/mklittlefs' )
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Name, Type, SubType, Offset, Size, Flags
2+
ota_0, app, ota_0, 0x10000, 0x1A0000,
3+
ota_1, app, ota_1, , 0x1A0000,
4+
otadata, data, ota, 0x350000, 0x2000,
5+
nvs, data, nvs, , 0x6000,
6+
data, data, spiffs, , 0xA8000,
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
; PlatformIO Project Configuration File
2+
;
3+
; Build options: build flags, source filter
4+
; Upload options: custom upload port, speed and extra flags
5+
; Library options: dependencies, extra library storages
6+
; Advanced options: extra scripting
7+
;
8+
; Please visit documentation for the other options and examples
9+
; https://docs.platformio.org/page/projectconf.html
10+
11+
[platformio]
12+
default_envs = esp32
13+
14+
[env]
15+
framework = arduino
16+
17+
[env:esp32]
18+
platform = espressif32
19+
;platform = https://github.com/platformio/platform-espressif32.git
20+
;board_build.mcu = esp32
21+
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git
22+
23+
build_flags =
24+
${env.build_flags}
25+
-D=${PIOENV}
26+
;-D CONFIG_LITTLEFS_FOR_IDF_3_2
27+
28+
lib_deps = https://github.com/lorol/LITTLEFS.git
29+
30+
board = esp32dev
31+
;board_build.partitions = partitions_custom.csv
32+
monitor_filters = esp32_exception_decoder
33+
monitor_speed = 115200
34+
35+
extra_scripts = ./littlefsbuilder.py

0 commit comments

Comments
 (0)