Add a basic VSCode configuration for probe-rs-debugger (#29)

* Add a basic VSCode configuration for probe-rs-debugger

* VSCode: have launch build first and use debug binary

* Got defmt working in vs-code-debugger

* Add VSCode debugger setup to README
This commit is contained in:
9names 2022-06-29 11:58:46 +10:00 committed by GitHub
parent be0c18130e
commit 2cadd4df41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 63 additions and 0 deletions

45
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,45 @@
// The format of this file is specified in https://probe.rs/docs/tools/vscode/#start-a-debug-session-with-minimum-configuration
{
"version": "0.2.0",
"configurations": [
{
"preLaunchTask": "rust: cargo build",
"type": "probe-rs-debug",
"request": "launch",
"name": "rp2040-project",
"cwd": "${workspaceFolder}",
"chip": "rp2040",
// RP2040 doesn't support connectUnderReset
"connectUnderReset": false,
"speed": 4000,
"runtimeExecutable": "probe-rs-debugger",
"runtimeArgs": [
"debug"
],
"flashingConfig": {
"flashingEnabled": true,
"resetAfterFlashing": true,
"haltAfterReset": true,
},
"coreConfigs": [
{
"coreIndex": 0,
"programBinary": "target/thumbv6m-none-eabi/debug/rp2040-project-template",
"chip": "RP2040",
// Uncomment this if you've downloaded the SVD from
// https://github.com/raspberrypi/pico-sdk/raw/1.3.1/src/rp2040/hardware_regs/rp2040.svd
// and placed it in the .vscode directory
// "svdFile": "./.vscode/rp2040.svd",
"rttEnabled": true,
"options": {
"env": {
"DEFMT_LOG": "debug"
}
},
}
],
"consoleLogLevel": "Info", //Error, Warn, Info, Debug, Trace
"wireProtocol": "Swd"
}
]
}

View File

@ -153,6 +153,24 @@ Some of the options for your `runner` are listed below:
$ cargo run --release
```
* **probe-rs-debugger**
*Step 1* - Download [`probe-rs-debugger VSCode plugin 0.4.0`](https://github.com/probe-rs/vscode/releases/download/v0.4.0/probe-rs-debugger-0.4.0.vsix)
*Step 2* - Install `probe-rs-debugger VSCode plugin`
```console
$ code --install-extension probe-rs-debugger-0.4.0.vsix
```
*Step 3* - Install `probe-rs-debugger`
```console
$ cargo install --git https://github.com/probe-rs/probe-rs probe-rs-debugger
```
*Step 4* - Open this project in VSCode
*Step 5* - Launch a debug session by choosing `Run`>`Start Debugging` (or press F5)
* **Loading a UF2 over USB**
*Step 1* - Install [`elf2uf2-rs`](https://github.com/JoNil/elf2uf2-rs):