Fix VSCode launch config

This commit is contained in:
2025-10-19 18:28:33 +02:00
parent 1f3162dc6f
commit 53c97dcb32
4 changed files with 44 additions and 19 deletions

16
.vscode/launch.json vendored
View File

@@ -14,7 +14,7 @@
"cwd": "${workspaceRoot}", "cwd": "${workspaceRoot}",
"preLaunchTask": "Cargo Build (debug)", "preLaunchTask": "Cargo Build (debug)",
"runToEntryPoint": "main", "runToEntryPoint": "main",
"executable": "./target/thumbv7m-none-eabi/debug/{{project-name}}", "executable": "./target/thumbv7m-none-eabi/debug/embedded-rs",
/* Run `cargo build --example hello` and uncomment this line to run semi-hosting example */ /* Run `cargo build --example hello` and uncomment this line to run semi-hosting example */
//"executable": "./target/thumbv7m-none-eabi/debug/examples/hello", //"executable": "./target/thumbv7m-none-eabi/debug/examples/hello",
"cpu": "cortex-m3", "cpu": "cortex-m3",
@@ -29,7 +29,7 @@
"cwd": "${workspaceRoot}", "cwd": "${workspaceRoot}",
"preLaunchTask": "Cargo Build (debug)", "preLaunchTask": "Cargo Build (debug)",
"runToEntryPoint": "main", "runToEntryPoint": "main",
"executable": "./target/thumbv7em-none-eabihf/debug/{{project-name}}", "executable": "./target/thumbv7em-none-eabihf/debug/embedded-rs",
/* Run `cargo build --example itm` and uncomment this line to run itm example */ /* Run `cargo build --example itm` and uncomment this line to run itm example */
// "executable": "./target/thumbv7em-none-eabihf/debug/examples/itm", // "executable": "./target/thumbv7em-none-eabihf/debug/examples/itm",
"device": "STM32F303VCT6", "device": "STM32F303VCT6",
@@ -44,9 +44,17 @@
"swoFrequency": 2000000, "swoFrequency": 2000000,
"source": "probe", "source": "probe",
"decoders": [ "decoders": [
{ "type": "console", "label": "ITM", "port": 0 } {
] "type": "console",
"label": "ITM",
"port": 0
} }
]
},
"gdbPath": "gdb",
"postLaunchCommands": [
"monitor arm semihosting enable"
]
} }
] ]
} }

34
.vscode/tasks.json vendored
View File

@@ -10,9 +10,11 @@
* so we can invoke it from the debug launcher. * so we can invoke it from the debug launcher.
*/ */
"label": "Cargo Build (debug)", "label": "Cargo Build (debug)",
"type": "process", "type": "shell",
"command": "cargo", "command": "cargo",
"args": ["build"], "args": [
"build"
],
"problemMatcher": [ "problemMatcher": [
"$rustc" "$rustc"
], ],
@@ -23,9 +25,12 @@
}, },
{ {
"label": "Cargo Build (release)", "label": "Cargo Build (release)",
"type": "process", "type": "shell",
"command": "cargo", "command": "cargo",
"args": ["build", "--release"], "args": [
"build",
"--release"
],
"problemMatcher": [ "problemMatcher": [
"$rustc" "$rustc"
], ],
@@ -34,8 +39,11 @@
{ {
"label": "Cargo Build Examples (debug)", "label": "Cargo Build Examples (debug)",
"type": "process", "type": "process",
"command": "cargo", "command": "shell",
"args": ["build","--examples"], "args": [
"build",
"--examples"
],
"problemMatcher": [ "problemMatcher": [
"$rustc" "$rustc"
], ],
@@ -43,9 +51,13 @@
}, },
{ {
"label": "Cargo Build Examples (release)", "label": "Cargo Build Examples (release)",
"type": "process", "type": "shell",
"command": "cargo", "command": "cargo",
"args": ["build","--examples", "--release"], "args": [
"build",
"--examples",
"--release"
],
"problemMatcher": [ "problemMatcher": [
"$rustc" "$rustc"
], ],
@@ -53,9 +65,11 @@
}, },
{ {
"label": "Cargo Clean", "label": "Cargo Clean",
"type": "process", "type": "shell",
"command": "cargo", "command": "cargo",
"args": ["clean"], "args": [
"clean"
],
"problemMatcher": [], "problemMatcher": [],
"group": "build" "group": "build"
}, },

View File

@@ -10,6 +10,7 @@ cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
cortex-m-rt = "0.7" cortex-m-rt = "0.7"
cortex-m-semihosting = "0.5" cortex-m-semihosting = "0.5"
panic-halt = "1.0.0" panic-halt = "1.0.0"
panic-semihosting = "0.6"
stm32f3 = { version = "0.16.0", features = ["stm32f303"] } stm32f3 = { version = "0.16.0", features = ["stm32f303"] }
stm32f3xx-hal = { version = "0.10.0", features = ["stm32f303xc"] } stm32f3xx-hal = { version = "0.10.0", features = ["stm32f303xc"] }

View File

@@ -3,11 +3,12 @@
use core::fmt::Write; use core::fmt::Write;
use cortex_m_semihosting::hprintln;
// pick a panicking behavior // pick a panicking behavior
use panic_halt as _; // you can put a breakpoint on `rust_begin_unwind` to catch panics // use panic_halt as _; // you can put a breakpoint on `rust_begin_unwind` to catch panics
// use panic_abort as _; // requires nightly // use panic_abort as _; // requires nightly
// use panic_itm as _; // logs messages over ITM; requires ITM support // use panic_itm as _; // logs messages over ITM; requires ITM support
// use panic_semihosting as _; // logs messages to the host stderr; requires a debugger use panic_semihosting as _; // logs messages to the host stderr; requires a debugger
use cortex_m::peripheral::{syst, Peripherals}; use cortex_m::peripheral::{syst, Peripherals};
use cortex_m_rt::entry; use cortex_m_rt::entry;
@@ -67,5 +68,6 @@ fn main() -> ! {
ld4.toggle().unwrap(); ld4.toggle().unwrap();
ld5.toggle().unwrap(); ld5.toggle().unwrap();
uart.write_str("Loop\r\n").unwrap(); uart.write_str("Loop\r\n").unwrap();
hprintln!("Loop");
} }
} }