From 2e4c43d9082fab733d3fd7fce3dd5668b808d713 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Mon, 31 Aug 2020 16:01:57 +0200 Subject: [PATCH] Use panic-probe instead of a custom panic handler --- Cargo.toml | 4 ++++ src/lib.rs | 19 +------------------ 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2eb1015..c976936 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/src/lib.rs b/src/lib.rs index fe7ff1f..52eb1bc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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 {