Add abort & update panic handler
This commit is contained in:
parent
c70be3fe1f
commit
6b697a4ca5
22
src/main.rs
22
src/main.rs
|
@ -96,12 +96,24 @@ extern "C" fn start() -> ! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[panic_handler]
|
#[no_mangle]
|
||||||
fn on_panic(info: &PanicInfo) -> ! {
|
extern "C" fn eh_personality() {}
|
||||||
// print panic info and hang
|
|
||||||
println!("{}", info);
|
|
||||||
|
|
||||||
loop {}
|
#[panic_handler]
|
||||||
|
fn panic(info: &PanicInfo) -> ! {
|
||||||
|
// print panic info and abort
|
||||||
|
println!("{}", info);
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
extern "C" fn abort() -> ! {
|
||||||
|
use core::arch::asm;
|
||||||
|
loop {
|
||||||
|
unsafe {
|
||||||
|
asm!("wfi");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO unit testing
|
// TODO unit testing
|
||||||
|
|
Loading…
Reference in a new issue