diff --git a/.gitmodules b/.gitmodules index c9e5e6fd92e..48a442eb436 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a2ca8e7286..08eac8a0679 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 @@ -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 diff --git a/README.md b/README.md index 27f18c077cc..f9bcf71b6bb 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/libraries/LITTLEFS b/libraries/LITTLEFS new file mode 160000 index 00000000000..36d467ecc73 --- /dev/null +++ b/libraries/LITTLEFS @@ -0,0 +1 @@ +Subproject commit 36d467ecc7342e0b02a6605cfbc554556968f995 diff --git a/libraries/Update/src/Update.h b/libraries/Update/src/Update.h index 9a46a784870..4016b99d444 100644 --- a/libraries/Update/src/Update.h +++ b/libraries/Update/src/Update.h @@ -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; diff --git a/libraries/Update/src/Updater.cpp b/libraries/Update/src/Updater.cpp index cfa28827e96..4bdaec8549f 100644 --- a/libraries/Update/src/Updater.cpp +++ b/libraries/Update/src/Updater.cpp @@ -70,6 +70,7 @@ UpdateClass::UpdateClass() , _size(0) , _progress_callback(NULL) , _progress(0) +, _paroffset(0) , _command(U_FLASH) , _partition(NULL) { @@ -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 { @@ -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; } diff --git a/package/package_esp32_index.template.json b/package/package_esp32_index.template.json index 2e6533eda9d..0cf534b5f58 100644 --- a/package/package_esp32_index.template.json +++ b/package/package_esp32_index.template.json @@ -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", diff --git a/tools/ide-fs-plugins/ESP32FS/tool/esp32fs.jar b/tools/ide-fs-plugins/ESP32FS/tool/esp32fs.jar new file mode 100644 index 00000000000..ddb1e13ea5c Binary files /dev/null and b/tools/ide-fs-plugins/ESP32FS/tool/esp32fs.jar differ diff --git a/tools/ide-fs-plugins/README.md b/tools/ide-fs-plugins/README.md new file mode 100644 index 00000000000..7aef3ec4213 --- /dev/null +++ b/tools/ide-fs-plugins/README.md @@ -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: */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 +