diff --git a/src/main.rs b/src/main.rs index b0a7ab4a..346ce973 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,6 +5,7 @@ #![feature(naked_functions)] #![feature(never_type)] #![feature(alloc_error_handler)] +#![feature(panic_info_message)] // TODO: disallow unused/dead_code when code moves into a lib crate #![allow(dead_code)] diff --git a/src/panic.rs b/src/panic.rs index f637b597..f8e3493e 100644 --- a/src/panic.rs +++ b/src/panic.rs @@ -1,8 +1,18 @@ -use crate::{println, zynq}; +use crate::{print, println, zynq}; #[panic_handler] fn panic(info: &core::panic::PanicInfo) -> ! { - println!("\nPanic: {}", info); + print!("panic at "); + if let Some(location) = info.location() { + print!("{}:{}:{}", location.file(), location.line(), location.column()); + } else { + print!("unknown location"); + } + if let Some(message) = info.message() { + println!(": {}", message); + } else { + println!(""); + } zynq::slcr::RegisterBlock::unlocked(|slcr| slcr.soft_reset()); loop {}