Use panic-probe instead of a custom panic handler

This commit is contained in:
Jonas Schievink
2020-08-31 16:01:57 +02:00
parent cab03b1ab1
commit 2e4c43d908
2 changed files with 5 additions and 18 deletions
+4
View File
@@ -13,6 +13,10 @@ branch = "main"
git = "https://github.com/knurling-rs/defmt"
branch = "main"
[dependencies.panic-probe]
git = "https://github.com/knurling-rs/probe-run"
branch = "main"
[dependencies]
cortex-m = "0.6.3"
cortex-m-rt = "0.6.12"
+1 -18
View File
@@ -3,7 +3,7 @@
use core::sync::atomic::{AtomicUsize, Ordering};
use defmt_rtt as _; // global logger
use panic_probe as _;
// TODO(5) adjust HAL import
// use some_hal as _; // memory layout
@@ -16,23 +16,6 @@ fn timestamp() -> u64 {
n as u64
}
#[panic_handler] // panicking behavior
fn panic(info: &core::panic::PanicInfo) -> ! {
if let Some(loc) = info.location() {
defmt::error!(
"panicked at {:str}:{:u32}:{:u32}",
loc.file(),
loc.line(),
loc.column()
)
} else {
// no location info
defmt::error!("panicked")
}
exit()
}
/// Terminates the application and makes `probe-run` exit with exit-code = 0
pub fn exit() -> ! {
loop {