aboutsummaryrefslogtreecommitdiff
path: root/src/exception.rs
diff options
context:
space:
mode:
authorGravatar Jorge Aparicio <japaricious@gmail.com> 2017-03-08 10:02:51 -0500
committerGravatar Jorge Aparicio <japaricious@gmail.com> 2017-03-08 10:02:51 -0500
commit0e628b32ac27d47aa897dfd7930ddad85903bd37 (patch)
treecb3966272822615e5d2973af0cbbd314a5873b82 /src/exception.rs
parentc3a35c1b6cea81aa71e8832bca79ccafa492be02 (diff)
downloadcortex-m-0e628b32ac27d47aa897dfd7930ddad85903bd37.tar.gz
cortex-m-0e628b32ac27d47aa897dfd7930ddad85903bd37.tar.zst
cortex-m-0e628b32ac27d47aa897dfd7930ddad85903bd37.zip
turn bkpt! into a function
Diffstat (limited to 'src/exception.rs')
-rw-r--r--src/exception.rs41
1 files changed, 27 insertions, 14 deletions
diff --git a/src/exception.rs b/src/exception.rs
index b944d6c..8343d99 100644
--- a/src/exception.rs
+++ b/src/exception.rs
@@ -72,32 +72,48 @@ pub struct Handlers {
/// Pendable request for system service
pub pendsv: unsafe extern "C" fn(&PendsvCtxt),
/// System tick timer
- pub sys_tick: unsafe extern "C" fn (&SysTickCtxt),
+ pub sys_tick: unsafe extern "C" fn(&SysTickCtxt),
}
/// Identifies the Nmi exception
-pub struct NmiCtxt { _0: () }
+pub struct NmiCtxt {
+ _0: (),
+}
/// Identifies the HardFault exception
-pub struct HardFaultCtxt { _0: () }
+pub struct HardFaultCtxt {
+ _0: (),
+}
/// Identifies the MemManage exception
-pub struct MemManageCtxt { _0: () }
+pub struct MemManageCtxt {
+ _0: (),
+}
/// Identifies the BusFault exception
-pub struct BusFaultCtxt { _0: () }
+pub struct BusFaultCtxt {
+ _0: (),
+}
/// Identifies the UsageFault exception
-pub struct UsageFaultCtxt { _0: () }
+pub struct UsageFaultCtxt {
+ _0: (),
+}
/// Identifies the Svcall exception
-pub struct SvcallCtxt { _0: () }
+pub struct SvcallCtxt {
+ _0: (),
+}
/// Identifies the Pendsv exception
-pub struct PendsvCtxt { _0: () }
+pub struct PendsvCtxt {
+ _0: (),
+}
/// Identifies the Systick exception
-pub struct SysTickCtxt { _0: () }
+pub struct SysTickCtxt {
+ _0: (),
+}
unsafe impl Token for NmiCtxt {}
@@ -134,8 +150,7 @@ pub const DEFAULT_HANDLERS: Handlers = Handlers {
// This needs asm!, #[naked] and unreachable() to avoid modifying the stack
// pointer (MSP), that way it points to the stacked registers
#[naked]
-pub unsafe extern "C" fn default_handler<T>(_token: &T)
-{
+pub unsafe extern "C" fn default_handler<T>(_token: &T) {
// This is the actual exception handler. `_sf` is a pointer to the previous
// stack frame
#[cfg(target_arch = "arm")]
@@ -143,9 +158,7 @@ pub unsafe extern "C" fn default_handler<T>(_token: &T)
#[cfg(feature = "semihosting")]
hprintln!("EXCEPTION {:?} @ PC=0x{:08x}", Exception::current(), _sr.pc);
- unsafe {
- bkpt!();
- }
+ ::asm::bkpt();
loop {}
}