aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cortex-m-rt/Cargo.toml1
-rw-r--r--cortex-m-rt/link.x.in4
-rw-r--r--cortex-m-rt/src/lib.rs18
3 files changed, 13 insertions, 10 deletions
diff --git a/cortex-m-rt/Cargo.toml b/cortex-m-rt/Cargo.toml
index e831320..1cd9aaa 100644
--- a/cortex-m-rt/Cargo.toml
+++ b/cortex-m-rt/Cargo.toml
@@ -3,6 +3,7 @@ authors = ["Jorge Aparicio <jorge@japaric.io>"]
categories = ["embedded", "no-std"]
description = "Minimal runtime / startup for Cortex-M microcontrollers"
documentation = "https://docs.rs/cortex-m-rt"
+readme = "README.md"
keywords = ["arm", "cortex-m", "runtime", "startup"]
license = "MIT OR Apache-2.0"
name = "cortex-m-rt"
diff --git a/cortex-m-rt/link.x.in b/cortex-m-rt/link.x.in
index 23f406d..3d71811 100644
--- a/cortex-m-rt/link.x.in
+++ b/cortex-m-rt/link.x.in
@@ -45,8 +45,8 @@ PROVIDE(DebugMonitor = DefaultHandler);
PROVIDE(PendSV = DefaultHandler);
PROVIDE(SysTick = DefaultHandler);
-PROVIDE(DefaultHandler = DefaultDefaultHandler);
-PROVIDE(UserHardFault = DefaultUserHardFault);
+PROVIDE(DefaultHandler = DefaultHandler_);
+PROVIDE(UserHardFault = UserHardFault_);
/* # Interrupt vectors */
EXTERN(__INTERRUPTS); /* `static` variable similar to `__EXCEPTIONS` */
diff --git a/cortex-m-rt/src/lib.rs b/cortex-m-rt/src/lib.rs
index cecb5f8..599ae06 100644
--- a/cortex-m-rt/src/lib.rs
+++ b/cortex-m-rt/src/lib.rs
@@ -403,7 +403,8 @@
extern crate r0;
-use core::{fmt, ptr};
+use core::fmt;
+use core::sync::atomic::{self, Ordering};
/// Registers stacked (pushed into the stack) during an exception
#[derive(Clone, Copy)]
@@ -529,23 +530,24 @@ pub unsafe extern "C" fn Reset() -> ! {
}
}
+#[allow(unused_variables)]
#[doc(hidden)]
#[no_mangle]
-pub unsafe extern "C" fn DefaultDefaultHandler() {
+pub unsafe extern "C" fn UserHardFault_(ef: &ExceptionFrame) -> ! {
loop {
// add some side effect to prevent this from turning into a UDF instruction
- // see rust-lang/rust#28728
- ptr::read_volatile(&0u8);
+ // see rust-lang/rust#28728 for details
+ atomic::compiler_fence(Ordering::SeqCst);
}
}
#[doc(hidden)]
#[no_mangle]
-pub unsafe extern "C" fn DefaultUserHardFault() {
+pub unsafe extern "C" fn DefaultHandler_() -> ! {
loop {
// add some side effect to prevent this from turning into a UDF instruction
- // see rust-lang/rust#28728
- ptr::read_volatile(&0u8);
+ // see rust-lang/rust#28728 for details
+ atomic::compiler_fence(Ordering::SeqCst);
}
}
@@ -924,5 +926,5 @@ macro_rules! pre_init {
let f: unsafe fn() = $handler;
f();
}
- }
+ };
}