From 31dff2f61bcf91e644e905cc72b16f9365d70e35 Mon Sep 17 00:00:00 2001 From: Per <Per Lindgren> Date: Mon, 4 Jun 2018 15:22:17 +0200 Subject: [PATCH] panic_fmt --- .vscode/launch.json | 5 ++++- Cargo.toml | 4 ++-- examples/hello.rs | 12 ++++++++++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 969be68..c47ee07 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 88498d4..8f77950 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 e0da305..f3fb233 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() } +// } -- GitLab