make the hello example work
This commit is contained in:
@@ -2,29 +2,33 @@
|
||||
//!
|
||||
//! ---
|
||||
|
||||
#![feature(used)]
|
||||
#![feature(asm)]
|
||||
#![no_main]
|
||||
#![no_std]
|
||||
|
||||
extern crate cortex_m;
|
||||
#[macro_use]
|
||||
extern crate cortex_m_rt;
|
||||
extern crate cortex_m_semihosting;
|
||||
extern crate cortex_m_semihosting as sh;
|
||||
extern crate panic_abort; // panicking behavior
|
||||
|
||||
use core::fmt::Write;
|
||||
|
||||
use cortex_m::asm;
|
||||
use cortex_m_semihosting::hio;
|
||||
use sh::hio;
|
||||
|
||||
fn main() {
|
||||
main!(main);
|
||||
|
||||
fn main() -> ! {
|
||||
let mut stdout = hio::hstdout().unwrap();
|
||||
writeln!(stdout, "Hello, world!").unwrap();
|
||||
|
||||
loop {}
|
||||
}
|
||||
|
||||
// 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];
|
||||
exception!(DefaultHandler, dh);
|
||||
|
||||
extern "C" fn default_handler() {
|
||||
asm::bkpt();
|
||||
fn dh(_nr: u8) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
// As we are not using interrupts, we just bind them all to the `DefaultHandler` exception handler
|
||||
interrupts!(DefaultHandler);
|
||||
|
||||
Reference in New Issue
Block a user