embedded-trainings-2020/common/panic-log/src/lib.rs

16 lines
307 B
Rust
Raw Normal View History

2020-06-09 09:52:27 +00:00
#![no_std]
use core::panic::PanicInfo;
use cortex_m::asm;
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
2022-01-12 15:17:20 +00:00
unsafe { (0x4002_7504 as *mut u32).write_volatile(0) }
2020-06-09 09:52:27 +00:00
log::error!("{}", info);
// abort instruction: triggers a HardFault exception which causes probe-run to exit
asm::udf()
2020-06-09 09:52:27 +00:00
}