Module cortex_m_quickstart::examples::_0_hello [] [src]

Prints "Hello, world!" on the OpenOCD console using semihosting


 
#![feature(used)]
#![no_std]
 
extern crate cortex_m;
extern crate cortex_m_rt;
extern crate cortex_m_semihosting;
extern crate panic_abort; // panicking behavior
 
use core::fmt::Write;
 
use cortex_m::asm;
use cortex_m_semihosting::hio;
 
fn main() {
    let mut stdout = hio::hstdout().unwrap();
    writeln!(stdout, "Hello, world!").unwrap();
}
 
// 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() {
    asm::bkpt();
}