Skip to content

Commit

Permalink
ESP32 Arduino now ships binary esptool under Linux (#77)
Browse files Browse the repository at this point in the history
Sometimes we'll have a PY, sometimes we'll have an ELF.  Use hueristics
to pick the right version at runtime.

Fixes #76
  • Loading branch information
earlephilhower authored Jan 1, 2025
1 parent bf048cb commit 4c74c4c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "arduino-littlefs-upload",
"displayName": "arduino-littlefs-upload",
"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",
"version": "1.5.2",
"version": "1.5.3",
"engines": {
"vscode": "^1.82.0"
},
Expand Down
14 changes: 10 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ export function activate(context: vscode.ExtensionContext) {
} else {
let flashMode = arduinoContext.boardDetails.buildProperties["build.flash_mode"];
let flashFreq = arduinoContext.boardDetails.buildProperties["build.flash_freq"];
let espTool = "esptool" + extEspTool;
let espTool = "esptool";
let espToolPath = findTool(arduinoContext, "runtime.tools.esptool_py.path");
if (espToolPath) {
espTool = espToolPath + path.sep + espTool;
Expand All @@ -525,10 +525,16 @@ export function activate(context: vscode.ExtensionContext) {
"--before", "default_reset", "--after", "hard_reset", "write_flash", "-z",
"--flash_mode", flashMode, "--flash_freq", flashFreq, "--flash_size", "detect", String(fsStart), imageFile];
if ((platform() === 'win32') || (platform() === 'darwin')) {
cmdApp = espTool; // Have binary EXE on Mac/Windows
cmdApp = espTool + extEspTool; // Have binary EXE on Mac/Windows
} else {
cmdApp = "python3"; // Not shipped, assumed installed on Linux
uploadOpts.unshift(espTool); // Need to call Python3
// Sometimes they give a .py, sometimes they give a precompiled binary
// If there's a .py we'll use that one, OTW hope there's a binary one
if (fs.existsSync(espTool + extEspTool)) {
cmdApp = "python3"; // Not shipped, assumed installed on Linux
uploadOpts.unshift(espTool + extEspTool); // Need to call Python3
} else {
cmdApp = espTool; // Binary without extension
}
}
}
} else { // esp8266
Expand Down

0 comments on commit 4c74c4c

Please sign in to comment.