by twic · 10y ago · 0 comments
#[lang = "eh_personality"] extern fn eh_personality() {}
#[lang = "panic_fmt"] extern fn panic_fmt() -> ! { loop {} }
But it's a little unsatisfying.What does eh_personality actually do, and how would you write a 'real' implementation?
I can guess what panic_fmt is for, but exactly what is it supposed to do, and how would you write a 'real' implementation?
#[lang = "panic_fmt"]
extern fn panic_fmt(details: ::core::fmt::Arguments, file: &'static str, line: u32) -> ! {
println!("Panic at {}:{}, {}", file, line, details);
let row_2 = ::gpio::Pin::output(::pins::ROW_2);
let col_3 = ::gpio::Pin::output(::pins::COL_3);
row_2.set_high();
loop {
col_3.set_low();
::busy_loop::wait_approx_ms(5);
col_3.set_high();
::busy_loop::wait_approx_ms(200);
}
}
Note that println! is a macro I defined myself, it writes to the serial port.I still don’t know about eh_personality, though.
http://stackoverflow.com/questions/16597350/what-is-an-excep...
It should be removable with aborting panic.