1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
//! Panicking support. use {itm, mcu}; use core::fmt; /// Panic handler. /// /// It attempts to write a panic message to ITM and resets the device. #[cfg_attr(feature = "clippy", allow(empty_loop))] #[linkage = "weak"] #[lang = "panic_fmt"] unsafe extern "C" fn begin( args: fmt::Arguments, file: &'static str, line: u32, _col: u32, ) -> ! { print!("panicked at '"); itm::write_fmt(args); println!("', {}:{}", file, line); itm::flush(); mcu::reset_request(); loop {} }