From 168d02b41499c81ecdc99b75b6d99472ff412a0a Mon Sep 17 00:00:00 2001 From: Me No Dev Date: Tue, 15 Jan 2019 10:48:26 +0800 Subject: [PATCH 01/26] Change tool from esptool to esptool_py --- src/ESP32FS.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ESP32FS.java b/src/ESP32FS.java index eb75aa9..ce165eb 100644 --- a/src/ESP32FS.java +++ b/src/ESP32FS.java @@ -286,9 +286,9 @@ private void createAndUpload(){ String esptoolCmd = "esptool"+toolExtension; esptool = new File(platform.getFolder()+"/tools", esptoolCmd); if(!esptool.exists() || !esptool.isFile()){ - esptool = new File(platform.getFolder()+"/tools/esptool", esptoolCmd); + esptool = new File(platform.getFolder()+"/tools/esptool_py", esptoolCmd); if(!esptool.exists()){ - esptool = new File(PreferencesData.get("runtime.tools.esptool.path"), esptoolCmd); + esptool = new File(PreferencesData.get("runtime.tools.esptool_py.path"), esptoolCmd); if (!esptool.exists()) { System.err.println(); editor.statusError("SPIFFS Error: esptool not found!"); From 7a0de4178b4e9b354c88c7e6150b2e7344024c38 Mon Sep 17 00:00:00 2001 From: lorol Date: Fri, 19 Jun 2020 14:15:46 -0400 Subject: [PATCH 02/26] Added LittleFS choice --- README.md | 9 +++-- src/ESP32FS.java | 90 +++++++++++++++++++++++++++++------------------- 2 files changed, 62 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index ae1f080..f057205 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # Arduino ESP32 filesystem uploader -Arduino plugin which packs sketch data folder into SPIFFS filesystem image, +Arduino plugin which packs sketch data folder into SPIFFS or LittleFS filesystem image, and uploads the image to ESP32 flash memory. +
You can use either LITTLEFS or SPIFFS but not both simultaneously on given Arduino project. ## Installation @@ -9,8 +10,11 @@ and uploads the image to ESP32 flash memory. - Download the tool archive from [releases page](https://github.com/me-no-dev/arduino-esp32fs-plugin/releases/latest). - 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 ```/Arduino/tools/ESP32FS/tool/esp32fs.jar```). +- If not already installed, for LITTLEFS you need an additional [mklittlefs tool](https://github.com/earlephilhower/mklittlefs) Download the [release](https://github.com/earlephilhower/mklittlefs/releases) and copy it to +packages\esp32\tools\mkspiffs\\ or on checkout (dev) environment to: packages\esp32\hardware\esp32\\tools\mklittlefs\ - Restart Arduino IDE. + On the OS X create the tools directory in ~/Documents/Arduino/ and unpack the files there ## Usage @@ -20,8 +24,9 @@ On the OS X create the tools directory in ~/Documents/Arduino/ and unpack the fi - 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. +- When prompted, select SPIFFS or LITTLEFS image you want to make from your data folder. - 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 SPIFFS or LITTLEFS Image Uploaded message. Might take a few minutes for large file system sizes. ## Credits and license diff --git a/src/ESP32FS.java b/src/ESP32FS.java index ce165eb..e6040ab 100644 --- a/src/ESP32FS.java +++ b/src/ESP32FS.java @@ -65,6 +65,8 @@ public void init(Editor editor) { public String getMenuTitle() { return "ESP32 Sketch Data Upload"; } + + private String typefs = "SPIFFS"; private int listenOnProcess(String[] arguments){ try { @@ -99,12 +101,12 @@ private void sysExec(final String[] arguments){ public void run() { try { if(listenOnProcess(arguments) != 0){ - editor.statusError("SPIFFS Upload failed!"); + editor.statusError(typefs + " Upload failed!"); } else { - editor.statusNotice("SPIFFS Image Uploaded"); + editor.statusNotice(typefs + " Image Uploaded"); } } catch (Exception e){ - editor.statusError("SPIFFS Upload failed!"); + editor.statusError(typefs + " Upload failed!"); } } }; @@ -168,7 +170,7 @@ private void createAndUpload(){ if(!PreferencesData.get("target_platform").contentEquals("esp32")){ System.err.println(); - editor.statusError("SPIFFS Not Supported on "+PreferencesData.get("target_platform")); + editor.statusError(typefs + " Not Supported on "+PreferencesData.get("target_platform")); return; } @@ -189,9 +191,11 @@ private void createAndUpload(){ String mkspiffsCmd; if(PreferencesData.get("runtime.os").contentEquals("windows")) - mkspiffsCmd = "mkspiffs.exe"; + if (typefs == "LITTLEFS") mkspiffsCmd = "mklittlefs.exe"; + else mkspiffsCmd = "mkspiffs.exe"; else - mkspiffsCmd = "mkspiffs"; + if (typefs == "LITTLEFS") mkspiffsCmd = "mklittlefs"; + else mkspiffsCmd = "mkspiffs"; String espotaCmd = "espota.py"; if(PreferencesData.get("runtime.os").contentEquals("windows")) @@ -222,7 +226,7 @@ private void createAndUpload(){ File partitionsFile = new File(platform.getFolder() + "/tools/partitions", partitions + ".csv"); if (!partitionsFile.exists() || !partitionsFile.isFile()) { System.err.println(); - editor.statusError("SPIFFS Error: partitions file " + partitions + ".csv not found!"); + editor.statusError(typefs + " Error: partitions file " + partitions + ".csv not found!"); return; } @@ -245,7 +249,7 @@ private void createAndUpload(){ } if(spiSize == 0){ System.err.println(); - editor.statusError("SPIFFS Error: partition size could not be found!"); + editor.statusError(typefs + " Error: partition size could not be found!"); return; } } catch(Exception e){ @@ -255,12 +259,12 @@ private void createAndUpload(){ File tool = new File(platform.getFolder() + "/tools", mkspiffsCmd); if (!tool.exists() || !tool.isFile()) { - tool = new File(platform.getFolder() + "/tools/mkspiffs", mkspiffsCmd); + tool = new File(platform.getFolder() + "/tools/mk" + typefs.toLowerCase(), mkspiffsCmd); if (!tool.exists()) { - tool = new File(PreferencesData.get("runtime.tools.mkspiffs.path"), mkspiffsCmd); + tool = new File(PreferencesData.get("runtime.tools.mk" + typefs.toLowerCase() + ".path"), mkspiffsCmd); if (!tool.exists()) { System.err.println(); - editor.statusError("SPIFFS Error: mkspiffs not found!"); + editor.statusError(typefs + " Error: mk" + typefs.toLowerCase() + "not found!"); return; } } @@ -269,7 +273,7 @@ private void createAndUpload(){ //make sure the serial port or IP is defined if (serialPort == null || serialPort.isEmpty()) { System.err.println(); - editor.statusError("SPIFFS Error: serial port not defined!"); + editor.statusError(typefs + " Error: serial port not defined!"); return; } @@ -279,7 +283,7 @@ private void createAndUpload(){ espota = new File(platform.getFolder()+"/tools", espotaCmd); if(!espota.exists() || !espota.isFile()){ System.err.println(); - editor.statusError("SPIFFS Error: espota not found!"); + editor.statusError(typefs + " Error: espota not found!"); return; } } else { @@ -291,7 +295,7 @@ private void createAndUpload(){ esptool = new File(PreferencesData.get("runtime.tools.esptool_py.path"), esptoolCmd); if (!esptool.exists()) { System.err.println(); - editor.statusError("SPIFFS Error: esptool not found!"); + editor.statusError(typefs + " Error: esptool not found!"); return; } } @@ -316,43 +320,43 @@ private void createAndUpload(){ String dataPath = dataFolder.getAbsolutePath(); String toolPath = tool.getAbsolutePath(); String sketchName = editor.getSketch().getName(); - String imagePath = getBuildFolderPath(editor.getSketch()) + "/" + sketchName + ".spiffs.bin"; + String imagePath = getBuildFolderPath(editor.getSketch()) + "/" + sketchName + "." + typefs.toLowerCase() + ".bin"; String uploadSpeed = BaseNoGui.getBoardPreferences().get("upload.speed"); Object[] options = { "Yes", "No" }; - String title = "SPIFFS Create"; - String message = "No files have been found in your data folder!\nAre you sure you want to create an empty SPIFFS image?"; + String title = typefs + " Create"; + String message = "No files have been found in your data folder!\nAre you sure you want to create an empty " + typefs + " image?"; if(fileCount == 0 && JOptionPane.showOptionDialog(editor, message, title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[1]) != JOptionPane.YES_OPTION){ System.err.println(); - editor.statusError("SPIFFS Warning: mkspiffs canceled!"); + editor.statusError(typefs + " Warning: mkspiffs canceled!"); return; } - editor.statusNotice("SPIFFS Creating Image..."); - System.out.println("[SPIFFS] data : "+dataPath); - System.out.println("[SPIFFS] start : "+spiStart); - System.out.println("[SPIFFS] size : "+(spiSize/1024)); - System.out.println("[SPIFFS] page : "+spiPage); - System.out.println("[SPIFFS] block : "+spiBlock); + editor.statusNotice(typefs + " Creating Image..."); + System.out.println("[" + typefs + "] data : "+dataPath); + System.out.println("[" + typefs + "] start : "+spiStart); + System.out.println("[" + typefs + "] size : "+(spiSize/1024)); + System.out.println("[" + typefs + "] page : "+spiPage); + System.out.println("[" + typefs + "] block : "+spiBlock); try { if(listenOnProcess(new String[]{toolPath, "-c", dataPath, "-p", spiPage+"", "-b", spiBlock+"", "-s", spiSize+"", imagePath}) != 0){ System.err.println(); - editor.statusError("SPIFFS Create Failed!"); + editor.statusError(typefs + " Create Failed!"); return; } } catch (Exception e){ editor.statusError(e); - editor.statusError("SPIFFS Create Failed!"); + editor.statusError(typefs + " Create Failed!"); return; } - editor.statusNotice("SPIFFS Uploading Image..."); - System.out.println("[SPIFFS] upload : "+imagePath); + editor.statusNotice(typefs + " Uploading Image..."); + System.out.println("[" + typefs + "] upload : "+imagePath); if(isNetwork){ - System.out.println("[SPIFFS] IP : "+serialPort); + System.out.println("[" + typefs + "] IP : "+serialPort); System.out.println(); if(espota.getAbsolutePath().endsWith(".py")) sysExec(new String[]{pythonCmd, espota.getAbsolutePath(), "-i", serialPort, "-p", "3232", "-s", "-f", imagePath}); @@ -361,11 +365,11 @@ private void createAndUpload(){ } else { String flashMode = BaseNoGui.getBoardPreferences().get("build.flash_mode"); String flashFreq = BaseNoGui.getBoardPreferences().get("build.flash_freq"); - System.out.println("[SPIFFS] address: "+spiStart); - System.out.println("[SPIFFS] port : "+serialPort); - System.out.println("[SPIFFS] speed : "+uploadSpeed); - System.out.println("[SPIFFS] mode : "+flashMode); - System.out.println("[SPIFFS] freq : "+flashFreq); + System.out.println("[" + typefs + "] address: "+spiStart); + System.out.println("[" + typefs + "] port : "+serialPort); + System.out.println("[" + typefs + "] speed : "+uploadSpeed); + System.out.println("[" + typefs + "] mode : "+flashMode); + System.out.println("[" + typefs + "] freq : "+flashFreq); System.out.println(); if(esptool.getAbsolutePath().endsWith(".py")) sysExec(new String[]{pythonCmd, esptool.getAbsolutePath(), "--chip", "esp32", "--baud", uploadSpeed, "--port", serialPort, "--before", "default_reset", "--after", "hard_reset", "write_flash", "-z", "--flash_mode", flashMode, "--flash_freq", flashFreq, "--flash_size", "detect", ""+spiStart, imagePath}); @@ -375,6 +379,22 @@ private void createAndUpload(){ } public void run() { - createAndUpload(); + String sketchName = editor.getSketch().getName(); + Object[] options = { "LITTLEFS", "SPIFFS", }; + int result = JOptionPane.showOptionDialog(editor, + "What FS you want for " + sketchName + + " data folder?", + "Select", + JOptionPane.YES_NO_OPTION, + JOptionPane.QUESTION_MESSAGE, + null, + options, + options[1]); + if (result == JOptionPane.YES_OPTION) { + typefs = "LITTLEFS"; + } else { + typefs = "SPIFFS"; + } + createAndUpload(); } } From 6a327a5e60109d565f1dc84af20c14a42af529ca Mon Sep 17 00:00:00 2001 From: lorol Date: Mon, 29 Jun 2020 14:59:32 -0400 Subject: [PATCH 03/26] Added message to show found espota, esptool, mklittlefs and mkspiffs binaries path. --- src/ESP32FS.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ESP32FS.java b/src/ESP32FS.java index e6040ab..a7c0b16 100644 --- a/src/ESP32FS.java +++ b/src/ESP32FS.java @@ -269,6 +269,8 @@ private void createAndUpload(){ } } } + System.out.println("mk" + typefs.toLowerCase() + " : " + tool.getAbsolutePath()); + System.out.println(); //make sure the serial port or IP is defined if (serialPort == null || serialPort.isEmpty()) { @@ -286,6 +288,8 @@ private void createAndUpload(){ editor.statusError(typefs + " Error: espota not found!"); return; } + System.out.println("espota : "+espota.getAbsolutePath()); + System.out.println(); } else { String esptoolCmd = "esptool"+toolExtension; esptool = new File(platform.getFolder()+"/tools", esptoolCmd); @@ -300,8 +304,10 @@ private void createAndUpload(){ } } } + System.out.println("esptool : "+esptool.getAbsolutePath()); + System.out.println(); } - + //load a list of all files int fileCount = 0; File dataFolder = new File(editor.getSketch().getFolder(), "data"); @@ -380,7 +386,7 @@ private void createAndUpload(){ public void run() { String sketchName = editor.getSketch().getName(); - Object[] options = { "LITTLEFS", "SPIFFS", }; + Object[] options = { "LittleFS", "SPIFFS", }; int result = JOptionPane.showOptionDialog(editor, "What FS you want for " + sketchName + " data folder?", From 90a1724f54fc1d43943a00eab8c6a76b3fa34929 Mon Sep 17 00:00:00 2001 From: lorol Date: Wed, 8 Jul 2020 22:50:36 -0400 Subject: [PATCH 04/26] Updated README Added zipped jar binary release --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f057205..06a5882 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ and uploads the image to ESP32 flash memory. ## 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 the tool from [here](https://github.com/lorol/arduino-esp32fs-plugin/releases/download/1.0%2C1/esp32fs.zip) - 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 ```/Arduino/tools/ESP32FS/tool/esp32fs.jar```). - If not already installed, for LITTLEFS you need an additional [mklittlefs tool](https://github.com/earlephilhower/mklittlefs) Download the [release](https://github.com/earlephilhower/mklittlefs/releases) and copy it to From 07d7a82e005ef3504752bd7c7b15d301f90e6365 Mon Sep 17 00:00:00 2001 From: lorol Date: Mon, 13 Jul 2020 23:37:23 -0400 Subject: [PATCH 05/26] Added FatFS Added binaries in release section --- README.md | 33 ++++++++++++++----- src/ESP32FS.java | 83 ++++++++++++++++++++++++++++++------------------ 2 files changed, 77 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 06a5882..8ab9b6a 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,39 @@ # Arduino ESP32 filesystem uploader -Arduino plugin which packs sketch data folder into SPIFFS or LittleFS filesystem image, +Arduino plugin which packs sketch data folder into SPIFFS, LITTLEFS or FATFS filesystem image, and uploads the image to ESP32 flash memory. -
You can use either LITTLEFS or SPIFFS but not both simultaneously on given Arduino project. +
You can have only of three filesystems on given Arduino project. + +## Notes for LITTLEFS + +- Uses same partition scheme as SPIFFS. +- See [LITTLEFS esp32 library](https://github.com/lorol/LITTLEFS) + +## Notes for FatFS + +- On Arduino IDE menu: *Tools > Partition Scheme* select one with FAT partition +- The usable size of FAT partition is reduced with 1 sector of 4096 bytes (0x1000) to resolve wear leveling space requirement +- For same reason, the image file is flashed with +4096 bytes (0x1000) offset of partition address csv table entry +- 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) +- 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?"); +``` ## Installation - Make sure you use one of the supported versions of Arduino IDE and have ESP32 core installed. -- Download the tool from [here](https://github.com/lorol/arduino-esp32fs-plugin/releases/download/1.0%2C1/esp32fs.zip) +- Download the tool from [here](https://github.com/lorol/arduino-esp32fs-plugin/releases/download/2.0/esp32fs.zip) - 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 ```/Arduino/tools/ESP32FS/tool/esp32fs.jar```). -- If not already installed, for LITTLEFS you need an additional [mklittlefs tool](https://github.com/earlephilhower/mklittlefs) Download the [release](https://github.com/earlephilhower/mklittlefs/releases) and copy it to -packages\esp32\tools\mkspiffs\\ or on checkout (dev) environment to: packages\esp32\hardware\esp32\\tools\mklittlefs\ +- For LITTLEFS, you need an additional [mklittlefs tool](https://github.com/earlephilhower/mklittlefs) Download the [release](https://github.com/earlephilhower/mklittlefs/releases) +- 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) +- Copy **mklittlefs[.exe]** and **mkfatfs[.exe]** to **/tools** folder of esp32 platform where **espota** and **esptool** (.py or.exe) tools are located +- Alternatively see [here](https://github.com/lorol/arduino-esp32fs-plugin/releases/download/2.0/) , there are copy of the binaries. You can also use **package_esp32_index.template.json** and run get.py instead - 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). @@ -26,7 +43,7 @@ On the OS X create the tools directory in ~/Documents/Arduino/ and unpack the fi - Select *Tools > ESP32 Sketch Data Upload* menu item. This should start uploading the files into ESP32 flash file system. - When prompted, select SPIFFS or LITTLEFS image you want to make from your data folder. - When done, IDE status bar will display SPIFFS or LITTLEFS 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. ## Credits and license diff --git a/src/ESP32FS.java b/src/ESP32FS.java index a7c0b16..c594df4 100644 --- a/src/ESP32FS.java +++ b/src/ESP32FS.java @@ -165,9 +165,11 @@ private long getIntPref(String name){ } private void createAndUpload(){ - long spiStart = 0, spiSize = 0, spiPage = 256, spiBlock = 4096; + long spiStart = 0, spiSize = 0, spiPage = 256, spiBlock = 4096, spiOffset = 0; String partitions = ""; + if (typefs == "FATFS") spiOffset = 4096; + if(!PreferencesData.get("target_platform").contentEquals("esp32")){ System.err.println(); editor.statusError(typefs + " Not Supported on "+PreferencesData.get("target_platform")); @@ -192,10 +194,12 @@ private void createAndUpload(){ String mkspiffsCmd; if(PreferencesData.get("runtime.os").contentEquals("windows")) if (typefs == "LITTLEFS") mkspiffsCmd = "mklittlefs.exe"; - else mkspiffsCmd = "mkspiffs.exe"; + else if (typefs == "FATFS") mkspiffsCmd = "mkfatfs.exe"; + else mkspiffsCmd = "mkspiffs.exe"; else if (typefs == "LITTLEFS") mkspiffsCmd = "mklittlefs"; - else mkspiffsCmd = "mkspiffs"; + else if (typefs == "FATFS") mkspiffsCmd = "mkfatfs"; + else mkspiffsCmd = "mkspiffs"; String espotaCmd = "espota.py"; if(PreferencesData.get("runtime.os").contentEquals("windows")) @@ -234,7 +238,7 @@ private void createAndUpload(){ BufferedReader partitionsReader = new BufferedReader(new FileReader(partitionsFile)); String partitionsLine = ""; while ((partitionsLine = partitionsReader.readLine()) != null) { - if(partitionsLine.contains("spiffs")) { + if(partitionsLine.contains("spiffs") || partitionsLine.contains("ffat")){ partitionsLine = partitionsLine.substring(partitionsLine.indexOf(",")+1); partitionsLine = partitionsLine.substring(partitionsLine.indexOf(",")+1); partitionsLine = partitionsLine.substring(partitionsLine.indexOf(",")+1); @@ -243,8 +247,8 @@ private void createAndUpload(){ partitionsLine = partitionsLine.substring(partitionsLine.indexOf(",")+1); while(partitionsLine.startsWith(" ")) partitionsLine = partitionsLine.substring(1); String pSize = partitionsLine.substring(0, partitionsLine.indexOf(",")); - spiStart = parseInt(pStart); - spiSize = parseInt(pSize); + spiStart = parseInt(pStart) + spiOffset; + spiSize = parseInt(pSize) - spiOffset; } } if(spiSize == 0){ @@ -295,18 +299,25 @@ private void createAndUpload(){ esptool = new File(platform.getFolder()+"/tools", esptoolCmd); if(!esptool.exists() || !esptool.isFile()){ esptool = new File(platform.getFolder()+"/tools/esptool_py", esptoolCmd); - if(!esptool.exists()){ - esptool = new File(PreferencesData.get("runtime.tools.esptool_py.path"), esptoolCmd); - if (!esptool.exists()) { - System.err.println(); - editor.statusError(typefs + " Error: esptool not found!"); - return; - } + if(!esptool.exists() || !esptool.isFile()){ + esptool = new File(platform.getFolder()+"/tools/esptool", esptoolCmd); + if(!esptool.exists() || !esptool.isFile()){ + esptool = new File(PreferencesData.get("runtime.tools.esptool_py.path"), esptoolCmd); + if(!esptool.exists() || !esptool.isFile()){ + esptool = new File(PreferencesData.get("runtime.tools.esptool.path"), esptoolCmd); + if(!esptool.exists() || !esptool.isFile()){ + System.err.println(); + editor.statusError("SPIFFS Error: esptool not found!"); + return; + } + } + } } } - System.out.println("esptool : "+esptool.getAbsolutePath()); - System.out.println(); } + System.out.println("esptool : "+esptool.getAbsolutePath()); + System.out.println(); + //load a list of all files int fileCount = 0; @@ -335,23 +346,33 @@ private void createAndUpload(){ if(fileCount == 0 && JOptionPane.showOptionDialog(editor, message, title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[1]) != JOptionPane.YES_OPTION){ System.err.println(); - editor.statusError(typefs + " Warning: mkspiffs canceled!"); + editor.statusError(typefs + " Warning: mktool canceled!"); return; } editor.statusNotice(typefs + " Creating Image..."); System.out.println("[" + typefs + "] data : "+dataPath); + System.out.println("[" + typefs + "] offset : "+spiOffset); System.out.println("[" + typefs + "] start : "+spiStart); System.out.println("[" + typefs + "] size : "+(spiSize/1024)); System.out.println("[" + typefs + "] page : "+spiPage); System.out.println("[" + typefs + "] block : "+spiBlock); try { - if(listenOnProcess(new String[]{toolPath, "-c", dataPath, "-p", spiPage+"", "-b", spiBlock+"", "-s", spiSize+"", imagePath}) != 0){ - System.err.println(); - editor.statusError(typefs + " Create Failed!"); - return; + if (typefs == "FATFS") { + if(listenOnProcess(new String[]{toolPath, "-c", dataPath, "-s", spiSize+"", imagePath}) != 0){ + System.err.println(); + editor.statusError(typefs + " Create Failed!"); + return; + } + } else { + if(listenOnProcess(new String[]{toolPath, "-c", dataPath, "-p", spiPage+"", "-b", spiBlock+"", "-s", spiSize+"", imagePath}) != 0){ + System.err.println(); + editor.statusError(typefs + " Create Failed!"); + return; + } } + } catch (Exception e){ editor.statusError(e); editor.statusError(typefs + " Create Failed!"); @@ -386,21 +407,21 @@ private void createAndUpload(){ public void run() { String sketchName = editor.getSketch().getName(); - Object[] options = { "LittleFS", "SPIFFS", }; - int result = JOptionPane.showOptionDialog(editor, + Object[] options = { "SPIFFS", "LITTLEFS", "FATFS" }; + typefs = (String)JOptionPane.showInputDialog(editor, "What FS you want for " + sketchName + " data folder?", "Select", - JOptionPane.YES_NO_OPTION, - JOptionPane.QUESTION_MESSAGE, + JOptionPane.PLAIN_MESSAGE, null, options, - options[1]); - if (result == JOptionPane.YES_OPTION) { - typefs = "LITTLEFS"; - } else { - typefs = "SPIFFS"; - } - createAndUpload(); + "SPIFFS"); + if ((typefs != null) && (typefs.length() > 0)) { + createAndUpload(); + } else { + System.out.println("Tool Exit."); + return; + } + } } From f49021554bc5176a247ad1994f966d1b0c04b312 Mon Sep 17 00:00:00 2001 From: lorol Date: Mon, 13 Jul 2020 23:46:04 -0400 Subject: [PATCH 06/26] Fix README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8ab9b6a..eead4c1 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ if (!FFat.begin(0, "", 1)) die("Fat FS mount failed. Not enough RAM?"); - For LITTLEFS, you need an additional [mklittlefs tool](https://github.com/earlephilhower/mklittlefs) Download the [release](https://github.com/earlephilhower/mklittlefs/releases) - 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) - Copy **mklittlefs[.exe]** and **mkfatfs[.exe]** to **/tools** folder of esp32 platform where **espota** and **esptool** (.py or.exe) tools are located -- Alternatively see [here](https://github.com/lorol/arduino-esp32fs-plugin/releases/download/2.0/) , there are copy of the binaries. You can also use **package_esp32_index.template.json** and run get.py instead +- 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 - Restart Arduino IDE. From 2c71408d023c3346d62241ffc8c1e80b08ea0989 Mon Sep 17 00:00:00 2001 From: lorol Date: Tue, 14 Jul 2020 07:26:54 -0400 Subject: [PATCH 07/26] Added batch for Windows quick build --- README.md | 16 ++++++++++++---- src/bin/placeholder | 0 src/make_win.bat | 5 +++++ 3 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 src/bin/placeholder create mode 100644 src/make_win.bat diff --git a/README.md b/README.md index eead4c1..5941407 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,7 @@ and uploads the image to ESP32 flash memory. ## Notes for FatFS - On Arduino IDE menu: *Tools > Partition Scheme* select one with FAT partition -- The usable size of FAT partition is reduced with 1 sector of 4096 bytes (0x1000) to resolve wear leveling space requirement -- For same reason, the image file is flashed with +4096 bytes (0x1000) offset of partition address csv table entry +- 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 - 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) - 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. @@ -27,7 +26,7 @@ if (!FFat.begin(0, "", 1)) die("Fat FS mount failed. Not enough RAM?"); - Download the tool from [here](https://github.com/lorol/arduino-esp32fs-plugin/releases/download/2.0/esp32fs.zip) - 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 ```/Arduino/tools/ESP32FS/tool/esp32fs.jar```). -- For LITTLEFS, you need an additional [mklittlefs tool](https://github.com/earlephilhower/mklittlefs) Download the [release](https://github.com/earlephilhower/mklittlefs/releases) +- 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 - 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) - Copy **mklittlefs[.exe]** and **mkfatfs[.exe]** to **/tools** folder of esp32 platform where **espota** and **esptool** (.py or.exe) tools are located - 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 @@ -41,10 +40,19 @@ if (!FFat.begin(0, "", 1)) die("Fat FS mount failed. Not enough RAM?"); - 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. -- When prompted, select SPIFFS or LITTLEFS image you want to make from your data folder. +- On drop-down list select SPIFFS, LITTLEFS or FATFS you want to make from your data folder. When done, IDE status bar will display the status of Image Uploaded message. Might take a few minutes for large file system sizes. +## Quick build on Win: + +- Install Java JDK +- Find the path of javac.exe and jar.exe +- Edit make_win.bat accordingly +- Copy files **arduino-core.jar , commons-codec-1.7.jar , pde.jar** from your Arduino IDE installation to the folder where is located **make_win.bat** +- Run **make_win.bat** +- Find the **build jar** in /bin directory + ## Credits and license - Copyright (c) 2015 Hristo Gochkov (hristo at espressif dot com) diff --git a/src/bin/placeholder b/src/bin/placeholder new file mode 100644 index 0000000..e69de29 diff --git a/src/make_win.bat b/src/make_win.bat new file mode 100644 index 0000000..cdddbeb --- /dev/null +++ b/src/make_win.bat @@ -0,0 +1,5 @@ +del bin\*.* +"C:\Program Files (x86)\Java\jdk1.8.0_152\bin\javac.exe" -target 1.8 -cp ".;arduino-core.jar;commons-codec-1.7.jar;pde.jar" -d bin ESP32FS.java +cd bin +"C:\Program Files (x86)\Java\jdk1.8.0_152\bin\jar.exe" cvfM esp32fs.jar * +pause From d4c0f00ab0a36ecf8f4a3444532a6c607bdef767 Mon Sep 17 00:00:00 2001 From: lorol Date: Tue, 14 Jul 2020 14:52:49 -0400 Subject: [PATCH 08/26] Release 2.0.1 Added checkup of partition scheme vs. chosen filesystem Typo error fixes and minor changes --- README.md | 41 +++++++++++++++++++++++++---------------- src/ESP32FS.java | 34 ++++++++++++++++++---------------- 2 files changed, 43 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 5941407..1c1ab3f 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,43 @@ # Arduino ESP32 filesystem uploader -Arduino plugin which packs sketch data folder into SPIFFS, LITTLEFS or FATFS filesystem image, +- Arduino plugin which packs sketch data folder into SPIFFS, LittleFS or FatFS filesystem image, and uploads the image to ESP32 flash memory. -
You can have only of three filesystems on given Arduino project. +- You can have only one of three filesystems on same Arduino project. -## Notes for LITTLEFS +## Notes for SPIFFS -- Uses same partition scheme as SPIFFS. -- See [LITTLEFS esp32 library](https://github.com/lorol/LITTLEFS) +- 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 implemented to esp-32 core needs extra library +- See [LITTLEFS esp32 library](https://github.com/lorol/LITTLEFS) for more details ## Notes for FatFS -- On Arduino IDE menu: *Tools > Partition Scheme* select one with FAT partition -- 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 -- 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) +- Go to Arduino IDE menu: ***Tools > Partition Scheme*** and select an entry with FAT partition +- 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 from [here](https://github.com/lorol/arduino-esp32fs-plugin/releases/download/2.0/esp32fs.zip) +- 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 ```/Arduino/tools/ESP32FS/tool/esp32fs.jar```). -- 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 -- 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) +- 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 +- 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) - Copy **mklittlefs[.exe]** and **mkfatfs[.exe]** to **/tools** folder of esp32 platform where **espota** and **esptool** (.py or.exe) tools are located -- 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 +- Alternatively see at [latest release](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. @@ -38,9 +46,10 @@ if (!FFat.begin(0, "", 1)) die("Fat FS mount failed. Not enough RAM?"); - 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. -- On drop-down list select SPIFFS, LITTLEFS or FATFS you want to make from your data folder. +- 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. When done, IDE status bar will display the status of Image Uploaded message. Might take a few minutes for large file system sizes. @@ -53,7 +62,7 @@ if (!FFat.begin(0, "", 1)) die("Fat FS mount failed. Not enough RAM?"); - Run **make_win.bat** - Find the **build jar** in /bin directory -## Credits and license +## Credits and license (of the original tool) - Copyright (c) 2015 Hristo Gochkov (hristo at espressif dot com) - Licensed under GPL v2 ([text](LICENSE)) diff --git a/src/ESP32FS.java b/src/ESP32FS.java index c594df4..1e43d4e 100644 --- a/src/ESP32FS.java +++ b/src/ESP32FS.java @@ -2,7 +2,7 @@ /* Tool to put the contents of the sketch's "data" subfolder - into an SPIFFS partition image and upload it to an ESP32 MCU + into an SPIFFS, LittleFS or FatFS partition image and upload it to an ESP32 MCU Copyright (c) 2015 Hristo Gochkov (hristo at espressif dot com) @@ -66,7 +66,7 @@ public String getMenuTitle() { return "ESP32 Sketch Data Upload"; } - private String typefs = "SPIFFS"; + private String typefs = ""; private int listenOnProcess(String[] arguments){ try { @@ -168,7 +168,7 @@ private void createAndUpload(){ long spiStart = 0, spiSize = 0, spiPage = 256, spiBlock = 4096, spiOffset = 0; String partitions = ""; - if (typefs == "FATFS") spiOffset = 4096; + if (typefs == "FatFS") spiOffset = 4096; if(!PreferencesData.get("target_platform").contentEquals("esp32")){ System.err.println(); @@ -193,12 +193,12 @@ private void createAndUpload(){ String mkspiffsCmd; if(PreferencesData.get("runtime.os").contentEquals("windows")) - if (typefs == "LITTLEFS") mkspiffsCmd = "mklittlefs.exe"; - else if (typefs == "FATFS") mkspiffsCmd = "mkfatfs.exe"; + if (typefs == "LittleFS") mkspiffsCmd = "mklittlefs.exe"; + else if (typefs == "FatFS") mkspiffsCmd = "mkfatfs.exe"; else mkspiffsCmd = "mkspiffs.exe"; else - if (typefs == "LITTLEFS") mkspiffsCmd = "mklittlefs"; - else if (typefs == "FATFS") mkspiffsCmd = "mkfatfs"; + if (typefs == "LittleFS") mkspiffsCmd = "mklittlefs"; + else if (typefs == "FatFS") mkspiffsCmd = "mkfatfs"; else mkspiffsCmd = "mkspiffs"; String espotaCmd = "espota.py"; @@ -238,7 +238,7 @@ private void createAndUpload(){ BufferedReader partitionsReader = new BufferedReader(new FileReader(partitionsFile)); String partitionsLine = ""; while ((partitionsLine = partitionsReader.readLine()) != null) { - if(partitionsLine.contains("spiffs") || partitionsLine.contains("ffat")){ + if( ((typefs != "FatFS") && partitionsLine.contains("spiffs")) || ((typefs == "FatFS") && partitionsLine.contains("ffat"))){ partitionsLine = partitionsLine.substring(partitionsLine.indexOf(",")+1); partitionsLine = partitionsLine.substring(partitionsLine.indexOf(",")+1); partitionsLine = partitionsLine.substring(partitionsLine.indexOf(",")+1); @@ -307,7 +307,7 @@ private void createAndUpload(){ esptool = new File(PreferencesData.get("runtime.tools.esptool.path"), esptoolCmd); if(!esptool.exists() || !esptool.isFile()){ System.err.println(); - editor.statusError("SPIFFS Error: esptool not found!"); + editor.statusError("Error: esptool not found!"); return; } } @@ -355,11 +355,13 @@ private void createAndUpload(){ System.out.println("[" + typefs + "] offset : "+spiOffset); System.out.println("[" + typefs + "] start : "+spiStart); System.out.println("[" + typefs + "] size : "+(spiSize/1024)); - System.out.println("[" + typefs + "] page : "+spiPage); - System.out.println("[" + typefs + "] block : "+spiBlock); + if (typefs != "FatFS") { + System.out.println("[" + typefs + "] page : "+spiPage); + System.out.println("[" + typefs + "] block : "+spiBlock); + } try { - if (typefs == "FATFS") { + if (typefs == "FatFS") { if(listenOnProcess(new String[]{toolPath, "-c", dataPath, "-s", spiSize+"", imagePath}) != 0){ System.err.println(); editor.statusError(typefs + " Create Failed!"); @@ -407,11 +409,11 @@ private void createAndUpload(){ public void run() { String sketchName = editor.getSketch().getName(); - Object[] options = { "SPIFFS", "LITTLEFS", "FATFS" }; + Object[] options = { "SPIFFS", "LittleFS", "FatFS" }; typefs = (String)JOptionPane.showInputDialog(editor, - "What FS you want for " + sketchName + - " data folder?", - "Select", + "Select FS for " + sketchName + + " /data folder", + "Filesystem", JOptionPane.PLAIN_MESSAGE, null, options, From 97143d059bd555af8c31ae3a7cb1abe28461c8d7 Mon Sep 17 00:00:00 2001 From: lorol Date: Wed, 15 Jul 2020 11:10:14 -0400 Subject: [PATCH 09/26] Updated README.md --- README.md | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1c1ab3f..f5788b8 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ if (!FFat.begin(0, "", 1)) die("Fat FS mount failed. Not enough RAM?"); - 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 ```/Arduino/tools/ESP32FS/tool/esp32fs.jar```). - 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 -- 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) +- For **FatFS**, you 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) - Copy **mklittlefs[.exe]** and **mkfatfs[.exe]** to **/tools** folder of esp32 platform where **espota** and **esptool** (.py or.exe) tools are located - Alternatively see at [latest release](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 @@ -52,22 +52,34 @@ if (!FFat.begin(0, "", 1)) die("Fat FS mount failed. Not enough RAM?"); - Clicking OK should start uploading the files into ESP32 flash file system. 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 -- Edit make_win.bat accordingly +- Edit **make_win.bat** accordingly - Copy files **arduino-core.jar , commons-codec-1.7.jar , pde.jar** from your Arduino IDE installation to the folder where is located **make_win.bat** - Run **make_win.bat** -- Find the **build jar** in /bin directory +- Find the **jar** file in /bin directory + +## Credits and license -## Credits and license (of the original tool) +### 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). From b51ef0733ff71db4cc6c9770433b44947ae79f52 Mon Sep 17 00:00:00 2001 From: lorol Date: Fri, 17 Jul 2020 08:02:17 -0400 Subject: [PATCH 10/26] Updated README.md and added a snapshot --- README.md | 13 +++++++------ tool.png | Bin 0 -> 21979 bytes 2 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 tool.png diff --git a/README.md b/README.md index f5788b8..2288698 100644 --- a/README.md +++ b/README.md @@ -9,15 +9,20 @@ and uploads the image to ESP32 flash memory. - 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 implemented to esp-32 core needs extra library - See [LITTLEFS esp32 library](https://github.com/lorol/LITTLEFS) for more details +- You need an additional [mklittlefs tool](https://github.com/earlephilhower/mklittlefs) . Download the [release](https://github.com/earlephilhower/mklittlefs/releases) or find it [archived at latest release 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 +- You 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 at latest release here](https://github.com/lorol/arduino-esp32fs-plugin/releases ) +- 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. @@ -26,21 +31,17 @@ 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 **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 ```/Arduino/tools/ESP32FS/tool/esp32fs.jar```). -- 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 -- For **FatFS**, you 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) -- Copy **mklittlefs[.exe]** and **mkfatfs[.exe]** to **/tools** folder of esp32 platform where **espota** and **esptool** (.py or.exe) tools are located -- Alternatively see at [latest release](https://github.com/lorol/arduino-esp32fs-plugin/releases) for copies of archived binaries in question. +- Make sure you have **mklittlefs[.exe]** and **mkfatfs[.exe]** available at **/tools** folder or in sub-folder there +- See at [latest release](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. - ## Usage - Open a sketch (or create a new one and save it). diff --git a/tool.png b/tool.png new file mode 100644 index 0000000000000000000000000000000000000000..0b2efe2ef74bc5578eaa2a82d4cb27b6008b078c GIT binary patch literal 21979 zcmbTdby$?`w>C@(sHBKUj)H(vLnAe$pmcXgcXtf}N{5mH0@5&)bPfa34bnMuN;5Pw z@9;do{qDWL_rLFtIXLEK?wRXe*NStk^SmNdlw=7XQ9Z)Iz##naURn(U0~3jUf$(wB zSM0-FzoGwNx~a)ZVw4Zl?4aM^SV<^KU|>|nJ-#)0fPVkb`Ms_i1_n{*{R=aRm53Sx zL(}<#w1kGY(f%T#KlNk=@HU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 -0400 Subject: [PATCH 11/26] Change first choice (default) of drop-down to LittleFS --- src/ESP32FS.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ESP32FS.java b/src/ESP32FS.java index 1e43d4e..34d45e7 100644 --- a/src/ESP32FS.java +++ b/src/ESP32FS.java @@ -409,7 +409,7 @@ private void createAndUpload(){ public void run() { String sketchName = editor.getSketch().getName(); - Object[] options = { "SPIFFS", "LittleFS", "FatFS" }; + Object[] options = { "LittleFS", "SPIFFS", "FatFS" }; typefs = (String)JOptionPane.showInputDialog(editor, "Select FS for " + sketchName + " /data folder", @@ -417,7 +417,7 @@ public void run() { JOptionPane.PLAIN_MESSAGE, null, options, - "SPIFFS"); + "LittleFS"); if ((typefs != null) && (typefs.length() > 0)) { createAndUpload(); } else { From 9efcdb7239d63a1c658a507b1d9fe93c079341e1 Mon Sep 17 00:00:00 2001 From: lorol Date: Fri, 9 Oct 2020 19:16:20 +0300 Subject: [PATCH 12/26] Added a choice to "Erase All Flash" at the end of FS type selections Updated assets --- README.md | 3 +- src/ESP32FS.java | 97 +++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 97 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2288698..e794a15 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # Arduino ESP32 filesystem uploader - Arduino plugin which packs sketch data folder into SPIFFS, LittleFS or FatFS filesystem image, -and uploads the image to ESP32 flash memory. +and uploads the image to ESP32 flash memory. +- Added a choice to "Erase all flash" - You can have only one of three filesystems on same Arduino project. ## Notes for SPIFFS diff --git a/src/ESP32FS.java b/src/ESP32FS.java index 34d45e7..1a19e3d 100644 --- a/src/ESP32FS.java +++ b/src/ESP32FS.java @@ -407,9 +407,98 @@ private void createAndUpload(){ } } + + private void eraseFlash(){ + + if(!PreferencesData.get("target_platform").contentEquals("esp32")){ + System.err.println(); + editor.statusError(typefs + " Not Supported on "+PreferencesData.get("target_platform")); + return; + } + + TargetPlatform platform = BaseNoGui.getTargetPlatform(); + + String toolExtension = ".py"; + if(PreferencesData.get("runtime.os").contentEquals("windows")) { + toolExtension = ".exe"; + } else if(PreferencesData.get("runtime.os").contentEquals("macosx")) { + toolExtension = ""; + } + + String pythonCmd; + if(PreferencesData.get("runtime.os").contentEquals("windows")) + pythonCmd = "python.exe"; + else + pythonCmd = "python"; + + Boolean isNetwork = false; + + File esptool = new File(platform.getFolder()+"/tools"); + String serialPort = PreferencesData.get("serial.port"); + + //make sure the serial port or IP is defined + if (serialPort == null || serialPort.isEmpty()) { + System.err.println(); + editor.statusError(typefs + " Error: serial port not defined!"); + return; + } + + //find port + if(serialPort.split("\\.").length == 4){ + isNetwork = true; + } else { + String esptoolCmd = "esptool"+toolExtension; + esptool = new File(platform.getFolder()+"/tools", esptoolCmd); + if(!esptool.exists() || !esptool.isFile()){ + esptool = new File(platform.getFolder()+"/tools/esptool_py", esptoolCmd); + if(!esptool.exists() || !esptool.isFile()){ + esptool = new File(platform.getFolder()+"/tools/esptool", esptoolCmd); + if(!esptool.exists() || !esptool.isFile()){ + esptool = new File(PreferencesData.get("runtime.tools.esptool_py.path"), esptoolCmd); + if(!esptool.exists() || !esptool.isFile()){ + esptool = new File(PreferencesData.get("runtime.tools.esptool.path"), esptoolCmd); + if(!esptool.exists() || !esptool.isFile()){ + System.err.println(); + editor.statusError("Error: esptool not found!"); + return; + } + } + } + } + } + } + System.out.println("esptool : "+esptool.getAbsolutePath()); + System.out.println(); + + Object[] options = { "Yes", "No" }; + String title = "Erase All Flash"; + String message = "Are you sure?"; + + if(JOptionPane.showOptionDialog(editor, message, title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[1]) != JOptionPane.YES_OPTION){ + System.err.println(); + editor.statusError("Warning: Erase All Flash canceled!"); + return; + } + + editor.statusNotice("Erasing all Flash started..."); + System.out.println("Erasing all Flash started..."); + + if(isNetwork){ + System.out.println("Cannot be done through OTA, IP : "+serialPort); + System.out.println(); + } else { + System.out.println("Port: "+serialPort); + System.out.println(); + if(esptool.getAbsolutePath().endsWith(".py")) + sysExec(new String[]{pythonCmd, esptool.getAbsolutePath(), "--chip", "esp32", "--port", serialPort, "--before", "default_reset", "--after", "hard_reset", "erase_flash"}); + else + sysExec(new String[]{esptool.getAbsolutePath(), "--chip", "esp32", "--port", serialPort, "--before", "default_reset", "--after", "hard_reset", "erase_flash"}); + } + } + public void run() { String sketchName = editor.getSketch().getName(); - Object[] options = { "LittleFS", "SPIFFS", "FatFS" }; + Object[] options = { "LittleFS", "SPIFFS", "FatFS", "!Erase Flash!" }; typefs = (String)JOptionPane.showInputDialog(editor, "Select FS for " + sketchName + " /data folder", @@ -419,7 +508,11 @@ public void run() { options, "LittleFS"); if ((typefs != null) && (typefs.length() > 0)) { - createAndUpload(); + if (typefs == "!Erase Flash!") { + eraseFlash(); + } else { + createAndUpload(); + } } else { System.out.println("Tool Exit."); return; From aaa533576c1a227f6c50342565f89d72732fed69 Mon Sep 17 00:00:00 2001 From: stephane Date: Fri, 23 Oct 2020 13:25:40 +0200 Subject: [PATCH 13/26] add support to esp32s2 --- src/ESP32FS.java | 260 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 208 insertions(+), 52 deletions(-) diff --git a/src/ESP32FS.java b/src/ESP32FS.java index ce165eb..9108146 100644 --- a/src/ESP32FS.java +++ b/src/ESP32FS.java @@ -2,7 +2,7 @@ /* Tool to put the contents of the sketch's "data" subfolder - into an SPIFFS partition image and upload it to an ESP32 MCU + into an SPIFFS, LittleFS or FatFS partition image and upload it to an ESP32 MCU Copyright (c) 2015 Hristo Gochkov (hristo at espressif dot com) @@ -65,6 +65,8 @@ public void init(Editor editor) { public String getMenuTitle() { return "ESP32 Sketch Data Upload"; } + + private String typefs = ""; private int listenOnProcess(String[] arguments){ try { @@ -99,12 +101,12 @@ private void sysExec(final String[] arguments){ public void run() { try { if(listenOnProcess(arguments) != 0){ - editor.statusError("SPIFFS Upload failed!"); + editor.statusError(typefs + " Upload failed!"); } else { - editor.statusNotice("SPIFFS Image Uploaded"); + editor.statusNotice(typefs + " Image Uploaded"); } } catch (Exception e){ - editor.statusError("SPIFFS Upload failed!"); + editor.statusError(typefs + " Upload failed!"); } } }; @@ -163,12 +165,14 @@ private long getIntPref(String name){ } private void createAndUpload(){ - long spiStart = 0, spiSize = 0, spiPage = 256, spiBlock = 4096; + long spiStart = 0, spiSize = 0, spiPage = 256, spiBlock = 4096, spiOffset = 0; String partitions = ""; + if (typefs == "FatFS") spiOffset = 4096; + if(!PreferencesData.get("target_platform").contentEquals("esp32")){ System.err.println(); - editor.statusError("SPIFFS Not Supported on "+PreferencesData.get("target_platform")); + editor.statusError(typefs + " Not Supported on "+PreferencesData.get("target_platform")); return; } @@ -189,9 +193,13 @@ private void createAndUpload(){ String mkspiffsCmd; if(PreferencesData.get("runtime.os").contentEquals("windows")) - mkspiffsCmd = "mkspiffs.exe"; + if (typefs == "LittleFS") mkspiffsCmd = "mklittlefs.exe"; + else if (typefs == "FatFS") mkspiffsCmd = "mkfatfs.exe"; + else mkspiffsCmd = "mkspiffs.exe"; else - mkspiffsCmd = "mkspiffs"; + if (typefs == "LittleFS") mkspiffsCmd = "mklittlefs"; + else if (typefs == "FatFS") mkspiffsCmd = "mkfatfs"; + else mkspiffsCmd = "mkspiffs"; String espotaCmd = "espota.py"; if(PreferencesData.get("runtime.os").contentEquals("windows")) @@ -222,7 +230,7 @@ private void createAndUpload(){ File partitionsFile = new File(platform.getFolder() + "/tools/partitions", partitions + ".csv"); if (!partitionsFile.exists() || !partitionsFile.isFile()) { System.err.println(); - editor.statusError("SPIFFS Error: partitions file " + partitions + ".csv not found!"); + editor.statusError(typefs + " Error: partitions file " + partitions + ".csv not found!"); return; } @@ -230,7 +238,7 @@ private void createAndUpload(){ BufferedReader partitionsReader = new BufferedReader(new FileReader(partitionsFile)); String partitionsLine = ""; while ((partitionsLine = partitionsReader.readLine()) != null) { - if(partitionsLine.contains("spiffs")) { + if( ((typefs != "FatFS") && partitionsLine.contains("spiffs")) || ((typefs == "FatFS") && partitionsLine.contains("ffat"))){ partitionsLine = partitionsLine.substring(partitionsLine.indexOf(",")+1); partitionsLine = partitionsLine.substring(partitionsLine.indexOf(",")+1); partitionsLine = partitionsLine.substring(partitionsLine.indexOf(",")+1); @@ -239,13 +247,13 @@ private void createAndUpload(){ partitionsLine = partitionsLine.substring(partitionsLine.indexOf(",")+1); while(partitionsLine.startsWith(" ")) partitionsLine = partitionsLine.substring(1); String pSize = partitionsLine.substring(0, partitionsLine.indexOf(",")); - spiStart = parseInt(pStart); - spiSize = parseInt(pSize); + spiStart = parseInt(pStart) + spiOffset; + spiSize = parseInt(pSize) - spiOffset; } } if(spiSize == 0){ System.err.println(); - editor.statusError("SPIFFS Error: partition size could not be found!"); + editor.statusError(typefs + " Error: partition size could not be found!"); return; } } catch(Exception e){ @@ -255,21 +263,23 @@ private void createAndUpload(){ File tool = new File(platform.getFolder() + "/tools", mkspiffsCmd); if (!tool.exists() || !tool.isFile()) { - tool = new File(platform.getFolder() + "/tools/mkspiffs", mkspiffsCmd); + tool = new File(platform.getFolder() + "/tools/mk" + typefs.toLowerCase(), mkspiffsCmd); if (!tool.exists()) { - tool = new File(PreferencesData.get("runtime.tools.mkspiffs.path"), mkspiffsCmd); + tool = new File(PreferencesData.get("runtime.tools.mk" + typefs.toLowerCase() + ".path"), mkspiffsCmd); if (!tool.exists()) { System.err.println(); - editor.statusError("SPIFFS Error: mkspiffs not found!"); + editor.statusError(typefs + " Error: mk" + typefs.toLowerCase() + "not found!"); return; } } } + System.out.println("mk" + typefs.toLowerCase() + " : " + tool.getAbsolutePath()); + System.out.println(); //make sure the serial port or IP is defined if (serialPort == null || serialPort.isEmpty()) { System.err.println(); - editor.statusError("SPIFFS Error: serial port not defined!"); + editor.statusError(typefs + " Error: serial port not defined!"); return; } @@ -279,25 +289,36 @@ private void createAndUpload(){ espota = new File(platform.getFolder()+"/tools", espotaCmd); if(!espota.exists() || !espota.isFile()){ System.err.println(); - editor.statusError("SPIFFS Error: espota not found!"); + editor.statusError(typefs + " Error: espota not found!"); return; } + System.out.println("espota : "+espota.getAbsolutePath()); + System.out.println(); } else { String esptoolCmd = "esptool"+toolExtension; esptool = new File(platform.getFolder()+"/tools", esptoolCmd); if(!esptool.exists() || !esptool.isFile()){ esptool = new File(platform.getFolder()+"/tools/esptool_py", esptoolCmd); - if(!esptool.exists()){ - esptool = new File(PreferencesData.get("runtime.tools.esptool_py.path"), esptoolCmd); - if (!esptool.exists()) { - System.err.println(); - editor.statusError("SPIFFS Error: esptool not found!"); - return; - } + if(!esptool.exists() || !esptool.isFile()){ + esptool = new File(platform.getFolder()+"/tools/esptool", esptoolCmd); + if(!esptool.exists() || !esptool.isFile()){ + esptool = new File(PreferencesData.get("runtime.tools.esptool_py.path"), esptoolCmd); + if(!esptool.exists() || !esptool.isFile()){ + esptool = new File(PreferencesData.get("runtime.tools.esptool.path"), esptoolCmd); + if(!esptool.exists() || !esptool.isFile()){ + System.err.println(); + editor.statusError("Error: esptool not found!"); + return; + } + } + } } } } - + System.out.println("esptool : "+esptool.getAbsolutePath()); + System.out.println(); + + //load a list of all files int fileCount = 0; File dataFolder = new File(editor.getSketch().getFolder(), "data"); @@ -316,43 +337,55 @@ private void createAndUpload(){ String dataPath = dataFolder.getAbsolutePath(); String toolPath = tool.getAbsolutePath(); String sketchName = editor.getSketch().getName(); - String imagePath = getBuildFolderPath(editor.getSketch()) + "/" + sketchName + ".spiffs.bin"; + String imagePath = getBuildFolderPath(editor.getSketch()) + "/" + sketchName + "." + typefs.toLowerCase() + ".bin"; String uploadSpeed = BaseNoGui.getBoardPreferences().get("upload.speed"); Object[] options = { "Yes", "No" }; - String title = "SPIFFS Create"; - String message = "No files have been found in your data folder!\nAre you sure you want to create an empty SPIFFS image?"; + String title = typefs + " Create"; + String message = "No files have been found in your data folder!\nAre you sure you want to create an empty " + typefs + " image?"; if(fileCount == 0 && JOptionPane.showOptionDialog(editor, message, title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[1]) != JOptionPane.YES_OPTION){ System.err.println(); - editor.statusError("SPIFFS Warning: mkspiffs canceled!"); + editor.statusError(typefs + " Warning: mktool canceled!"); return; } - editor.statusNotice("SPIFFS Creating Image..."); - System.out.println("[SPIFFS] data : "+dataPath); - System.out.println("[SPIFFS] start : "+spiStart); - System.out.println("[SPIFFS] size : "+(spiSize/1024)); - System.out.println("[SPIFFS] page : "+spiPage); - System.out.println("[SPIFFS] block : "+spiBlock); + editor.statusNotice(typefs + " Creating Image..."); + System.out.println("[" + typefs + "] data : "+dataPath); + System.out.println("[" + typefs + "] offset : "+spiOffset); + System.out.println("[" + typefs + "] start : "+spiStart); + System.out.println("[" + typefs + "] size : "+(spiSize/1024)); + if (typefs != "FatFS") { + System.out.println("[" + typefs + "] page : "+spiPage); + System.out.println("[" + typefs + "] block : "+spiBlock); + } try { - if(listenOnProcess(new String[]{toolPath, "-c", dataPath, "-p", spiPage+"", "-b", spiBlock+"", "-s", spiSize+"", imagePath}) != 0){ - System.err.println(); - editor.statusError("SPIFFS Create Failed!"); - return; + if (typefs == "FatFS") { + if(listenOnProcess(new String[]{toolPath, "-c", dataPath, "-s", spiSize+"", imagePath}) != 0){ + System.err.println(); + editor.statusError(typefs + " Create Failed!"); + return; + } + } else { + if(listenOnProcess(new String[]{toolPath, "-c", dataPath, "-p", spiPage+"", "-b", spiBlock+"", "-s", spiSize+"", imagePath}) != 0){ + System.err.println(); + editor.statusError(typefs + " Create Failed!"); + return; + } } + } catch (Exception e){ editor.statusError(e); - editor.statusError("SPIFFS Create Failed!"); + editor.statusError(typefs + " Create Failed!"); return; } - editor.statusNotice("SPIFFS Uploading Image..."); - System.out.println("[SPIFFS] upload : "+imagePath); + editor.statusNotice(typefs + " Uploading Image..."); + System.out.println("[" + typefs + "] upload : "+imagePath); if(isNetwork){ - System.out.println("[SPIFFS] IP : "+serialPort); + System.out.println("[" + typefs + "] IP : "+serialPort); System.out.println(); if(espota.getAbsolutePath().endsWith(".py")) sysExec(new String[]{pythonCmd, espota.getAbsolutePath(), "-i", serialPort, "-p", "3232", "-s", "-f", imagePath}); @@ -361,20 +394,143 @@ private void createAndUpload(){ } else { String flashMode = BaseNoGui.getBoardPreferences().get("build.flash_mode"); String flashFreq = BaseNoGui.getBoardPreferences().get("build.flash_freq"); - System.out.println("[SPIFFS] address: "+spiStart); - System.out.println("[SPIFFS] port : "+serialPort); - System.out.println("[SPIFFS] speed : "+uploadSpeed); - System.out.println("[SPIFFS] mode : "+flashMode); - System.out.println("[SPIFFS] freq : "+flashFreq); + System.out.println("[" + typefs + "] address: "+spiStart); + System.out.println("[" + typefs + "] port : "+serialPort); + System.out.println("[" + typefs + "] speed : "+uploadSpeed); + System.out.println("[" + typefs + "] mode : "+flashMode); + System.out.println("[" + typefs + "] freq : "+flashFreq); + System.out.println(); + + if(esptool.getAbsolutePath().endsWith(".py")) + sysExec(new String[]{pythonCmd, esptool.getAbsolutePath(), "--chip", getChip(), "--baud", uploadSpeed, "--port", serialPort, "--before", "default_reset", "--after", "hard_reset", "write_flash", "-z", "--flash_mode", flashMode, "--flash_freq", flashFreq, "--flash_size", "detect", ""+spiStart, imagePath}); + else + sysExec(new String[]{esptool.getAbsolutePath(), "--chip", getChip(), "--baud", uploadSpeed, "--port", serialPort, "--before", "default_reset", "--after", "hard_reset", "write_flash", "-z", "--flash_mode", flashMode, "--flash_freq", flashFreq, "--flash_size", "detect", ""+spiStart, imagePath}); + } + } + + + private void eraseFlash(){ + + if(!PreferencesData.get("target_platform").contentEquals("esp32")){ + System.err.println(); + editor.statusError(typefs + " Not Supported on "+PreferencesData.get("target_platform")); + return; + } + + TargetPlatform platform = BaseNoGui.getTargetPlatform(); + + String toolExtension = ".py"; + if(PreferencesData.get("runtime.os").contentEquals("windows")) { + toolExtension = ".exe"; + } else if(PreferencesData.get("runtime.os").contentEquals("macosx")) { + toolExtension = ""; + } + + String pythonCmd; + if(PreferencesData.get("runtime.os").contentEquals("windows")) + pythonCmd = "python.exe"; + else + pythonCmd = "python"; + + Boolean isNetwork = false; + + File esptool = new File(platform.getFolder()+"/tools"); + String serialPort = PreferencesData.get("serial.port"); + + //make sure the serial port or IP is defined + if (serialPort == null || serialPort.isEmpty()) { + System.err.println(); + editor.statusError(typefs + " Error: serial port not defined!"); + return; + } + + //find port + if(serialPort.split("\\.").length == 4){ + isNetwork = true; + } else { + String esptoolCmd = "esptool"+toolExtension; + esptool = new File(platform.getFolder()+"/tools", esptoolCmd); + if(!esptool.exists() || !esptool.isFile()){ + esptool = new File(platform.getFolder()+"/tools/esptool_py", esptoolCmd); + if(!esptool.exists() || !esptool.isFile()){ + esptool = new File(platform.getFolder()+"/tools/esptool", esptoolCmd); + if(!esptool.exists() || !esptool.isFile()){ + esptool = new File(PreferencesData.get("runtime.tools.esptool_py.path"), esptoolCmd); + if(!esptool.exists() || !esptool.isFile()){ + esptool = new File(PreferencesData.get("runtime.tools.esptool.path"), esptoolCmd); + if(!esptool.exists() || !esptool.isFile()){ + System.err.println(); + editor.statusError("Error: esptool not found!"); + return; + } + } + } + } + } + } + System.out.println("esptool : "+esptool.getAbsolutePath()); + System.out.println(); + + Object[] options = { "Yes", "No" }; + String title = "Erase All Flash"; + String message = "Are you sure?"; + + if(JOptionPane.showOptionDialog(editor, message, title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[1]) != JOptionPane.YES_OPTION){ + System.err.println(); + editor.statusError("Warning: Erase All Flash canceled!"); + return; + } + + editor.statusNotice("Erasing all Flash started..."); + System.out.println("Erasing all Flash started..."); + + if(isNetwork){ + System.out.println("Cannot be done through OTA, IP : "+serialPort); + System.out.println(); + } else { + System.out.println("Port: "+serialPort); System.out.println(); if(esptool.getAbsolutePath().endsWith(".py")) - sysExec(new String[]{pythonCmd, esptool.getAbsolutePath(), "--chip", "esp32", "--baud", uploadSpeed, "--port", serialPort, "--before", "default_reset", "--after", "hard_reset", "write_flash", "-z", "--flash_mode", flashMode, "--flash_freq", flashFreq, "--flash_size", "detect", ""+spiStart, imagePath}); + sysExec(new String[]{pythonCmd, esptool.getAbsolutePath(), "--chip", getChip(), "--port", serialPort, "--before", "default_reset", "--after", "hard_reset", "erase_flash"}); else - sysExec(new String[]{esptool.getAbsolutePath(), "--chip", "esp32", "--baud", uploadSpeed, "--port", serialPort, "--before", "default_reset", "--after", "hard_reset", "write_flash", "-z", "--flash_mode", flashMode, "--flash_freq", flashFreq, "--flash_size", "detect", ""+spiStart, imagePath}); + sysExec(new String[]{esptool.getAbsolutePath(), "--chip", getChip(), "--port", serialPort, "--before", "default_reset", "--after", "hard_reset", "erase_flash"}); } } public void run() { - createAndUpload(); + String sketchName = editor.getSketch().getName(); + Object[] options = { "LittleFS", "SPIFFS", "FatFS", "!Erase Flash!" }; + typefs = (String)JOptionPane.showInputDialog(editor, + "Select FS for " + sketchName + + " /data folder", + "Filesystem", + JOptionPane.PLAIN_MESSAGE, + null, + options, + "LittleFS"); + if ((typefs != null) && (typefs.length() > 0)) { + if (typefs == "!Erase Flash!") { + eraseFlash(); + } else { + createAndUpload(); + } + } else { + System.out.println("Tool Exit."); + return; + } + } + + private String getChip() { + String targetBoardId = BaseNoGui.getTargetBoard().getId(); + + if (targetBoardId.contains("s2")) { + return "esp32s2"; + } + else { + return "esp32"; + } + + } + } From 92b4956e103e29dce28940b6639c6d8429bda81e Mon Sep 17 00:00:00 2001 From: lorol Date: Mon, 9 Nov 2020 23:22:34 -0500 Subject: [PATCH 14/26] Added messages to console about chip type Modified README --- README.md | 14 ++++++++------ src/ESP32FS.java | 40 ++++++++++++++++++++-------------------- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index e794a15..f9b93cb 100644 --- a/README.md +++ b/README.md @@ -14,16 +14,17 @@ and uploads the image to ESP32 flash memory. ## Notes for LittleFS - Same partition scheme as SPIFFS -- Until implemented to esp-32 core needs extra library -- See [LITTLEFS esp32 library](https://github.com/lorol/LITTLEFS) for more details -- You need an additional [mklittlefs tool](https://github.com/earlephilhower/mklittlefs) . Download the [release](https://github.com/earlephilhower/mklittlefs/releases) or find it [archived at latest release here](https://github.com/lorol/arduino-esp32fs-plugin/releases ) +- 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 -- You 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 at latest release here](https://github.com/lorol/arduino-esp32fs-plugin/releases ) -- Copy **mkfatfs[.exe]** to **/tools** folder of esp32 platform where **espota** and **esptool** (.py or.exe) tools are located +- 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. @@ -39,7 +40,7 @@ if (!FFat.begin(0, "", 1)) die("Fat FS mount failed. Not enough RAM?"); - 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 ```/Arduino/tools/ESP32FS/tool/esp32fs.jar```). - Make sure you have **mklittlefs[.exe]** and **mkfatfs[.exe]** available at **/tools** folder or in sub-folder there -- See at [latest release](https://github.com/lorol/arduino-esp32fs-plugin/releases) for copies of archived binaries in question. +- 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. @@ -52,6 +53,7 @@ if (!FFat.begin(0, "", 1)) die("Fat FS mount failed. Not enough RAM?"); - 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 the status of Image Uploaded message. Might take a few minutes for large file system sizes. diff --git a/src/ESP32FS.java b/src/ESP32FS.java index b3055f7..79bd809 100644 --- a/src/ESP32FS.java +++ b/src/ESP32FS.java @@ -170,7 +170,9 @@ private void createAndUpload(){ if (typefs == "FatFS") spiOffset = 4096; - if(!PreferencesData.get("target_platform").contentEquals("esp32")){ + System.out.println("Chip : " + getChip()); + + if(!PreferencesData.get("target_platform").contains("esp32")){ System.err.println(); editor.statusError(typefs + " Not Supported on "+PreferencesData.get("target_platform")); return; @@ -399,8 +401,7 @@ private void createAndUpload(){ System.out.println("[" + typefs + "] speed : "+uploadSpeed); System.out.println("[" + typefs + "] mode : "+flashMode); System.out.println("[" + typefs + "] freq : "+flashFreq); - System.out.println(); - + System.out.println(); if(esptool.getAbsolutePath().endsWith(".py")) sysExec(new String[]{pythonCmd, esptool.getAbsolutePath(), "--chip", getChip(), "--baud", uploadSpeed, "--port", serialPort, "--before", "default_reset", "--after", "hard_reset", "write_flash", "-z", "--flash_mode", flashMode, "--flash_freq", flashFreq, "--flash_size", "detect", ""+spiStart, imagePath}); else @@ -410,8 +411,8 @@ private void createAndUpload(){ private void eraseFlash(){ - - if(!PreferencesData.get("target_platform").contentEquals("esp32")){ + System.out.println("Chip : " + getChip()); + if(!PreferencesData.get("target_platform").contains("esp32")){ System.err.println(); editor.statusError(typefs + " Not Supported on "+PreferencesData.get("target_platform")); return; @@ -491,12 +492,24 @@ private void eraseFlash(){ System.out.println("Port: "+serialPort); System.out.println(); if(esptool.getAbsolutePath().endsWith(".py")) - sysExec(new String[]{pythonCmd, esptool.getAbsolutePath(), "--chip", "esp32", "--port", serialPort, "--before", "default_reset", "--after", "hard_reset", "erase_flash"}); + sysExec(new String[]{pythonCmd, esptool.getAbsolutePath(), "--chip", getChip(), "--port", serialPort, "--before", "default_reset", "--after", "hard_reset", "erase_flash"}); else - sysExec(new String[]{esptool.getAbsolutePath(), "--chip", "esp32", "--port", serialPort, "--before", "default_reset", "--after", "hard_reset", "erase_flash"}); + sysExec(new String[]{esptool.getAbsolutePath(), "--chip", getChip(), "--port", serialPort, "--before", "default_reset", "--after", "hard_reset", "erase_flash"}); } } + private String getChip() { + String targetBoardId = BaseNoGui.getTargetBoard().getId(); + + if (targetBoardId.contains("s2")) { + return "esp32s2"; + } + else { + return "esp32"; + } + + } + public void run() { String sketchName = editor.getSketch().getName(); Object[] options = { "LittleFS", "SPIFFS", "FatFS", "!Erase Flash!" }; @@ -520,17 +533,4 @@ public void run() { } } - - private String getChip() { - String targetBoardId = BaseNoGui.getTargetBoard().getId(); - - if (targetBoardId.contains("s2")) { - return "esp32s2"; - } - else { - return "esp32"; - } - - } - } From 0e20b772318d3a533ebf621de5311ac535a6b5e4 Mon Sep 17 00:00:00 2001 From: lorol Date: Fri, 20 Nov 2020 12:54:47 -0500 Subject: [PATCH 15/26] Use partitions.csv from sketch folder --- src/ESP32FS.java | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/src/ESP32FS.java b/src/ESP32FS.java index 79bd809..53787f7 100644 --- a/src/ESP32FS.java +++ b/src/ESP32FS.java @@ -206,7 +206,7 @@ private void createAndUpload(){ String espotaCmd = "espota.py"; if(PreferencesData.get("runtime.os").contentEquals("windows")) espotaCmd = "espota.exe"; - + Boolean isNetwork = false; File espota = new File(platform.getFolder()+"/tools"); File esptool = new File(platform.getFolder()+"/tools"); @@ -217,23 +217,32 @@ private void createAndUpload(){ editor.statusError("Partitions Not Defined for "+BaseNoGui.getBoardPreferences().get("name")); return; } - - try { - partitions = BaseNoGui.getBoardPreferences().get("build.partitions"); - if(partitions == null || partitions.contentEquals("")){ - editor.statusError("Partitions Not Found for "+BaseNoGui.getBoardPreferences().get("name")); - return; - } - } catch(Exception e){ - editor.statusError(e); - return; - } - File partitionsFile = new File(platform.getFolder() + "/tools/partitions", partitions + ".csv"); - if (!partitionsFile.exists() || !partitionsFile.isFile()) { - System.err.println(); - editor.statusError(typefs + " Error: partitions file " + partitions + ".csv not found!"); - return; + File partitionsFile = new File(editor.getSketch().getFolder(), "partitions.csv"); + + if (partitionsFile.exists() && partitionsFile.isFile()) { + System.out.println("Using partitions.csv from sketch folder."); + + } else { + System.out.println("Using partition scheme from Arduino IDE."); + try { + partitions = BaseNoGui.getBoardPreferences().get("build.partitions"); + if(partitions == null || partitions.contentEquals("")){ + editor.statusError("Partitions Not Found for "+BaseNoGui.getBoardPreferences().get("name")); + return; + } + } catch(Exception e){ + editor.statusError(e); + return; + } + + partitionsFile = new File(platform.getFolder() + "/tools/partitions", partitions + ".csv"); + + if (!partitionsFile.exists() || !partitionsFile.isFile()) { + System.err.println(); + editor.statusError(typefs + " Error: partitions file " + partitions + ".csv not found!"); + return; + } } try { From 83a0e1a0674d07726e8af4320ce6b957497bbf13 Mon Sep 17 00:00:00 2001 From: lorol Date: Fri, 20 Nov 2020 21:54:51 -0500 Subject: [PATCH 16/26] Calculating the missing Offset (begining of partition) of partition.csv file lines. Minor changes in make.win batch file --- README.md | 8 +++++--- src/ESP32FS.java | 49 +++++++++++++++++++++++++++++++++++++----------- src/make_win.bat | 3 ++- 3 files changed, 45 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index f9b93cb..adfb14f 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ # Arduino ESP32 filesystem uploader - Arduino plugin which packs sketch data folder into SPIFFS, LittleFS or FatFS filesystem image, -and uploads the image to ESP32 flash memory. -- Added a choice to "Erase all flash" -- You can have only one of three filesystems on same Arduino project. +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 diff --git a/src/ESP32FS.java b/src/ESP32FS.java index 53787f7..c114bc3 100644 --- a/src/ESP32FS.java +++ b/src/ESP32FS.java @@ -248,18 +248,42 @@ private void createAndUpload(){ try { BufferedReader partitionsReader = new BufferedReader(new FileReader(partitionsFile)); String partitionsLine = ""; + long spiPrevEnd = 0; + boolean isDataLine = false; while ((partitionsLine = partitionsReader.readLine()) != null) { - if( ((typefs != "FatFS") && partitionsLine.contains("spiffs")) || ((typefs == "FatFS") && partitionsLine.contains("ffat"))){ - partitionsLine = partitionsLine.substring(partitionsLine.indexOf(",")+1); - partitionsLine = partitionsLine.substring(partitionsLine.indexOf(",")+1); - partitionsLine = partitionsLine.substring(partitionsLine.indexOf(",")+1); - while(partitionsLine.startsWith(" ")) partitionsLine = partitionsLine.substring(1); - String pStart = partitionsLine.substring(0, partitionsLine.indexOf(",")); - partitionsLine = partitionsLine.substring(partitionsLine.indexOf(",")+1); - while(partitionsLine.startsWith(" ")) partitionsLine = partitionsLine.substring(1); - String pSize = partitionsLine.substring(0, partitionsLine.indexOf(",")); - spiStart = parseInt(pStart) + spiOffset; - spiSize = parseInt(pSize) - spiOffset; + if (!partitionsLine.substring(0, 1).equals("#")) { + if( ((typefs != "FatFS") && partitionsLine.contains("spiffs")) || ((typefs == "FatFS") && partitionsLine.contains("ffat"))){ + isDataLine = true; + } + partitionsLine = partitionsLine.substring(partitionsLine.indexOf(",")+1); + partitionsLine = partitionsLine.substring(partitionsLine.indexOf(",")+1); + partitionsLine = partitionsLine.substring(partitionsLine.indexOf(",")+1); + while(partitionsLine.startsWith(" ")) partitionsLine = partitionsLine.substring(1); + String pStart = partitionsLine.substring(0, partitionsLine.indexOf(",")); + partitionsLine = partitionsLine.substring(partitionsLine.indexOf(",")+1); + while(partitionsLine.startsWith(" ")) partitionsLine = partitionsLine.substring(1); + String pSize = partitionsLine.substring(0, partitionsLine.indexOf(",")); + + //System.out.println("From CSV, Partition Start: " + pStart + ", Size: " + pSize); + + if (isDataLine) { + if (pStart == null || pStart.trim().isEmpty()) { + spiStart = spiPrevEnd + spiOffset; + } else { + spiStart = parseInt(pStart) + spiOffset; + } + spiSize = parseInt(pSize) - spiOffset; + break; + } else { + if (pSize != null && !pSize.trim().isEmpty()) { + if (pStart == null || pStart.trim().isEmpty()) { + spiPrevEnd += parseInt(pSize); + } else { + spiPrevEnd = parseInt(pStart) + parseInt(pSize); + } + } + spiSize = 0; + } } } if(spiSize == 0){ @@ -272,6 +296,9 @@ private void createAndUpload(){ return; } + System.out.println("Start: 0x" + String.format("%x", spiStart)); + System.out.println("Size : 0x" + String.format("%x", spiSize)); + File tool = new File(platform.getFolder() + "/tools", mkspiffsCmd); if (!tool.exists() || !tool.isFile()) { tool = new File(platform.getFolder() + "/tools/mk" + typefs.toLowerCase(), mkspiffsCmd); diff --git a/src/make_win.bat b/src/make_win.bat index cdddbeb..09a6078 100644 --- a/src/make_win.bat +++ b/src/make_win.bat @@ -1,4 +1,5 @@ -del bin\*.* +del bin\*.jar +rd /S /Q bin\com "C:\Program Files (x86)\Java\jdk1.8.0_152\bin\javac.exe" -target 1.8 -cp ".;arduino-core.jar;commons-codec-1.7.jar;pde.jar" -d bin ESP32FS.java cd bin "C:\Program Files (x86)\Java\jdk1.8.0_152\bin\jar.exe" cvfM esp32fs.jar * From cd75923479aff09153a71b99d82c07989ae9b7d3 Mon Sep 17 00:00:00 2001 From: lorol Date: Sun, 22 Nov 2020 01:05:45 -0500 Subject: [PATCH 17/26] Parse partition csv file line' Offset(Start address) and Size values containing 0x 0X hexadecimal or M,m,K,k bytes as described in https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/partition-tables.html#offset-size Similarily to gen_esp32part.py --- src/ESP32FS.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ESP32FS.java b/src/ESP32FS.java index c114bc3..e1240bf 100644 --- a/src/ESP32FS.java +++ b/src/ESP32FS.java @@ -154,7 +154,9 @@ private String getBuildFolderPath(Sketch s) { } private long parseInt(String value){ - if(value.startsWith("0x")) return Long.parseLong(value.substring(2), 16); + if(value.endsWith("m") || value.endsWith("M")) return 1024*1024*Long.parseLong(value.substring(0, (value.length() - 1))); + else if(value.endsWith("k") || value.endsWith("K")) return 1024*Long.parseLong(value.substring(0, (value.length() - 1))); + else if(value.startsWith("0x") || value.startsWith("0X")) return Long.parseLong(value.substring(2), 16); else return Integer.parseInt(value); } From 810d85c2460e7915254c55850069847a638632ba Mon Sep 17 00:00:00 2001 From: lorol Date: Sun, 22 Nov 2020 09:37:56 -0500 Subject: [PATCH 18/26] Improvements and tests before release --- src/ESP32FS.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/ESP32FS.java b/src/ESP32FS.java index e1240bf..2406356 100644 --- a/src/ESP32FS.java +++ b/src/ESP32FS.java @@ -154,10 +154,9 @@ private String getBuildFolderPath(Sketch s) { } private long parseInt(String value){ - if(value.endsWith("m") || value.endsWith("M")) return 1024*1024*Long.parseLong(value.substring(0, (value.length() - 1))); - else if(value.endsWith("k") || value.endsWith("K")) return 1024*Long.parseLong(value.substring(0, (value.length() - 1))); - else if(value.startsWith("0x") || value.startsWith("0X")) return Long.parseLong(value.substring(2), 16); - else return Integer.parseInt(value); + if(value.endsWith("m") || value.endsWith("M")) return 1024*1024*Long.decode(value.substring(0, (value.length() - 1))); + else if(value.endsWith("k") || value.endsWith("K")) return 1024*Long.decode(value.substring(0, (value.length() - 1))); + else return Long.decode(value); } private long getIntPref(String name){ From 22efec661c375199df8f313f1c3503d572711f2e Mon Sep 17 00:00:00 2001 From: lorol Date: Tue, 24 Nov 2020 11:31:23 -0500 Subject: [PATCH 19/26] Release 2.0.5 with comment how to build a jar that is in esp32fs_no_compress.zip variant --- src/ESP32FS.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ESP32FS.java b/src/ESP32FS.java index 2406356..a862d7b 100644 --- a/src/ESP32FS.java +++ b/src/ESP32FS.java @@ -439,6 +439,7 @@ private void createAndUpload(){ System.out.println("[" + typefs + "] mode : "+flashMode); System.out.println("[" + typefs + "] freq : "+flashFreq); System.out.println(); + // change after "write_flash" "-z" to "-u" (--no_compress) below to build file for esp32fs_no_compress.zip if(esptool.getAbsolutePath().endsWith(".py")) sysExec(new String[]{pythonCmd, esptool.getAbsolutePath(), "--chip", getChip(), "--baud", uploadSpeed, "--port", serialPort, "--before", "default_reset", "--after", "hard_reset", "write_flash", "-z", "--flash_mode", flashMode, "--flash_freq", flashFreq, "--flash_size", "detect", ""+spiStart, imagePath}); else From a41ef5cf6ce1e25ef79f0c3f9a622ff90f856f5d Mon Sep 17 00:00:00 2001 From: lorol Date: Tue, 24 Nov 2020 14:23:20 -0500 Subject: [PATCH 20/26] jar files added to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index a5d8f72..b889088 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ bin/ dist/ +src/*.jar From e4c702fb5b2cc8b247ae40d445989134a02fb535 Mon Sep 17 00:00:00 2001 From: lorol Date: Tue, 15 Dec 2020 12:53:33 -0500 Subject: [PATCH 21/26] More universal way to get chip model https://github.com/me-no-dev/arduino-esp32fs-plugin/pull/28/files --- src/ESP32FS.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/ESP32FS.java b/src/ESP32FS.java index a862d7b..86a8f5a 100644 --- a/src/ESP32FS.java +++ b/src/ESP32FS.java @@ -43,6 +43,7 @@ import processing.app.Sketch; import processing.app.tools.Tool; import processing.app.helpers.ProcessUtils; +import processing.app.helpers.PreferencesMap; import processing.app.debug.TargetPlatform; import org.apache.commons.codec.digest.DigestUtils; @@ -536,16 +537,10 @@ private void eraseFlash(){ } } - private String getChip() { - String targetBoardId = BaseNoGui.getTargetBoard().getId(); - - if (targetBoardId.contains("s2")) { - return "esp32s2"; - } - else { - return "esp32"; - } - + private String getChip(){ + PreferencesMap prefs = BaseNoGui.getTargetBoard().getPreferences(); + String mcu = prefs.get("build.mcu", "esp32"); + return mcu; } public void run() { From b97f756142dfb7a2a4d24aa19939bfd90bd280e7 Mon Sep 17 00:00:00 2001 From: lorol Date: Mon, 21 Dec 2020 21:57:24 -0500 Subject: [PATCH 22/26] Bugfixes Changed sysExec() to be based on: https://www.infoworld.com/article/2071275/when-runtime-exec---won-t.html The original way hangs on long uploading. --- src/ESP32FS.java | 98 +++++++++++++++++++++++++++------------------ src/bin/placeholder | 0 src/make_win.bat | 4 +- 3 files changed, 61 insertions(+), 41 deletions(-) delete mode 100644 src/bin/placeholder diff --git a/src/ESP32FS.java b/src/ESP32FS.java index 86a8f5a..e7d70a1 100644 --- a/src/ESP32FS.java +++ b/src/ESP32FS.java @@ -23,14 +23,10 @@ package com.esp32.mkspiffs; -import java.io.File; -import java.io.FileReader; -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.io.IOException; +import java.util.*; +import java.io.*; import java.text.SimpleDateFormat; -import java.util.Date; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import javax.swing.JOptionPane; @@ -51,6 +47,32 @@ import cc.arduino.files.DeleteFilesOnShutdown; +/** + * Taken from https://www.infoworld.com/article/2071275/when-runtime-exec---won-t.html?page=3 + */ +class StreamGobbler extends Thread { + InputStream is; + String type; + + StreamGobbler(InputStream is, String type) { + this.is = is; + this.type = type; + } + + public void run() { + try { + InputStreamReader isr = new InputStreamReader(is); + BufferedReader br = new BufferedReader(isr); + String line=null; + while ( (line = br.readLine()) != null) + System.out.println(type + ">" + line); + } catch (IOException ioe) { + ioe.printStackTrace(); + } + } +} + + /** * Example Tools menu entry. */ @@ -71,31 +93,26 @@ public String getMenuTitle() { private int listenOnProcess(String[] arguments){ try { - final Process p = ProcessUtils.exec(arguments); - Thread thread = new Thread() { - public void run() { - try { - InputStreamReader reader = new InputStreamReader(p.getInputStream()); - int c; - while ((c = reader.read()) != -1) - System.out.print((char) c); - reader.close(); - - reader = new InputStreamReader(p.getErrorStream()); - while ((c = reader.read()) != -1) - System.err.print((char) c); - reader.close(); - } catch (Exception e){} - } - }; - thread.start(); - int res = p.waitFor(); - thread.join(); - return res; + Runtime rt = Runtime.getRuntime(); + Process proc = rt.exec(arguments); + // any error message? + StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(), "E"); + + // any output? + StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream(), "O"); + + // kick them off + errorGobbler.start(); + outputGobbler.start(); + + // any error??? + int exitVal = proc.waitFor(); + + return exitVal; } catch (Exception e){ return -1; } - } + } private void sysExec(final String[] arguments){ Thread thread = new Thread() { @@ -328,9 +345,12 @@ private void createAndUpload(){ isNetwork = true; espota = new File(platform.getFolder()+"/tools", espotaCmd); if(!espota.exists() || !espota.isFile()){ - System.err.println(); - editor.statusError(typefs + " Error: espota not found!"); - return; + espota = new File(platform.getFolder()+"/tools", "espota.py"); //fall-back to .py + if(!espota.exists() || !espota.isFile()){ + System.err.println(); + editor.statusError(typefs + " Error: espota not found!"); + return; + } } System.out.println("espota : "+espota.getAbsolutePath()); System.out.println(); @@ -354,11 +374,10 @@ private void createAndUpload(){ } } } + System.out.println("esptool : "+esptool.getAbsolutePath()); + System.out.println(); } - System.out.println("esptool : "+esptool.getAbsolutePath()); - System.out.println(); - - + //load a list of all files int fileCount = 0; File dataFolder = new File(editor.getSketch().getFolder(), "data"); @@ -426,9 +445,10 @@ private void createAndUpload(){ if(isNetwork){ System.out.println("[" + typefs + "] IP : "+serialPort); - System.out.println(); + System.out.println("Running: " + espota.getAbsolutePath() + " -i " + serialPort + " -p 3232 -s -f " + imagePath); + System.out.println(); if(espota.getAbsolutePath().endsWith(".py")) - sysExec(new String[]{pythonCmd, espota.getAbsolutePath(), "-i", serialPort, "-p", "3232", "-s", "-f", imagePath}); + sysExec(new String[]{pythonCmd, espota.getAbsolutePath(), "-i", serialPort, "-p", "3232", "-s", "-f", imagePath}); // other flags , "-d", "-r", "-t", "50" else sysExec(new String[]{espota.getAbsolutePath(), "-i", serialPort, "-p", "3232", "-s", "-f", imagePath}); } else { @@ -507,9 +527,9 @@ private void eraseFlash(){ } } } + System.out.println("esptool : "+esptool.getAbsolutePath()); + System.out.println(); } - System.out.println("esptool : "+esptool.getAbsolutePath()); - System.out.println(); Object[] options = { "Yes", "No" }; String title = "Erase All Flash"; diff --git a/src/bin/placeholder b/src/bin/placeholder deleted file mode 100644 index e69de29..0000000 diff --git a/src/make_win.bat b/src/make_win.bat index 09a6078..0333c50 100644 --- a/src/make_win.bat +++ b/src/make_win.bat @@ -1,6 +1,6 @@ del bin\*.jar rd /S /Q bin\com -"C:\Program Files (x86)\Java\jdk1.8.0_152\bin\javac.exe" -target 1.8 -cp ".;arduino-core.jar;commons-codec-1.7.jar;pde.jar" -d bin ESP32FS.java +javac.exe -target 1.8 -cp ".;arduino-core.jar;commons-codec-1.7.jar;pde.jar" -d bin ESP32FS.java cd bin -"C:\Program Files (x86)\Java\jdk1.8.0_152\bin\jar.exe" cvfM esp32fs.jar * +jar.exe cvfM esp32fs.jar * pause From 854300087e89e0a636f1d6dee13e727478524806 Mon Sep 17 00:00:00 2001 From: lorol Date: Wed, 23 Dec 2020 09:57:18 -0500 Subject: [PATCH 23/26] Better make_win.bat --- README.md | 7 +++---- make_win.bat | 12 ++++++++++++ src/make_win.bat | 6 ------ 3 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 make_win.bat delete mode 100644 src/make_win.bat diff --git a/README.md b/README.md index adfb14f..28f5ac9 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ - 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 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. @@ -12,7 +12,6 @@ and uploads the image to ESP32 flash memory. - 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 @@ -67,8 +66,8 @@ if (!FFat.begin(0, "", 1)) die("Fat FS mount failed. Not enough RAM?"); - Install Java JDK - Find the path of javac.exe and jar.exe -- Edit **make_win.bat** accordingly -- Copy files **arduino-core.jar , commons-codec-1.7.jar , pde.jar** from your Arduino IDE installation to the folder where is located **make_win.bat** +- 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 /bin directory diff --git a/make_win.bat b/make_win.bat new file mode 100644 index 0000000..424091f --- /dev/null +++ b/make_win.bat @@ -0,0 +1,12 @@ +cd %~dp0\src +set PATH=your\java\bin;%PATH% +set ALP=your\arduino\lib +IF EXIST bin GOTO NOWINDIR +mkdir bin +:NOWINDIR +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 diff --git a/src/make_win.bat b/src/make_win.bat deleted file mode 100644 index 0333c50..0000000 --- a/src/make_win.bat +++ /dev/null @@ -1,6 +0,0 @@ -del bin\*.jar -rd /S /Q bin\com -javac.exe -target 1.8 -cp ".;arduino-core.jar;commons-codec-1.7.jar;pde.jar" -d bin ESP32FS.java -cd bin -jar.exe cvfM esp32fs.jar * -pause From b2268aa6e85cfe751cde84b59bdd0a4232875809 Mon Sep 17 00:00:00 2001 From: lorol Date: Wed, 23 Dec 2020 11:26:42 -0500 Subject: [PATCH 24/26] Update Readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 28f5ac9..73ab510 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ if (!FFat.begin(0, "", 1)) die("Fat FS mount failed. Not enough RAM?"); - 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 /bin directory +- Find the **jar** file in src/bin directory ## Credits and license From e9953089744d968b3d47edcfd4155d3332866db8 Mon Sep 17 00:00:00 2001 From: lorol Date: Wed, 23 Dec 2020 12:08:06 -0500 Subject: [PATCH 25/26] Update ESP32FS.java Changed line beginnings of transferred OUTPUT and ERROR from exec to console to look clieaner --- src/ESP32FS.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ESP32FS.java b/src/ESP32FS.java index e7d70a1..e1bb586 100644 --- a/src/ESP32FS.java +++ b/src/ESP32FS.java @@ -96,10 +96,10 @@ private int listenOnProcess(String[] arguments){ Runtime rt = Runtime.getRuntime(); Process proc = rt.exec(arguments); // any error message? - StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(), "E"); + StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(), "_"); // any output? - StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream(), "O"); + StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream(), "-"); // kick them off errorGobbler.start(); From 310e9d0594b35f04f8b9d5a0d9b6ee82d9922db0 Mon Sep 17 00:00:00 2001 From: lorol Date: Wed, 23 Dec 2020 12:09:57 -0500 Subject: [PATCH 26/26] Update make_win.bat --- make_win.bat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/make_win.bat b/make_win.bat index 424091f..390b3b3 100644 --- a/make_win.bat +++ b/make_win.bat @@ -1,9 +1,9 @@ cd %~dp0\src set PATH=your\java\bin;%PATH% set ALP=your\arduino\lib -IF EXIST bin GOTO NOWINDIR +IF EXIST bin GOTO NODIR mkdir bin -:NOWINDIR +: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