Skip to content

Commit

Permalink
Added messages to console about chip type
Browse files Browse the repository at this point in the history
Modified README
  • Loading branch information
lorol committed Nov 10, 2020
1 parent 4651830 commit 92b4956
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 26 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 ```<home_dir>/Arduino/tools/ESP32FS/tool/esp32fs.jar```).
- Make sure you have **mklittlefs[.exe]** and **mkfatfs[.exe]** available at **/tools** folder or in sub-folder there
- 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.

Expand All @@ -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.

Expand Down
40 changes: 20 additions & 20 deletions src/ESP32FS.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -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!" };
Expand All @@ -520,17 +533,4 @@ public void run() {
}

}

private String getChip() {
String targetBoardId = BaseNoGui.getTargetBoard().getId();

if (targetBoardId.contains("s2")) {
return "esp32s2";
}
else {
return "esp32";
}

}

}

0 comments on commit 92b4956

Please sign in to comment.