Skip to content
Snippets Groups Projects
Select Git revision
  • 1015fe95641509184c94b577b9b4d0ab217b841a
  • master default
2 results

run.istats

Blame
  • Forked from Per Lindgren / klee_tutorial
    Source project has a limited visibility.
    exception.rs 892 B
    //! Overriding an exception handler
    //!
    //! You can override an exception handler using the [`#[exception]`][1] attribute.
    //!
    //! [1]: https://rust-embedded.github.io/cortex-m-rt/0.6.1/cortex_m_rt_macros/fn.exception.html
    //!
    //! ---
    
    #![deny(unsafe_code)]
    #![deny(warnings)]
    #![no_main]
    #![no_std]
    
    use panic_halt as _;
    
    use cortex_m::peripheral::syst::SystClkSource;
    use cortex_m::Peripherals;
    use cortex_m_rt::{entry, exception};
    use cortex_m_semihosting::hprint;
    
    #[entry]
    fn main() -> ! {
        let p = Peripherals::take().unwrap();
        let mut syst = p.SYST;
    
        // configures the system timer to trigger a SysTick exception every second
        syst.set_clock_source(SystClkSource::Core);
        syst.set_reload(16_000_000); // period = 1s
        syst.enable_counter();
        syst.enable_interrupt();
    
        loop {
            continue;
        }
    }
    
    #[exception]
    fn SysTick() {
        hprint!(".").unwrap();
    }