Skip to content
This repository was archived by the owner on Jan 24, 2022. It is now read-only.
This repository was archived by the owner on Jan 24, 2022. It is now read-only.

default_handler! doesn't work #58

@crawford

Description

@crawford

The default_handler! doesn't work in this example code. This was tested with rust-1.26.0-nightly-2018-02-27-29f5c699b:

Debug Build:

000004de <_ZN11cortex_m_rt15default_handler17h87e495993753afeeE>:
///
/// That exception frame is a snapshot of the program state right before the
/// exception occurred.
#[allow(unused_variables)]
#[cfg(target_arch = "arm")]
extern "C" fn default_handler(ef: &ExceptionFrame) -> ! {
 4de:   b082            sub     sp, #8
 4e0:   4601            mov     r1, r0
 4e2:   9001            str     r0, [sp, #4]
/// cause an exception
#[inline(always)]
pub fn bkpt() {
    #[cfg(target_arch = "arm")]
    unsafe {
        asm!("bkpt"
 4e4:   be00            bkpt    0x0000
    asm::bkpt();
 4e6:   9100            str     r1, [sp, #0]
 4e8:   e7ff            b.n     4ea <_ZN11cortex_m_rt15default_handler17h87e495993753afeeE+0xc>

    loop {}
 4ea:   e7fe            b.n     4ea <_ZN11cortex_m_rt15default_handler17h87e495993753afeeE+0xc>

000004ec <BUS_FAULT>:
    #[export_name = "DEFAULT_HANDLER"]
    #[linkage = "weak"]
    #[naked]
    extern "C" fn trampoline() -> ! {
        unsafe {
            asm!("mrs r0, MSP
 4ec:   f3ef 8008       mrs     r0, MSP
 4f0:   f7ff bff5       b.w     4de <_ZN11cortex_m_rt15default_handler17h87e495993753afeeE>
                 :
                 : "i"(default_handler as extern "C" fn(&ExceptionFrame) -> !)
                 :
                 : "volatile");

            intrinsics::unreachable()
 4f4:   defe            udf     #254    ; 0xfe

Release Build:

00000598 <_ZN11cortex_m_rt15default_handler17h6304dc68fb71af89E>:
 598:   be00            bkpt    0x0000
 59a:   e7fe            b.n     59a <_ZN11cortex_m_rt15default_handler17h6304dc68fb71af89E+0x2>

0000059c <BUS_FAULT>:
 59c:   f3ef 8008       mrs     r0, MSP
 5a0:   f7ff bffa       b.w     598 <_ZN11cortex_m_rt15default_handler17h6304dc68fb71af89E>
 5a4:   defe            udf     #254    ; 0xfe

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions