diff options
Diffstat (limited to 'cortex-m-rt/src/lib.rs')
-rw-r--r-- | cortex-m-rt/src/lib.rs | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/cortex-m-rt/src/lib.rs b/cortex-m-rt/src/lib.rs index e55171a..60c8034 100644 --- a/cortex-m-rt/src/lib.rs +++ b/cortex-m-rt/src/lib.rs @@ -390,7 +390,7 @@ extern crate r0; -use core::fmt; +use core::{fmt, ptr}; /// Registers stacked (pushed into the stack) during an exception #[derive(Clone, Copy)] @@ -511,6 +511,26 @@ pub unsafe extern "C" fn Reset() -> ! { } } +#[doc(hidden)] +#[no_mangle] +pub unsafe extern "C" fn DefaultDefaultHandler() { + loop { + // add some side effect to prevent this from turning into a UDF instruction + // see rust-lang/rust#28728 + ptr::read_volatile(&0u8); + } +} + +#[doc(hidden)] +#[no_mangle] +pub unsafe extern "C" fn DefaultUserHardFault() { + loop { + // add some side effect to prevent this from turning into a UDF instruction + // see rust-lang/rust#28728 + ptr::read_volatile(&0u8); + } +} + /// Macro to define the entry point of the program /// /// **NOTE** This macro must be invoked once and must be invoked from an accessible module, ideally |