Skip to content

Commit 4c74c4c

Browse files
ESP32 Arduino now ships binary esptool under Linux (#77)
Sometimes we'll have a PY, sometimes we'll have an ELF. Use hueristics to pick the right version at runtime. Fixes #76
1 parent bf048cb commit 4c74c4c

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "arduino-littlefs-upload",
33
"displayName": "arduino-littlefs-upload",
44
"description": "Build and uploads LittleFS filesystems for the Arduino-Pico RP2040 core, ESP8266 core, or ESP32 core under Arduino IDE 2.2.1 or higher",
5-
"version": "1.5.2",
5+
"version": "1.5.3",
66
"engines": {
77
"vscode": "^1.82.0"
88
},

src/extension.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ export function activate(context: vscode.ExtensionContext) {
516516
} else {
517517
let flashMode = arduinoContext.boardDetails.buildProperties["build.flash_mode"];
518518
let flashFreq = arduinoContext.boardDetails.buildProperties["build.flash_freq"];
519-
let espTool = "esptool" + extEspTool;
519+
let espTool = "esptool";
520520
let espToolPath = findTool(arduinoContext, "runtime.tools.esptool_py.path");
521521
if (espToolPath) {
522522
espTool = espToolPath + path.sep + espTool;
@@ -525,10 +525,16 @@ export function activate(context: vscode.ExtensionContext) {
525525
"--before", "default_reset", "--after", "hard_reset", "write_flash", "-z",
526526
"--flash_mode", flashMode, "--flash_freq", flashFreq, "--flash_size", "detect", String(fsStart), imageFile];
527527
if ((platform() === 'win32') || (platform() === 'darwin')) {
528-
cmdApp = espTool; // Have binary EXE on Mac/Windows
528+
cmdApp = espTool + extEspTool; // Have binary EXE on Mac/Windows
529529
} else {
530-
cmdApp = "python3"; // Not shipped, assumed installed on Linux
531-
uploadOpts.unshift(espTool); // Need to call Python3
530+
// Sometimes they give a .py, sometimes they give a precompiled binary
531+
// If there's a .py we'll use that one, OTW hope there's a binary one
532+
if (fs.existsSync(espTool + extEspTool)) {
533+
cmdApp = "python3"; // Not shipped, assumed installed on Linux
534+
uploadOpts.unshift(espTool + extEspTool); // Need to call Python3
535+
} else {
536+
cmdApp = espTool; // Binary without extension
537+
}
532538
}
533539
}
534540
} else { // esp8266

0 commit comments

Comments
 (0)