diff --git a/.vscode/launch.json b/.vscode/launch.json index 4d3db06af30967169546cbc8aacc1d56347bac14..e18bfd57d36b1ede983267ec3c832da6aeae7ad8 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -73,15 +73,14 @@ "request": "attach", "name": "Debug itm", "gdbpath": "/usr/bin/arm-none-eabi-gdb", - //"executable": "./target/thumbv7em-none-eabihf/debug/nucleo", + "executable": "./target/thumbv7em-none-eabihf/debug/examples/itm", "target": ":3333", "remote": true, "autorun": [ "monitor reset init", - //"monitor arm semihosting enable", - "monitor tpiu config internal /tmp/itm.fifo uart off 64000000", - //"monitor tpiu config internal /tmp/itm.fifo uart off 16000000", - "file ./target/thumbv7em-none-eabihf/debug/examples/itm", + "monitor arm semihosting enable", + "monitor tpiu config internal /tmp/itm.log uart off 16000000 2000000", + "monitor itm port 0 on", "load" ], "cwd": "${workspaceRoot}" @@ -101,6 +100,22 @@ "load" ], "cwd": "${workspaceRoot}" + }, + { + "type": "gdb", + "request": "attach", + "name": "Debug panic", + "gdbpath": "/usr/bin/arm-none-eabi-gdb", + //"executable": "./target/thumbv7em-none-eabihf/debug/nucleo", + "target": ":3333", + "remote": true, + "autorun": [ + "monitor reset init", + "monitor arm semihosting enable", + "file ./target/thumbv7em-none-eabihf/debug/examples/panic", + "load" + ], + "cwd": "${workspaceRoot}" } ] } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 33cf0d3d09cacac47287d179f3ee96e4f7654e55..78bd10c802756e982ed8772d6ed5b2d6918567b2 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -74,6 +74,18 @@ "problemMatcher": [ "$rustc" ] + }, + { + "taskName": "xargo build --example panic", + "type": "shell", + "command": "xargo build --example panic", + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": [ + "$rustc" + ] } ] } \ No newline at end of file diff --git a/examples/itm.rs b/examples/itm.rs index 4159c43c31bef75251ee5ea9ab236191ff4a6324..d0f50f272784cbade18b0a31212600fd451b08ec 100644 --- a/examples/itm.rs +++ b/examples/itm.rs @@ -27,6 +27,7 @@ fn main() { let itm = peripheral::ITM.borrow(&cs); iprintln!(&itm.stim[0], "Hello, world!"); + loop {} }); } diff --git a/examples/panic.rs b/examples/panic.rs index a85f42579a46a30184fd5a5f875396204369313b..bb2183a3f9a421dc7b01521830f1f86e24dbf418 100644 --- a/examples/panic.rs +++ b/examples/panic.rs @@ -11,6 +11,7 @@ #![feature(core_intrinsics)] #![feature(lang_items)] #![feature(used)] +#![allow(private_no_mangle_fns)] #![no_std] extern crate cortex_m; @@ -33,7 +34,7 @@ unsafe extern "C" fn rust_begin_unwind( args: core::fmt::Arguments, file: &'static str, line: u32, - col: u32, + _col: u32, ) -> ! { if let Ok(mut stdout) = hio::hstdout() { write!(stdout, "panicked at '")