Skip to content

Commit d4c0f00

Browse files
committed
Release 2.0.1
Added checkup of partition scheme vs. chosen filesystem Typo error fixes and minor changes
1 parent 2c71408 commit d4c0f00

File tree

2 files changed

+43
-32
lines changed

2 files changed

+43
-32
lines changed

Diff for: README.md

+25-16
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,43 @@
11
# Arduino ESP32 filesystem uploader
22

3-
Arduino plugin which packs sketch data folder into SPIFFS, LITTLEFS or FATFS filesystem image,
3+
- Arduino plugin which packs sketch data folder into SPIFFS, LittleFS or FatFS filesystem image,
44
and uploads the image to ESP32 flash memory.
5-
</br> You can have only of three filesystems on given Arduino project.
5+
- You can have only one of three filesystems on same Arduino project.
66

7-
## Notes for LITTLEFS
7+
## Notes for SPIFFS
88

9-
- Uses same partition scheme as SPIFFS.
10-
- See [LITTLEFS esp32 library](https://github.com/lorol/LITTLEFS)
9+
- This is the default filesystem implemented in esp-32 core for /data folder
10+
- Go to Arduino IDE menu: ***Tools > Partition Scheme*** and select an entry with SPIFFS partition
11+
12+
## Notes for LittleFS
13+
14+
- Same partition scheme as SPIFFS
15+
- Until implemented to esp-32 core needs extra library
16+
- See [LITTLEFS esp32 library](https://github.com/lorol/LITTLEFS) for more details
1117

1218
## Notes for FatFS
1319

14-
- On Arduino IDE menu: *Tools > Partition Scheme* select one with FAT partition
15-
- The usable size of FAT partition is reduced with 1 sector of 4096 bytes (0x1000) to resolve wear leveling space requirement. Also file is flashed with +4096 bytes (0x1000) offset of partition address csv table entry
16-
- 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)
20+
- Go to Arduino IDE menu: ***Tools > Partition Scheme*** and select an entry with FAT partition
21+
- 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
1722
- 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)
1823
>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.
1924
```
2025
if (!FFat.begin(0, "", 1)) die("Fat FS mount failed. Not enough RAM?");
2126
```
27+
- 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)
28+
2229

2330
## Installation
2431

