Skip to content

Commit f8a5901

Browse files
committed
rust: zephyr: use printkln for panic messages
If we have printk enabled, use that to output the desperation panic message when panic is called from Rust code. Signed-off-by: David Brown <[email protected]>
1 parent 1cc831d commit f8a5901

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

zephyr/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ use core::panic::PanicInfo;
2727

2828
/// Override rust's panic. This simplistic initial version just hangs in a loop.
2929
#[panic_handler]
30-
fn panic(_ :&PanicInfo) -> ! {
30+
fn panic(info :&PanicInfo) -> ! {
31+
#[cfg(CONFIG_PRINTK)]
32+
{
33+
printkln!("panic: {}", info);
34+
}
35+
let _ = info;
3136
loop {
3237
}
3338
}

0 commit comments

Comments
 (0)