aboutsummaryrefslogtreecommitdiff
path: root/cortex-m-rt/src/lib.rs
diff options
context:
space:
mode:
authorGravatar bors[bot] <bors[bot]@users.noreply.github.com> 2018-11-14 00:47:24 +0000
committerGravatar bors[bot] <bors[bot]@users.noreply.github.com> 2018-11-14 00:47:24 +0000
commit27be42000ee0fb8a42313fef1d2c0f1ea7624510 (patch)
treee724114e97670a192fcdc6cbb2f14818e9a384bd /cortex-m-rt/src/lib.rs
parent3f2031c2889e7f6a581e476b8cf918f1cfa14de0 (diff)
parentb46b29f54f89bf1051505f1d53d53cca86c46196 (diff)
downloadcortex-m-27be42000ee0fb8a42313fef1d2c0f1ea7624510.tar.gz
cortex-m-27be42000ee0fb8a42313fef1d2c0f1ea7624510.tar.zst
cortex-m-27be42000ee0fb8a42313fef1d2c0f1ea7624510.zip
Merge #144
144: [RFC] rename UserHardFault to HardFault r=adamgreig a=japaric so it matches the exception name (`#[exception] fn HardFault(..`) Right now the symbol name of all exception handlers match the name of the function used with the `#[exception]` attribute *except* for `HardFault`, whose symbol name actually is `UserHardFault`. This PR corrects that inconsistency by renaming the `UserHardFault` symbol to `HardFault`, and the `HardFault` symbol to `HardFaultTrampoline`. This change doesn't break compilation or changes functionality but it does soft break GDB scripts that include the command `break UserHardFault` (e.g. the GDB script in cortex-m-quickstart) in the sense that the breakpoint will no longer work. However the rest of the GDB script will continue to work. RFC questions: (a) do we want to do this rename? (b) if the answer is yes, do we want to include this rename in the v0.5.x release, or should we consider it a breaking change and postpone it until v0.6.0? Co-authored-by: Jorge Aparicio <jorge@japaric.io>
Diffstat (limited to 'cortex-m-rt/src/lib.rs')
-rw-r--r--cortex-m-rt/src/lib.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/cortex-m-rt/src/lib.rs b/cortex-m-rt/src/lib.rs
index f418e7f..9f2a20a 100644
--- a/cortex-m-rt/src/lib.rs
+++ b/cortex-m-rt/src/lib.rs
@@ -203,12 +203,12 @@
//! - `DefaultHandler`. This is the default handler. If not overridden using `#[exception] fn
//! DefaultHandler(..` this will be an infinite loop.
//!
-//! - `HardFault`. This is the hard fault handler. This function is simply a trampoline that jumps
-//! into the user defined hard fault handler named `UserHardFault`. The trampoline is required to
-//! set up the pointer to the stacked exception frame.
+//! - `HardFaultTrampoline`. This is the real hard fault handler. This function is simply a
+//! trampoline that jumps into the user defined hard fault handler named `HardFault`. The
+//! trampoline is required to set up the pointer to the stacked exception frame.
//!
-//! - `UserHardFault`. This is the user defined hard fault handler. If not overridden using
-//! `#[exception] fn HardFault(..` this will be an infinite loop.
+//! - `HardFault`. This is the user defined hard fault handler. If not overridden using
+//! `#[exception] fn HardFault(..` it will default to an infinite loop.
//!
//! - `__STACK_START`. This is the first entry in the `.vector_table` section. This symbol contains
//! the initial value of the stack pointer; this is where the stack will be located -- the stack
@@ -534,9 +534,9 @@ pub unsafe extern "C" fn Reset() -> ! {
#[allow(unused_variables)]
#[doc(hidden)]
-#[link_section = ".UserHardFault"]
+#[link_section = ".HardFault.default"]
#[no_mangle]
-pub unsafe extern "C" fn UserHardFault_(ef: &ExceptionFrame) -> ! {
+pub unsafe extern "C" fn HardFault_(ef: &ExceptionFrame) -> ! {
loop {
// add some side effect to prevent this from turning into a UDF instruction
// see rust-lang/rust#28728 for details
@@ -590,7 +590,7 @@ pub enum Exception {
extern "C" {
fn NonMaskableInt();
- fn HardFault();
+ fn HardFaultTrampoline();
#[cfg(not(armv6m))]
fn MemoryManagement();
@@ -629,7 +629,7 @@ pub static __EXCEPTIONS: [Vector; 14] = [
handler: NonMaskableInt,
},
// Exception 3: Hard Fault Interrupt.
- Vector { handler: HardFault },
+ Vector { handler: HardFaultTrampoline },
// Exception 4: Memory Management Interrupt [not on Cortex-M0 variants].
#[cfg(not(armv6m))]
Vector {