Skip to content
Snippets Groups Projects
Select Git revision
  • f5a4d8e9041d81e8c423727010f99df5fa97616d
  • master default protected
  • exam
  • exper
  • klee
  • simple
  • v0.3.2
  • v0.3.1
  • v0.3.0
  • v0.2.2
  • v0.2.1
  • v0.2.0
  • v0.1.1
  • v0.1.0
14 results

script.sh

Blame
  • crash.rs 607 B
    //! Debugging a crash (exception)
    
    // #![deny(unsafe_code)] // this example is using unsafe
    #![deny(warnings)]
    #![no_main]
    #![no_std]
    
    //use panic_halt as _;
    use panic_semihosting as _;
    
    use core::ptr;
    
    use cortex_m_rt::{entry, exception};
    
    #[entry]
    #[inline(never)]
    fn main() -> ! {
        unsafe {
            // read an address outside of the RAM region to cause a HardFault exception
            ptr::read_volatile(0x2FFF_FFFF as *const u32);
        }
    
        loop {
            continue;
        }
    }
    
    #[exception]
    #[inline(never)]
    fn HardFault(ef: &cortex_m_rt::ExceptionFrame) -> ! {
        panic!("Exception frame {:?}", ef);
    }