diff --git a/boards/dk/src/lib.rs b/boards/dk/src/lib.rs index 508f66c..eb7daa9 100644 --- a/boards/dk/src/lib.rs +++ b/boards/dk/src/lib.rs @@ -323,6 +323,7 @@ fn RTC0() { /// Exits the application when the program is executed through the `probe-run` Cargo runner pub fn exit() -> ! { + unsafe { (0x4002_7504 as *mut u32).write_volatile(0) } log::info!("`dk::exit() called; exiting ...`"); // force any pending memory operation to complete before the BKPT instruction that follows atomic::compiler_fence(Ordering::SeqCst); diff --git a/common/panic-log/src/lib.rs b/common/panic-log/src/lib.rs index 5a08462..109a957 100644 --- a/common/panic-log/src/lib.rs +++ b/common/panic-log/src/lib.rs @@ -6,6 +6,8 @@ use cortex_m::asm; #[panic_handler] fn panic(info: &PanicInfo) -> ! { + unsafe { (0x4002_7504 as *mut u32).write_volatile(0) } + log::error!("{}", info); // abort instruction: triggers a HardFault exception which causes probe-run to exit