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 w/o rebuild the IDF #4096

Closed
wants to merge 17 commits into from
Closed
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "libraries/AzureIoT"]
path = libraries/AzureIoT
url = https://github.com/VSChina/ESP32_AzureIoT_Arduino
[submodule "libraries/LITTLEFS"]
path = libraries/LITTLEFS
url = https://github.com/lorol/LITTLEFS.git
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ set(LIBRARY_SRCS
libraries/FFat/src/FFat.cpp
libraries/FS/src/FS.cpp
libraries/FS/src/vfs_api.cpp
libraries/LITTLEFS/src/LITTLEFS.cpp
libraries/LITTLEFS/src/esp_littlefs.c
libraries/LITTLEFS/src/lfs.c
libraries/LITTLEFS/src/lfs_util.c
libraries/LITTLEFS/src/littlefs_api.c
libraries/HTTPClient/src/HTTPClient.cpp
libraries/HTTPUpdate/src/HTTPUpdate.cpp
libraries/NetBIOS/src/NetBIOS.cpp
Expand Down Expand Up @@ -187,6 +192,7 @@ set(COMPONENT_ADD_INCLUDEDIRS
libraries/ESPmDNS/src
libraries/FFat/src
libraries/FS/src
libraries/LITTLEFS/src
libraries/HTTPClient/src
libraries/HTTPUpdate/src
libraries/NetBIOS/src
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@

### Need help or have a question? Join the chat at [![https://gitter.im/espressif/arduino-esp32](https://badges.gitter.im/espressif/arduino-esp32.svg)](https://gitter.im/espressif/arduino-esp32?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

## In this fork:
- Added **LITTLEFS** library wrapper
- Added **mklittlefs** and **mkfatfs** tools to *package_esp32_index.template.json*
- Modified the **Update** library for OTA support of ffat partition
- Added **ide-fs-plugins** sub-folder in **/tools** with handy IDE plugin tools for uploading **data** as partition


## Contents
- [Development Status](#development-status)
- [Installation Instructions](#installation-instructions)
Expand Down
1 change: 1 addition & 0 deletions libraries/LITTLEFS
Submodule LITTLEFS added at 36d467
1 change: 1 addition & 0 deletions libraries/Update/src/Update.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ class UpdateClass {
size_t _size;
THandlerFunction_Progress _progress_callback;
uint32_t _progress;
uint32_t _paroffset;
uint32_t _command;
const esp_partition_t* _partition;

Expand Down
17 changes: 13 additions & 4 deletions libraries/Update/src/Updater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ UpdateClass::UpdateClass()
, _size(0)
, _progress_callback(NULL)
, _progress(0)
, _paroffset(0)
, _command(U_FLASH)
, _partition(NULL)
{
Expand Down Expand Up @@ -137,9 +138,14 @@ bool UpdateClass::begin(size_t size, int command, int ledPin, uint8_t ledOn) {
}
else if (command == U_SPIFFS) {
_partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_SPIFFS, NULL);
_paroffset = 0;
if(!_partition){
_error = UPDATE_ERROR_NO_PARTITION;
return false;
_partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_FAT, NULL);
_paroffset = 0x1000; //Offset for ffat, assuming size is already corrected
if(!_partition){
_error = UPDATE_ERROR_NO_PARTITION;
return false;
}
}
}
else {
Expand Down Expand Up @@ -192,11 +198,14 @@ bool UpdateClass::_writeBuffer(){
if (!_progress && _progress_callback) {
_progress_callback(0, _size);
}
if(!ESP.flashEraseSector((_partition->address + _progress)/SPI_FLASH_SEC_SIZE)){

if(_command == U_FLASH) _paroffset = 0; //ffat correction

if(!ESP.flashEraseSector((_partition->address + _paroffset + _progress)/SPI_FLASH_SEC_SIZE)){ //ffat correction
_abort(UPDATE_ERROR_ERASE);
return false;
}
if (!ESP.flashWrite(_partition->address + _progress, (uint32_t*)_buffer, _bufferLen)) {
if (!ESP.flashWrite(_partition->address + _paroffset + _progress, (uint32_t*)_buffer, _bufferLen)) { //ffat correction
_abort(UPDATE_ERROR_WRITE);
return false;
}
Expand Down
75 changes: 75 additions & 0 deletions package/package_esp32_index.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,81 @@
}
]
},
{
"version": "0.3.6",
"name": "mkfatfs",
"systems": [
{
"host": "i686-pc-linux-gnu",
"url": "https://github.com/lorol/arduino-esp32fatfs-plugin/raw/master/extra/mkfatfs.tar.gz",
"archiveFileName": "mkfatfs.tar.gz",
"checksum": "SHA-256:641322f1107796d7d77eacfdca0377a942e20fc7c228c6b2aa807dda5117e0af",
"size": "112148"
},
{
"host": "i686-mingw32",
"url": "https://github.com/lorol/arduino-esp32fatfs-plugin/raw/master/extra/mkfatfs.zip",
"archiveFileName": "mkfatfs.zip",
"checksum": "SHA-256:966f378da8bba524197d7d8a919e93b21b4680ead03ae69cac8bb56f8ec864a6",
"size": "612169"
}
]
},
{
"version": "3.0.0-gnu12-dc7f933",
"name": "mklittlefs",
"systems": [
{
"host": "aarch64-linux-gnu",
"url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/3.0.0-gnu12/aarch64-linux-gnu.mklittlefs-c41e51a.200706.tar.gz",
"archiveFileName": "aarch64-linux-gnu.mklittlefs-c41e51a.200706.tar.gz",
"checksum": "SHA-256:fc56e389383749e4cf4fab0fcf75cc0ebc41e59383caf6c2eff1c3d9794af200",
"size": "44651"
},
{
"host": "arm-linux-gnueabihf",
"url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/3.0.0-gnu12/arm-linux-gnueabihf.mklittlefs-c41e51a.200706.tar.gz",
"archiveFileName": "arm-linux-gnueabihf.mklittlefs-c41e51a.200706.tar.gz",
"checksum": "SHA-256:52b642dd0545eb3bd8dfb75dde6601df21700e4867763fd2696274be279294c5",
"size": "37211"
},
{
"host": "i686-pc-linux-gnu",
"url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/3.0.0-gnu12/i686-linux-gnu.mklittlefs-c41e51a.200706.tar.gz",
"archiveFileName": "i686-linux-gnu.mklittlefs-c41e51a.200706.tar.gz",
"checksum": "SHA-256:7886051d8ccc54aed0af2e7cdf6ff992bb51638df86f3b545955697720b6d062",
"size": "48033"
},
{
"host": "i686-mingw32",
"url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/3.0.0-gnu12/i686-w64-mingw32.mklittlefs-c41e51a.200706.zip",
"archiveFileName": "i686-w64-mingw32.mklittlefs-c41e51a.200706.zip",
"checksum": "SHA-256:43740db30ce451454f2337331f10ab4ed41bd83dbf0fa0cb4387107388b59f42",
"size": "332655"
},
{
"host": "x86_64-apple-darwin",
"url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/3.0.0-gnu12/x86_64-apple-darwin14.mklittlefs-c41e51a.200706.tar.gz",
"archiveFileName": "x86_64-apple-darwin14.mklittlefs-c41e51a.200706.tar.gz",
"checksum": "SHA-256:e3edd5e05b70db3c7df6b9d626558348ad04804022fe955c799aeb51808c7dc3",
"size": "362608"
},
{
"host": "x86_64-pc-linux-gnu",
"url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/3.0.0-gnu12/x86_64-linux-gnu.mklittlefs-c41e51a.200706.tar.gz",
"archiveFileName": "x86_64-linux-gnu.mklittlefs-c41e51a.200706.tar.gz",
"checksum": "SHA-256:66e84dda0aad747517da3785125e05738a540948aab2b7eaa02855167a1eea53",
"size": "46778"
},
{
"host": "x86_64-mingw32",
"url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/3.0.0-gnu12/x86_64-w64-mingw32.mklittlefs-c41e51a.200706.zip",
"archiveFileName": "x86_64-w64-mingw32.mklittlefs-c41e51a.200706.zip",
"checksum": "SHA-256:2e319077491f8e832e96eb4f2f7a70dd919333cee4b388c394e0e848d031d542",
"size": "345132"
}
]
},
{
"name": "mkspiffs",
"version": "0.2.3",
Expand Down
Binary file added tools/ide-fs-plugins/ESP32FS/tool/esp32fs.jar
Binary file not shown.
17 changes: 17 additions & 0 deletions tools/ide-fs-plugins/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# arduino-fs-plugin

### SPIFFS, LittleFS and FatFS filesystem upload tool for Arduino IDE

- In your Arduino sketchbook directory, create **tools** directory if it doesn't exist yet.
- Copy provided file (update if exists) to following path: *<home_dir>/Arduino/**tools**/ESP32FS/tool/esp32fs.jar*
- Restart Arduino IDE.
- See Arduino IDE' ***Tools*** menu and use the uploader when needed.
- At GitHub: https://github.com/lorol/arduino-esp32fs-plugin

**The original tool and other tool's locations**
https://github.com/me-no-dev/arduino-esp32fs-plugin
https://github.com/esp8266/arduino-esp8266fs-plugin
https://github.com/earlephilhower/arduino-esp8266littlefs-plugin
https://github.com/lorol/arduino-esp32littlefs-plugin
https://github.com/lorol/arduino-esp32fatfs-plugin