Skip to content

Commit acfe8de

Browse files
committed
Update openocd, and add new risc-v toolchain
1 parent 47622cd commit acfe8de

File tree

6 files changed

+65
-1
lines changed

6 files changed

+65
-1
lines changed

data/0.17.0/supportedToolchains.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ darwin_arm64 = https://armkeil.blob.core.windows.net/developer/Files/downloads/g
1616
darwin_x64 = https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-darwin-x86_64-arm-none-eabi.tar.xz
1717
linux_x64 = https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz
1818
linux_arm64 = https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-aarch64-arm-none-eabi.tar.xz
19+
[RISCV_ZCB_RPI_2_1_1_2]
20+
win32_x64 = https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.1.1-2/riscv-toolchain-15-x64-win.zip
21+
darwin_arm64 = https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.1.1-2/riscv-toolchain-15-arm64-mac.zip
22+
darwin_x64 = https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.1.1-2/riscv-toolchain-15-x64-mac.zip
23+
linux_x64 = https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.1.1-2/riscv-toolchain-15-x86_64-lin.tar.gz
24+
linux_arm64 = https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.1.1-2/riscv-toolchain-15-aarch64-lin.tar.gz
1925
[RISCV_RPI_2_0_0_5]
2026
win32_x64 = https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.0.0-5/riscv-toolchain-14-x64-win.zip
2127
darwin_arm64 = https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.0.0-5/riscv-toolchain-14-arm64-mac.zip

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,11 @@
208208
"title": "Uninstall Pico SDK",
209209
"category": "Raspberry Pi Pico"
210210
},
211+
{
212+
"command": "raspberry-pi-pico.updateOpenOCD",
213+
"title": "Update OpenOCD",
214+
"category": "Raspberry Pi Pico"
215+
},
211216
{
212217
"command": "raspberry-pi-pico.flashProject",
213218
"title": "Flash Pico Project (SWD)",

scripts/pico-vscode.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,8 @@ else()
1818
endif()
1919
if(PICO_TOOLCHAIN_PATH MATCHES "RISCV")
2020
set(PICO_PLATFORM rp2350-riscv CACHE STRING "Pico Platform")
21+
if(PICO_TOOLCHAIN_PATH MATCHES "RISCV_ZCB")
22+
set(PICO_COMPILER "pico_riscv_gcc_zcb_zcmp")
23+
endif()
2124
endif()
2225
endif()

src/commands/updateOpenOCD.mts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { Command } from "./command.mjs";
2+
import Logger from "../logger.mjs";
3+
import { window, commands } from "vscode";
4+
import { rimraf } from "rimraf";
5+
import { join } from "path";
6+
import { homedir } from "os";
7+
import { unknownErrorToString } from "../utils/errorHelper.mjs";
8+
import { openOCDVersion } from "../webview/newProjectPanel.mjs";
9+
10+
export default class UpdateOpenOCDCommand extends Command {
11+
private _logger: Logger = new Logger("UpdateOpenOCDCommand");
12+
13+
public static readonly id = "updateOpenOCD";
14+
15+
constructor() {
16+
super(UpdateOpenOCDCommand.id);
17+
}
18+
19+
async execute(): Promise<void> {
20+
// uninstall OpenOCD then reload to install the latest version
21+
this._logger.info("Updating OpenOCD...");
22+
23+
try {
24+
// rimraf ~/.pico-sdk/openocd/$openOCDVersion
25+
await rimraf(join(homedir(), ".pico-sdk/openocd", openOCDVersion), {
26+
preserveRoot: false,
27+
maxRetries: 1,
28+
retryDelay: 1000,
29+
});
30+
31+
this._logger.info("OpenOCD uninstalled successfully - reloading window");
32+
void window.showInformationMessage(
33+
"OpenOCD uninstalled successfully - reloading window"
34+
);
35+
36+
// reload window to install the latest version
37+
void commands.executeCommand("workbench.action.reloadWindow");
38+
} catch (error) {
39+
this._logger.error(
40+
"Failed to update OpenOCD",
41+
unknownErrorToString(error)
42+
);
43+
void window.showErrorMessage("Failed to update OpenOCD");
44+
45+
return;
46+
}
47+
}
48+
}

src/extension.mts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ import { homedir } from "os";
7777
import NewExampleProjectCommand from "./commands/newExampleProject.mjs";
7878
import SwitchBoardCommand from "./commands/switchBoard.mjs";
7979
import UninstallPicoSDKCommand from "./commands/uninstallPicoSDK.mjs";
80+
import UpdateOpenOCDCommand from "./commands/updateOpenOCD.mjs";
8081
import FlashProjectSWDCommand from "./commands/flashProjectSwd.mjs";
8182
// eslint-disable-next-line max-len
8283
import { NewMicroPythonProjectPanel } from "./webview/newMicroPythonProjectPanel.mjs";
@@ -130,6 +131,7 @@ export async function activate(context: ExtensionContext): Promise<void> {
130131
new NewExampleProjectCommand(context.extensionUri),
131132
new UninstallPicoSDKCommand(),
132133
new CleanCMakeCommand(ui),
134+
new UpdateOpenOCDCommand(),
133135
];
134136

135137
// register all command handlers

src/utils/download.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const PICOTOOL_RELEASES: { [key: string]: string } = {
8686
/// Release tags for openocd
8787
const OPENOCD_RELEASES: { [key: string]: string } = {
8888
// eslint-disable-next-line @typescript-eslint/naming-convention
89-
"0.12.0+dev": "v2.0.0-5",
89+
"0.12.0+dev": "v2.1.1-2",
9090
};
9191

9292
/// Translate nodejs platform names to cmake platform names

0 commit comments

Comments
 (0)