Skip to content

Commit 7299c94

Browse files
authored
Merge pull request #96 from raspberrypi/rustup-support
Rustup support
2 parents 2befb2f + 1892acc commit 7299c94

28 files changed

+4491
-1343
lines changed

README.md

Lines changed: 141 additions & 132 deletions
Large diffs are not rendered by default.

package-lock.json

Lines changed: 62 additions & 966 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
},
6666
"activationEvents": [
6767
"workspaceContains:./pico_sdk_import.cmake",
68+
"workspaceContains:./.pico-rs",
6869
"onWebviewPanel:newPicoProject",
6970
"onWebviewPanel:newPicoMicroPythonProject"
7071
],
@@ -79,20 +80,26 @@
7980
"command": "raspberry-pi-pico.switchSDK",
8081
"title": "Switch Pico SDK",
8182
"category": "Raspberry Pi Pico",
82-
"enablement": "raspberry-pi-pico.isPicoProject"
83+
"enablement": "raspberry-pi-pico.isPicoProject && !raspberry-pi-pico.isRustProject"
8384
},
8485
{
8586
"command": "raspberry-pi-pico.switchBoard",
8687
"title": "Switch Board",
8788
"category": "Raspberry Pi Pico",
88-
"enablement": "raspberry-pi-pico.isPicoProject"
89+
"enablement": "raspberry-pi-pico.isPicoProject && !raspberry-pi-pico.isRustProject"
8990
},
9091
{
9192
"command": "raspberry-pi-pico.launchTargetPath",
9293
"title": "Get path of the project executable",
9394
"category": "Raspberry Pi Pico",
9495
"enablement": "false"
9596
},
97+
{
98+
"command": "raspberry-pi-pico.launchTargetPathRelease",
99+
"title": "Get path of the project release executable (rust only)",
100+
"category": "Raspberry Pi Pico",
101+
"enablement": "false"
102+
},
96103
{
97104
"command": "raspberry-pi-pico.getPythonPath",
98105
"title": "Get python path",
@@ -147,6 +154,18 @@
147154
"category": "Raspberry Pi Pico",
148155
"enablement": "false"
149156
},
157+
{
158+
"command": "raspberry-pi-pico.getOpenOCDRoot",
159+
"title": "Get OpenOCD root",
160+
"category": "Raspberry Pi Pico",
161+
"enablement": "false"
162+
},
163+
{
164+
"command": "raspberry-pi-pico.getSVDPath",
165+
"title": "Get SVD Path (rust only)",
166+
"category": "Raspberry Pi Pico",
167+
"enablement": "false"
168+
},
150169
{
151170
"command": "raspberry-pi-pico.compileProject",
152171
"title": "Compile Pico Project",
@@ -185,13 +204,13 @@
185204
"command": "raspberry-pi-pico.configureCmake",
186205
"title": "Configure CMake",
187206
"category": "Raspberry Pi Pico",
188-
"enablement": "raspberry-pi-pico.isPicoProject"
207+
"enablement": "raspberry-pi-pico.isPicoProject && !raspberry-pi-pico.isRustProject"
189208
},
190209
{
191210
"command": "raspberry-pi-pico.switchBuildType",
192211
"title": "Switch Build Type",
193212
"category": "Raspberry Pi Pico",
194-
"enablement": "raspberry-pi-pico.isPicoProject"
213+
"enablement": "raspberry-pi-pico.isPicoProject && !raspberry-pi-pico.isRustProject"
195214
},
196215
{
197216
"command": "raspberry-pi-pico.importProject",
@@ -217,13 +236,31 @@
217236
"command": "raspberry-pi-pico.flashProject",
218237
"title": "Flash Pico Project (SWD)",
219238
"category": "Raspberry Pi Pico",
220-
"enablement": "raspberry-pi-pico.isPicoProject"
239+
"enablement": "raspberry-pi-pico.isPicoProject && !raspberry-pi-pico.isRustProject"
221240
},
222241
{
223242
"command": "raspberry-pi-pico.cleanCmake",
224243
"title": "Clean CMake",
225244
"category": "Raspberry Pi Pico",
226245
"enablement": "raspberry-pi-pico.isPicoProject && !raspberry-pi-pico.isRustProject"
246+
},
247+
{
248+
"command": "raspberry-pi-pico.getRTTDecoderPath",
249+
"title": "Get RTT Decoder module path",
250+
"category": "Raspberry Pi Pico",
251+
"enablement": "false"
252+
},
253+
{
254+
"command": "raspberry-pi-pico.sbomTargetPathDebug",
255+
"title": "Get path of the project debug SBOM (rust only)",
256+
"category": "Raspberry Pi Pico",
257+
"enablement": "false"
258+
},
259+
{
260+
"command": "raspberry-pi-pico.sbomTargetPathRelease",
261+
"title": "Get path of the project release SBOM (rust only)",
262+
"category": "Raspberry Pi Pico",
263+
"enablement": "false"
227264
}
228265
],
229266
"configuration": {
@@ -331,6 +368,7 @@
331368
"got": "^14.4.7",
332369
"ini": "^5.0.0",
333370
"rimraf": "^6.0.1",
371+
"toml": "^3.0.0",
334372
"undici": "^6.21.0",
335373
"uuid": "^11.1.0",
336374
"which": "^5.0.0"

src/commands/compileProject.mts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import { EventEmitter } from "events";
33
import { CommandWithResult } from "./command.mjs";
44
import Logger from "../logger.mjs";
55
import Settings, { SettingsKey } from "../settings.mjs";
6+
import State from "../state.mjs";
67
import { cmakeToolsForcePicoKit } from "../utils/cmakeToolsUtil.mjs";
8+
79
export default class CompileProjectCommand extends CommandWithResult<boolean> {
810
private _logger: Logger = new Logger("CompileProjectCommand");
911

@@ -14,13 +16,18 @@ export default class CompileProjectCommand extends CommandWithResult<boolean> {
1416
}
1517

1618
async execute(): Promise<boolean> {
19+
const isRustProject = State.getInstance().isRustProject;
20+
1721
// Get the task with the specified name
1822
const task = (await tasks.fetchTasks()).find(
19-
task => task.name === "Compile Project"
23+
task =>
24+
task.name ===
25+
(isRustProject ? "Build + Generate SBOM (release)" : "Compile Project")
2026
);
2127

2228
const settings = Settings.getInstance();
2329
if (
30+
!isRustProject &&
2431
settings !== undefined &&
2532
settings.getBoolean(SettingsKey.useCmakeTools)
2633
) {

src/commands/conditionalDebugging.mts

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import { Command } from "./command.mjs";
1+
import { Command, extensionName } from "./command.mjs";
22
import Logger from "../logger.mjs";
3-
import { commands } from "vscode";
3+
import { commands, window, workspace, debug } from "vscode";
4+
import State from "../state.mjs";
5+
import DebugLayoutCommand from "./debugLayout.mjs";
46

57
/**
68
* Relay command for the default buildin debug select and start command.
@@ -16,6 +18,23 @@ export default class ConditionalDebuggingCommand extends Command {
1618
}
1719

1820
async execute(): Promise<void> {
21+
const isRustProject = State.getInstance().isRustProject;
22+
23+
if (isRustProject) {
24+
const wsFolder = workspace.workspaceFolders?.[0];
25+
if (!wsFolder) {
26+
this._logger.error("No workspace folder found.");
27+
void window.showErrorMessage("No workspace folder found.");
28+
29+
return;
30+
}
31+
32+
void commands.executeCommand(`${extensionName}.${DebugLayoutCommand.id}`);
33+
void debug.startDebugging(wsFolder, "Pico Debug (probe-rs)");
34+
35+
return;
36+
}
37+
1938
await commands.executeCommand("workbench.action.debug.selectandstart");
2039
}
2140
}

0 commit comments

Comments
 (0)