Skip to content

Commit

Permalink
Make Linux/Mac upload work for ESP32 (#20)
Browse files Browse the repository at this point in the history
* Make Linux/Mac upload work for ESP32

Need to explicitly call the Python3 interpreter for the ESP32 uploads
under Linux and MacOS.

* ESP32 doesn't ship Python3, use system version
  • Loading branch information
earlephilhower authored Apr 23, 2024
1 parent f0f5140 commit a86975b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Binary file not shown.
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.1.1",
"version": "1.1.2",
"engines": {
"vscode": "^1.82.0"
},
Expand Down
10 changes: 8 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ export function activate(context: vscode.ExtensionContext) {

// Windows exes need ".exe" suffix
let ext = (platform() === 'win32') ? ".exe" : "";
let extEspTool = (platform() === 'win32') ? ".exe" : ".py";
let mklittlefs = "mklittlefs" + ext;

let tool = undefined;
Expand Down Expand Up @@ -275,15 +276,20 @@ export function activate(context: vscode.ExtensionContext) {
} else if (esp32) {
let flashMode = arduinoContext.boardDetails.buildProperties["build.flash_mode"];
let flashFreq = arduinoContext.boardDetails.buildProperties["build.flash_freq"];
let espTool = "esptool" + ext;
let espTool = "esptool" + extEspTool;
let espToolPath = findTool(arduinoContext, "runtime.tools.esptool_py.path");
if (espToolPath) {
espTool = espToolPath + "/" + espTool;
}
cmdApp = espTool;
uploadOpts = ["--chip", esp32variant, "--port", serialPort, "--baud", String(uploadSpeed),
"--before", "default_reset", "--after", "hard_reset", "write_flash", "-z",
"--flash_mode", flashMode, "--flash_freq", flashFreq, "--flash_size", "detect", String(fsStart), imageFile];
if (platform() === 'win32') {
cmdApp = espTool; // Have binary EXE on Win32
} else {
cmdApp = "python3"; // Not shipped, assumed installed
uploadOpts.unshift(espTool); // Need to call Python3
}
} else { // esp8266
let upload = "tools/upload.py";
let uploadPath = findTool(arduinoContext, "runtime.platform.path");
Expand Down

0 comments on commit a86975b

Please sign in to comment.