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

Added LittleFS and FatFS choice on drop-down #23

Closed
wants to merge 28 commits into from
Closed
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
168d02b
Change tool from esptool to esptool_py
me-no-dev Jan 15, 2019
7a0de41
Added LittleFS choice
lorol Jun 19, 2020
6a327a5
Added message to show found espota, esptool, mklittlefs and mkspiffs …
lorol Jun 29, 2020
90a1724
Updated README
lorol Jul 9, 2020
07d7a82
Added FatFS
lorol Jul 14, 2020
f490215
Fix README.md
lorol Jul 14, 2020
2c71408
Added batch for Windows quick build
lorol Jul 14, 2020
d4c0f00
Release 2.0.1
lorol Jul 14, 2020
97143d0
Updated README.md
lorol Jul 15, 2020
b51ef07
Updated README.md and added a snapshot
lorol Jul 17, 2020
fee9640
Change first choice (default) of drop-down to LittleFS
lorol Jul 31, 2020
9efcdb7
Added a choice to "Erase All Flash" at the end of FS type selections
lorol Oct 9, 2020
aaa5335
add support to esp32s2
steph-prv Oct 23, 2020
eeb21f3
Merge branch 'master' into fix_merge
zouffin Oct 23, 2020
4651830
Merge branch 'zouffin-fix_merge'
lorol Nov 10, 2020
92b4956
Added messages to console about chip type
lorol Nov 10, 2020
0e20b77
Use partitions.csv from sketch folder
lorol Nov 20, 2020
83a0e1a
Calculating the missing Offset (begining of partition) of partition.c…
lorol Nov 21, 2020
cd75923
Parse partition csv file line' Offset(Start address) and Size values
lorol Nov 22, 2020
810d85c
Improvements and tests before release
lorol Nov 22, 2020
22efec6
Release 2.0.5 with comment how to build a jar that is in esp32fs_no_c…
lorol Nov 24, 2020
a41ef5c
jar files added to .gitignore
lorol Nov 24, 2020
e4c702f
More universal way to get chip model
lorol Dec 15, 2020
b97f756
Bugfixes
lorol Dec 22, 2020
8543000
Better make_win.bat
Dec 23, 2020
b2268aa
Update Readme
lorol Dec 23, 2020
e995308
Update ESP32FS.java
lorol Dec 23, 2020
310e9d0
Update make_win.bat
lorol Dec 23, 2020
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
bin/
dist/
src/*.jar
70 changes: 63 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,90 @@
# Arduino ESP32 filesystem uploader

Arduino plugin which packs sketch data folder into SPIFFS filesystem image,
- Arduino plugin which packs sketch data folder into SPIFFS, LittleFS or FatFS filesystem image,
and uploads the image to ESP32 flash memory.
- Added custom **"partition.csv"** file processing if it is located in the sketch folder.
- Added esp32 / esp32s2 chip detection based on Arduino IDE selection.
- Added a choice to "Erase all flash".
- You can have only one of three filesystems on same Arduino project as data partition.

## Notes for SPIFFS

- This is the default filesystem implemented in esp-32 core for /data folder
- Go to Arduino IDE menu: ***Tools > Partition Scheme*** and select an entry with SPIFFS partition

## Notes for LittleFS

- Same partition scheme as SPIFFS
- Until fully implemented to esp-32 core, it needs an extra library.
It is already considered for next core releases. The mklittlefs tool is provided from there.
- For reference see [LITTLEFS esp32 library](https://github.com/lorol/LITTLEFS) for more details
- If you need the [mklittlefs tool](https://github.com/earlephilhower/mklittlefs) download the [release](https://github.com/earlephilhower/mklittlefs/releases) or find it [archived at previous releases here](https://github.com/lorol/arduino-esp32fs-plugin/releases )
- Copy **mklittlefs[.exe]** to **/tools** folder of esp32 platform where **espota** and **esptool** (.py or.exe) tools are located

## Notes for FatFS