2532
- Make sure you use one of the supported versions of Arduino IDE and have ESP32 core installed.
26-
- Download the tool from [here](https://github.com/lorol/arduino-esp32fs-plugin/releases/download/2.0/esp32fs.zip)
33+
- Download **esp32fs.zip** zipped tool from [latest release](https://github.com/lorol/arduino-esp32fs-plugin/releases)
2734
- In your Arduino sketchbook directory, create tools directory if it doesn't exist yet.
2835
- Unpack the tool into tools directory (the path will look like ```<home_dir>/Arduino/tools/ESP32FS/tool/esp32fs.jar```).
29-
- For LITTLEFS, you need an additional [mklittlefs tool](https://github.com/earlephilhower/mklittlefs) Download the [release](https://github.com/earlephilhower/mklittlefs/releases) or see below
30-
- For FatFS, you need additional binary files for Windows and Linux (thanks @lbernstone for compiling) or take it 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)
36+
- For **LittleFS**, you need an additional [mklittlefs tool](https://github.com/earlephilhower/mklittlefs) Download the [release](https://github.com/earlephilhower/mklittlefs/releases) or see below
37+
- For **FatFS**, you need additional binary files for Windows or Linux (thanks @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)
3138
- Copy **mklittlefs[.exe]** and **mkfatfs[.exe]** to **/tools** folder of esp32 platform where **espota** and **esptool** (.py or.exe) tools are located
32-
- Alternatively see [here](https://github.com/lorol/arduino-esp32fs-plugin/releases/tag/2.0) , there are copy of the binaries. You can also use **package_esp32_index.template.json** and run get.py instead
39+
- Alternatively see at [latest release](https://github.com/lorol/arduino-esp32fs-plugin/releases) for copies of archived binaries in question.
40+
- You can also use provided **package_esp32_index.template.json** to run **get.py** with it and download the missing binary files
3341
- Restart Arduino IDE.
3442

3543

@@ -38,9 +46,10 @@ if (!FFat.begin(0, "", 1)) die("Fat FS mount failed. Not enough RAM?");
3846
- Open a sketch (or create a new one and save it).
3947
- Go to sketch directory (choose Sketch > Show Sketch Folder).
4048
- Create a directory named `data` and any files you want in the file system there.
41-
- Make sure you have selected a board, port, and closed Serial Monitor.
42-
- Select *Tools > ESP32 Sketch Data Upload* menu item. This should start uploading the files into ESP32 flash file system.
43-
- On drop-down list select SPIFFS, LITTLEFS or FATFS you want to make from your data folder.
49+
- Make sure you have selected a board, port, partition scheme and closed Serial Monitor.
50+
- Select ***Tools > ESP32 Sketch Data Upload*** menu item.
51+
- On drop-down list, select SPIFFS, LittleFS or FatFS you want to make from your /data folder.
52+
- Clicking OK should start uploading the files into ESP32 flash file system.
4453

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

@@ -53,7 +62,7 @@ if (!FFat.begin(0, "", 1)) die("Fat FS mount failed. Not enough RAM?");
5362
- Run **make_win.bat**
5463
- Find the **build jar** in /bin directory
5564

56-
## Credits and license
65+
## Credits and license (of the original tool)
5766

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

Diff for: src/ESP32FS.java

+18-16
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/*
44
Tool to put the contents of the sketch's "data" subfolder
5-
into an SPIFFS partition image and upload it to an ESP32 MCU
5+
into an SPIFFS, LittleFS or FatFS partition image and upload it to an ESP32 MCU
66
77
Copyright (c) 2015 Hristo Gochkov (hristo at espressif dot com)
88
@@ -66,7 +66,7 @@ public String getMenuTitle() {
6666
return "ESP32 Sketch Data Upload";
6767
}
6868

69-
private String typefs = "SPIFFS";
69+
private String typefs = "";
7070

7171
private int listenOnProcess(String[] arguments){
7272
try {
@@ -168,7 +168,7 @@ private void createAndUpload(){
168168
long spiStart = 0, spiSize = 0, spiPage = 256, spiBlock = 4096, spiOffset = 0;
169169
String partitions = "";
170170

171-
if (typefs == "FATFS") spiOffset = 4096;
171+
if (typefs == "FatFS") spiOffset = 4096;
172172

173173
if(!PreferencesData.get("target_platform").contentEquals("esp32")){
174174
System.err.println();
@@ -193,12 +193,12 @@ private void createAndUpload(){
193193

194194
String mkspiffsCmd;
195195
if(PreferencesData.get("runtime.os").contentEquals("windows"))
196-
if (typefs == "LITTLEFS") mkspiffsCmd = "mklittlefs.exe";
197-
else if (typefs == "FATFS") mkspiffsCmd = "mkfatfs.exe";
196+
if (typefs == "LittleFS") mkspiffsCmd = "mklittlefs.exe";
197+
else if (typefs == "FatFS") mkspiffsCmd = "mkfatfs.exe";
198198
else mkspiffsCmd = "mkspiffs.exe";
199199
else
200-
if (typefs == "LITTLEFS") mkspiffsCmd = "mklittlefs";
201-
else if (typefs == "FATFS") mkspiffsCmd = "mkfatfs";
200+
if (typefs == "LittleFS") mkspiffsCmd = "mklittlefs";
201+
else if (typefs == "FatFS") mkspiffsCmd = "mkfatfs";
202202
else mkspiffsCmd = "mkspiffs";
203203

204204
String espotaCmd = "espota.py";
@@ -238,7 +238,7 @@ private void createAndUpload(){
238238
BufferedReader partitionsReader = new BufferedReader(new FileReader(partitionsFile));
239239
String partitionsLine = "";
240240
while ((partitionsLine = partitionsReader.readLine()) != null) {
241-
if(partitionsLine.contains("spiffs") || partitionsLine.contains("ffat")){
241+
if( ((typefs != "FatFS") && partitionsLine.contains("spiffs")) || ((typefs == "FatFS") && partitionsLine.contains("ffat"))){
242242
partitionsLine = partitionsLine.substring(partitionsLine.indexOf(",")+1);
243243
partitionsLine = partitionsLine.substring(partitionsLine.indexOf(",")+1);
244244
partitionsLine = partitionsLine.substring(partitionsLine.indexOf(",")+1);
@@ -307,7 +307,7 @@ private void createAndUpload(){
307307
esptool = new File(PreferencesData.get("runtime.tools.esptool.path"), esptoolCmd);
308308
if(!esptool.exists() || !esptool.isFile()){
309309
System.err.println();
310-
editor.statusError("SPIFFS Error: esptool not found!");
310+
editor.statusError("Error: esptool not found!");
311311
return;
312312
}
313313
}
@@ -355,11 +355,13 @@ private void createAndUpload(){
355355
System.out.println("[" + typefs + "] offset : "+spiOffset);
356356
System.out.println("[" + typefs + "] start : "+spiStart);
357357
System.out.println("[" + typefs + "] size : "+(spiSize/1024));
358-
System.out.println("[" + typefs + "] page : "+spiPage);
359-
System.out.println("[" + typefs + "] block : "+spiBlock);
358+
if (typefs != "FatFS") {
359+
System.out.println("[" + typefs + "] page : "+spiPage);
360+
System.out.println("[" + typefs + "] block : "+spiBlock);
361+
}
360362

361363
try {
362-
if (typefs == "FATFS") {
364+
if (typefs == "FatFS") {
363365
if(listenOnProcess(new String[]{toolPath, "-c", dataPath, "-s", spiSize+"", imagePath}) != 0){
364366
System.err.println();
365367
editor.statusError(typefs + " Create Failed!");
@@ -407,11 +409,11 @@ private void createAndUpload(){
407409

408410
public void run() {
409411
String sketchName = editor.getSketch().getName();
410-
Object[] options = { "SPIFFS", "LITTLEFS", "FATFS" };
412+
Object[] options = { "SPIFFS", "LittleFS", "FatFS" };
411413
typefs = (String)JOptionPane.showInputDialog(editor,
412-
"What FS you want for " + sketchName +
413-
" data folder?",
414-
"Select",
414+
"Select FS for " + sketchName +
415+
" /data folder",
416+
"Filesystem",
415417
JOptionPane.PLAIN_MESSAGE,
416418
null,
417419
options,

0 commit comments

Comments
 (0)