Skip to content
Snippets Groups Projects
Select Git revision
  • 7bbafc3358933fea38ac1c696616e6e15515efa1
  • master default
  • itm_trace
3 results

bare1.rs

Blame
  • Forked from Per Lindgren / rtfm-app
    Source project has a limited visibility.
    bare1.rs 964 B
    //! bare1.rs
    //! Simple bare metal application
    
    // feature to ensure symbols to be linked
    #![feature(used)]
    // build without the Rust standard library
    #![no_std]
    
    // API to the ARM Cortex M Peripherals
    //extern crate cortex_m;
    
    // Minimal runtime / startup for Cortex-M microcontrollers
    extern crate cortex_m_rt;
    
    // Convenient tracing over semihosting and ITM
    // #[macro_use]
    // extern crate cortex_m_debug;
    
    #[inline(never)]
    fn main() {
        // ITM trace (fast)
        // start `itmdump` before `openocd`
        // ipln!("ITM: Hello World");
    
        // semihosting trace (slow)
        // sprintln!("SEMIHOSTING: Hello World");
    
        // to prevent returning
        loop {
            // cortex_m::asm::nop();
        }
    }
    
    // As we are not using interrupts, we just register a dummy catch all handler
    #[link_section = ".vector_table.interrupts"]
    #[used]
    static INTERRUPTS: [extern "C" fn(); 240] = [default_handler; 240];
    
    extern "C" fn default_handler() {
        // cortex_m::asm::bkpt();
    }