- Go to Arduino IDE menu: ***Tools > Partition Scheme*** and select an entry with FAT partition
- If not provided by the core, you may need additional binary files for Windows or Linux, thanks [@lbernstone](https://github.com/lbernstone) for compiling - or take them from the author [here - mkfatfs tool](https://github.com/labplus-cn/mkfatfs/releases/tag/v1.0) , thanks to [labplus-cn](https://github.com/labplus-cn/mkfatfs) or take from [archived previous release here](https://github.com/lorol/arduino-esp32fs-plugin/releases )
- If missing, you need to copy **mkfatfs[.exe]** to **/tools** folder of esp32 platform where **espota** and **esptool** (.py or.exe) tools are located
- The usable size of FAT partition is reduced with 1 sector of 4096 bytes (0x1000) to resolve wear leveling space requirement. The image file is flashed with +4096 bytes (0x1000) offset of partition address of csv table entry
- You may need to decrease **maxOpenFiles** at FFat.begin() of your sketch , [see this note](http://marc.merlins.org/perso/arduino/post_2019-03-30_Using-FatFS-FFat-on-ESP32-Flash-With-Arduino.html)
>The FFAT module uses 8KB plus 4KB per concurrent file that can be opened. By default, it allows 10 files to be opened, which means it uses 48KB. IF you want to reduce its memory use, you can tell it to only support one file, and you will save 36KB, leaving you with only 12KB used.
```
if (!FFat.begin(0, "", 1)) die("Fat FS mount failed. Not enough RAM?");
```
- To flash the data folder as FAT partition by **network port (uses espota)**, replace your esp32-core Update library with the [modified files here](https://github.com/lorol/arduino-esp32fatfs-plugin/tree/master/extra/esp32-modified-Update-lib-ffat-espota.zip)

## Installation

- Make sure you use one of the supported versions of Arduino IDE and have ESP32 core installed.
- Download the tool archive from [releases page](https://github.com/me-no-dev/arduino-esp32fs-plugin/releases/latest).
- Download **esp32fs.zip** zipped tool from [latest release](https://github.com/lorol/arduino-esp32fs-plugin/releases)
- In your Arduino sketchbook directory, create tools directory if it doesn't exist yet.
- Unpack the tool into tools directory (the path will look like ```<home_dir>/Arduino/tools/ESP32FS/tool/esp32fs.jar```).
- Make sure you have **mklittlefs[.exe]** and **mkfatfs[.exe]** available at **/tools** folder or in sub-folder there
- For reference, see at [previous releases](https://github.com/lorol/arduino-esp32fs-plugin/releases) for copies of archived binaries in question.
- You can also use provided **package_esp32_index.template.json** to run **get.py** with it and download the missing binary files
- Restart Arduino IDE.

On the OS X create the tools directory in ~/Documents/Arduino/ and unpack the files there

## Usage

- Open a sketch (or create a new one and save it).
- Go to sketch directory (choose Sketch > Show Sketch Folder).
- Create a directory named `data` and any files you want in the file system there.
- Make sure you have selected a board, port, and closed Serial Monitor.
- Select *Tools > ESP32 Sketch Data Upload* menu item. This should start uploading the files into ESP32 flash file system.
- Make sure you have selected a board, port, partition scheme and closed Serial Monitor.
- Select ***Tools > ESP32 Sketch Data Upload*** menu item.
- On drop-down list, select SPIFFS, LittleFS or FatFS you want to make from your /data folder.
- Clicking OK should start uploading the files into ESP32 flash file system.
- Last entry **!Erase Flash!** allows to clean the entire flash if necessary.

When done, IDE status bar will display SPIFFS Image Uploaded message. Might take a few minutes for large file system sizes.
When done, IDE status bar will display the status of Image Uploaded message. Might take a few minutes for large file system sizes.

## Screenshot

![Screenshot](tool.png)

## Quick build on Win:

- Install Java JDK
- Find the path of javac.exe and jar.exe
- Find where files **arduino-core.jar , commons-codec-1.7.jar , pde.jar** of your Arduino IDE installation are located
- Edit **make_win.bat** to match "your" paths for **set PATH=your\java\bin;%PATH%** and **set ALP=your\arduino\lib**
- Run **make_win.bat**
- Find the **jar** file in src/bin directory

## Credits and license

### The Original Arduino ESP32 filesystem uploader

- Copyright (c) 2015 Hristo Gochkov (hristo at espressif dot com)
- Licensed under GPL v2 ([text](LICENSE))
- Maintained by Hristo Gochkov (hristo at espressif dot com)

### Other people, sources and binary files

- https://github.com/earlephilhower
- https://github.com/labplus-cn/mkfatfs
- https://github.com/lbernstone

## Issues and suggestions

File issues here on github, or ask your questions on the [esp32.com forum](http://esp32.com).
12 changes: 12 additions & 0 deletions make_win.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cd %~dp0\src
set PATH=your\java\bin;%PATH%
set ALP=your\arduino\lib
IF EXIST bin GOTO NODIR
mkdir bin
:NODIR
del bin\*.jar
rd /S /Q bin\com
javac.exe -target 1.8 -cp ".;%ALP%\arduino-core.jar;%ALP%\commons-codec-1.7.jar;%ALP%\pde.jar" -d bin ESP32FS.java
cd bin
jar.exe cvfM esp32fs.jar *
pause
969 changes: 589 additions & 380 deletions src/ESP32FS.java

Large diffs are not rendered by default.

Binary file added tool.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.