diff --git a/.vscode/launch.json b/.vscode/launch.json index 969be682722c708d5b4f9840b93dfeb141c1d7b3..c47ee0726c74eab0ac5e52df74a343c2d42c5267 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -25,8 +25,11 @@ "label": "Name", "port": 0 } - ] + ], }, + "postLaunchCommands": [ + "monitor arm semihosting enable", + ], "cwd": "${workspaceRoot}", }, { diff --git a/Cargo.toml b/Cargo.toml index 88498d4cac4a9557c9385f481293a4b44037ab98..8f7795086f17de78a14608c117b5704a951b2db6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,10 +33,10 @@ version = "0.5.0" version = "0.3.0" [dependencies.panic-abort] -version = "0.1.1" +version = "0.2.0" [dependencies.panic-semihosting] -version = "0.2.0" +version = "0.3.0" [dependencies.stm32f40x] path = "../STM32F40x" diff --git a/examples/hello.rs b/examples/hello.rs index e0da305ac2e07ed77564dbfebc32abeddd4e06d4..f3fb233aa1b17b26700fa466ae2793284106dbd2 100644 --- a/examples/hello.rs +++ b/examples/hello.rs @@ -1,7 +1,7 @@ //! Prints "Hello, world!" on the OpenOCD console using semihosting //! //! --- - +#![feature(panic_implementation)] #![no_main] #![no_std] @@ -24,8 +24,8 @@ fn main() -> ! { writeln!(stdout, "Hello, world!").unwrap(); panic!("panic"); - loop {} + // loop {} // panic!("panic"); } @@ -40,3 +40,11 @@ exception!(*, default_handler); fn default_handler(irqn: i16) { panic!("Unhandled exception (IRQn = {})", irqn); } + +// use core::intrinsics; +// use core::panic::PanicInfo; + +// #[panic_implementation] +// fn panic(_info: &PanicInfo) -> ! { +// unsafe { intrinsics::abort() } +// }