Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding LITTLEFS after esp_littlefs (IDF) is built-in #4483

Merged
merged 7 commits into from
Nov 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 52,7 @@ set(LIBRARY_SRCS
libraries/FS/src/vfs_api.cpp
libraries/HTTPClient/src/HTTPClient.cpp
libraries/HTTPUpdate/src/HTTPUpdate.cpp
libraries/LITTLEFS/src/LITTLEFS.cpp
libraries/NetBIOS/src/NetBIOS.cpp
libraries/Preferences/src/Preferences.cpp
libraries/SD_MMC/src/SD_MMC.cpp
Expand Down Expand Up @@ -130,6 131,7 @@ set(includedirs
libraries/FS/src
libraries/HTTPClient/src
libraries/HTTPUpdate/src
libraries/LITTLEFS/src
libraries/NetBIOS/src
libraries/Preferences/src
libraries/SD_MMC/src
Expand Down
4 changes: 4 additions & 0 deletions libraries/LITTLEFS/examples/LITTLEFS_PlatformIO/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 1,4 @@
.pio
.vscode
mklittlefs.exe
mklittlefs
68 changes: 68 additions & 0 deletions libraries/LITTLEFS/examples/LITTLEFS_PlatformIO/README.md
Original file line number Diff line number Diff line change
@@ -0,0 1,68 @@
# How to run on PlatformIO IDE

- Download and extract to this project root a **mklittlefs** executable for your OS [from a zipped binary here](https://github.com/earlephilhower/mklittlefs/releases)
- Open **LITTLEFS_PlatformIO** folder
- Run PlatformIO project task: **Upload Filesystem Image**
- Run PlatformIO project task: **Upload and Monitor**
- You will see a Serial output like:
```
--- Miniterm on COM5 115200,8,N,1 ---
--- Quit: Ctrl C | Menu: Ctrl T | Help: Ctrl T followed by Ctrl H ---
ets Jun 8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (Snfigsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:10044
load:0x40080400,len:5872
entry 0x400806ac
Listing directory: /
FILE: /file1.txt SIZE: 3 LAST WRITE: 2020-10-06 15:10:33
DIR : /testfolder LAST WRITE: 2020-10-06 15:10:33
Creating Dir: /mydir
Dir created
Writing file: /mydir/hello2.txt
- file written
Listing directory: /
FILE: /file1.txt SIZE: 3 LAST WRITE: 2020-10-06 15:10:33
DIR : /mydir LAST WRITE: 1970-01-01 00:00:00
Listing directory: /mydir
FILE: /mydir/hello2.txt SIZE: 6 LAST WRITE: 1970-01-01 00:00:00
DIR : /testfolder LAST WRITE: 2020-10-06 15:10:33
Listing directory: /testfolder
FILE: /testfolder/test2.txt SIZE: 3 LAST WRITE: 2020-10-06 15:10:33
Deleting file: /mydir/hello2.txt
- file deleted
Removing Dir: /mydir
Dir removed
Listing directory: /
FILE: /file1.txt SIZE: 3 LAST WRITE: 2020-10-06 15:10:33
DIR : /testfolder LAST WRITE: 2020-10-06 15:10:33
Listing directory: /testfolder
FILE: /testfolder/test2.txt SIZE: 3 LAST WRITE: 2020-10-06 15:10:33
Writing file: /hello.txt
- file written
Appending to file: /hello.txt
- message appended
Reading file: /hello.txt
- read from file:
Hello World!
Renaming file /hello.txt to /foo.txt
- file renamed
Reading file: /foo.txt
- read from file:
Hello World!
Deleting file: /foo.txt
- file deleted
Testing file I/O with /test.txt
- writing................................................................
- 1048576 bytes written in 12006 ms
- reading................................................................
- 1048576 bytes read in 547 ms
Deleting file: /test.txt
- file deleted
Test complete
```
- 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
Original file line number Diff line number Diff line change
@@ -0,0 1 @@
aaa
Original file line number Diff line number Diff line change
@@ -0,0 1 @@
bbb
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 1,2 @@
Import("env")
env.Replace( MKSPIFFSTOOL=env.get("PROJECT_DIR") '/mklittlefs' )
Original file line number Diff line number Diff line change
@@ -0,0 1,6 @@
# Name, Type, SubType, Offset, Size, Flags
ota_0, app, ota_0, 0x10000, 0x1A0000,
ota_1, app, ota_1, , 0x1A0000,
otadata, data, ota, 0x350000, 0x2000,
nvs, data, nvs, , 0x6000,
data, data, spiffs, , 0xA8000,
35 changes: 35 additions & 0 deletions libraries/LITTLEFS/examples/LITTLEFS_PlatformIO/platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 1,35 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[platformio]
default_envs = esp32

[env]
framework = arduino

[env:esp32]
platform = espressif32
;platform = https://github.com/platformio/platform-espressif32.git
;board_build.mcu = esp32
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git

build_flags =
${env.build_flags}
-D=${PIOENV}
;-D CONFIG_LITTLEFS_FOR_IDF_3_2

lib_deps = https://github.com/lorol/LITTLEFS.git

board = esp32dev
;board_build.partitions = partitions_custom.csv
monitor_filters = esp32_exception_decoder
monitor_speed = 115200

extra_scripts = ./littlefsbuilder.py
Loading