Merge pull request #8 from knurling-rs/panic-probe
Use panic-probe instead of a custom panic handler
This commit is contained in:
@@ -13,6 +13,10 @@ branch = "main"
|
|||||||
git = "https://github.com/knurling-rs/defmt"
|
git = "https://github.com/knurling-rs/defmt"
|
||||||
branch = "main"
|
branch = "main"
|
||||||
|
|
||||||
|
[dependencies.panic-probe]
|
||||||
|
git = "https://github.com/knurling-rs/probe-run"
|
||||||
|
branch = "main"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cortex-m = "0.6.3"
|
cortex-m = "0.6.3"
|
||||||
cortex-m-rt = "0.6.12"
|
cortex-m-rt = "0.6.12"
|
||||||
|
|||||||
+1
-18
@@ -3,7 +3,7 @@
|
|||||||
use core::sync::atomic::{AtomicUsize, Ordering};
|
use core::sync::atomic::{AtomicUsize, Ordering};
|
||||||
|
|
||||||
use defmt_rtt as _; // global logger
|
use defmt_rtt as _; // global logger
|
||||||
|
use panic_probe as _;
|
||||||
// TODO(5) adjust HAL import
|
// TODO(5) adjust HAL import
|
||||||
// use some_hal as _; // memory layout
|
// use some_hal as _; // memory layout
|
||||||
|
|
||||||
@@ -16,23 +16,6 @@ fn timestamp() -> u64 {
|
|||||||
n as 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
|
/// Terminates the application and makes `probe-run` exit with exit-code = 0
|
||||||
pub fn exit() -> ! {
|
pub fn exit() -> ! {
|
||||||
loop {
|
loop {
|
||||||
|
|||||||
Reference in New Issue
Block a user