mirror of
https://github.com/ferrous-systems/embedded-trainings-2020.git
synced 2024-06-10 09:29:26 +00:00
disconnect USB from host on exit/panic
This commit is contained in:
parent
8b15469bd3
commit
e9dee61072
|
@ -323,6 +323,7 @@ fn RTC0() {
|
||||||
|
|
||||||
/// Exits the application when the program is executed through the `probe-run` Cargo runner
|
/// Exits the application when the program is executed through the `probe-run` Cargo runner
|
||||||
pub fn exit() -> ! {
|
pub fn exit() -> ! {
|
||||||
|
unsafe { (0x4002_7504 as *mut u32).write_volatile(0) }
|
||||||
log::info!("`dk::exit() called; exiting ...`");
|
log::info!("`dk::exit() called; exiting ...`");
|
||||||
// force any pending memory operation to complete before the BKPT instruction that follows
|
// force any pending memory operation to complete before the BKPT instruction that follows
|
||||||
atomic::compiler_fence(Ordering::SeqCst);
|
atomic::compiler_fence(Ordering::SeqCst);
|
||||||
|
|
|
@ -6,6 +6,8 @@ use cortex_m::asm;
|
||||||
|
|
||||||
#[panic_handler]
|
#[panic_handler]
|
||||||
fn panic(info: &PanicInfo) -> ! {
|
fn panic(info: &PanicInfo) -> ! {
|
||||||
|
unsafe { (0x4002_7504 as *mut u32).write_volatile(0) }
|
||||||
|
|
||||||
log::error!("{}", info);
|
log::error!("{}", info);
|
||||||
|
|
||||||
// abort instruction: triggers a HardFault exception which causes probe-run to exit
|
// abort instruction: triggers a HardFault exception which causes probe-run to exit
|
||||||
|
|
Loading…
Reference in a new issue