Skip to content
Snippets Groups Projects
Commit 31dff2f6 authored by Per's avatar Per
Browse files

panic_fmt

parent a94c8b10
No related branches found
No related tags found
No related merge requests found
...@@ -25,8 +25,11 @@ ...@@ -25,8 +25,11 @@
"label": "Name", "label": "Name",
"port": 0 "port": 0
} }
] ],
}, },
"postLaunchCommands": [
"monitor arm semihosting enable",
],
"cwd": "${workspaceRoot}", "cwd": "${workspaceRoot}",
}, },
{ {
......
...@@ -33,10 +33,10 @@ version = "0.5.0" ...@@ -33,10 +33,10 @@ version = "0.5.0"
version = "0.3.0" version = "0.3.0"
[dependencies.panic-abort] [dependencies.panic-abort]
version = "0.1.1" version = "0.2.0"
[dependencies.panic-semihosting] [dependencies.panic-semihosting]
version = "0.2.0" version = "0.3.0"
[dependencies.stm32f40x] [dependencies.stm32f40x]
path = "../STM32F40x" path = "../STM32F40x"
......
//! Prints "Hello, world!" on the OpenOCD console using semihosting //! Prints "Hello, world!" on the OpenOCD console using semihosting
//! //!
//! --- //! ---
#![feature(panic_implementation)]
#![no_main] #![no_main]
#![no_std] #![no_std]
...@@ -24,8 +24,8 @@ fn main() -> ! { ...@@ -24,8 +24,8 @@ fn main() -> ! {
writeln!(stdout, "Hello, world!").unwrap(); writeln!(stdout, "Hello, world!").unwrap();
panic!("panic"); panic!("panic");
loop {}
// loop {}
// panic!("panic"); // panic!("panic");
} }
...@@ -40,3 +40,11 @@ exception!(*, default_handler); ...@@ -40,3 +40,11 @@ exception!(*, default_handler);
fn default_handler(irqn: i16) { fn default_handler(irqn: i16) {
panic!("Unhandled exception (IRQn = {})", irqn); panic!("Unhandled exception (IRQn = {})", irqn);
} }
// use core::intrinsics;
// use core::panic::PanicInfo;
// #[panic_implementation]
// fn panic(_info: &PanicInfo) -> ! {
// unsafe { intrinsics::abort() }
// }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment