Skip to content

Commit 3fa7cb3

Browse files
Don't use picotool on RP2040 filesystems
The generated UF2 is not supported by the ROM, causing the chip to throw it away silently. Instead, use the original uf2conv upload+convert in 1 step option. Tested on an RP2350 and an RP2040. Fixes #55
1 parent e1930d5 commit 3fa7cb3

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/extension.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -374,17 +374,19 @@ export function activate(context: vscode.ExtensionContext) {
374374
let conversion = false
375375
if (pico) {
376376
if (Number(arduinoContext.boardDetails?.buildProperties['version'].split('.')[0]) > 3) {
377-
// Pico 4.x needs a preparation stage for the RP2350
378-
writeEmitter.fire(bold("\r\n4.0 or above\r\n"));
379-
let picotoolOpts = ["uf2", "convert", imageFile, "-t", "bin", imageFile + ".uf2", "-o", "0x" + fsStart.toString(16), "--family", "data"];
380-
writeEmitter.fire(bold("\r\nGenerating UF2 image\r\n"));
381-
writeEmitter.fire(blue("Command Line: ") + green(picotool + " " + picotoolOpts.join(" ") + "\r\n"));
382-
exitCode = await runCommand(picotool, picotoolOpts);
383-
if (exitCode) {
384-
writeEmitter.fire(red("\r\n\r\nERROR: Generation failed, error code: " + String(exitCode) + "\r\n\r\n"));
385-
return;
377+
if (arduinoContext.boardDetails.buildProperties['build.chip'] == "rp2350") {
378+
// Pico 4.x needs a preparation stage for the RP2350
379+
writeEmitter.fire(bold("\r\n4.0 or above\r\n"));
380+
let picotoolOpts = ["uf2", "convert", imageFile, "-t", "bin", imageFile + ".uf2", "-o", "0x" + fsStart.toString(16), "--family", "data"];
381+
writeEmitter.fire(bold("\r\nGenerating UF2 image\r\n"));
382+
writeEmitter.fire(blue("Command Line: ") + green(picotool + " " + picotoolOpts.join(" ") + "\r\n"));
383+
exitCode = await runCommand(picotool, picotoolOpts);
384+
if (exitCode) {
385+
writeEmitter.fire(red("\r\n\r\nERROR: Generation failed, error code: " + String(exitCode) + "\r\n\r\n"));
386+
return;
387+
}
388+
conversion = true;
386389
}
387-
conversion = true;
388390
} else {
389391
writeEmitter.fire(bold("\r\n3.x, no UF2 conversion\r\n"));
390392
}

0 commit comments

Comments
 (0)