more docs, sort examples

This commit is contained in:
Jorge Aparicio
2017-04-15 09:38:08 -05:00
parent 4dd44a1cb1
commit feebdb2c0b
7 changed files with 66 additions and 19 deletions

25
examples/1-hello.rs Normal file
View File

@@ -0,0 +1,25 @@
//! Device specific version of "Hello, world!"
//!
//! Prints "Hello, world!" on the OpenOCD console using semihosting
#![feature(used)]
#![no_std]
#[macro_use]
extern crate cortex_m;
extern crate cortex_m_rt;
extern crate {{name}};
use {{name}}::interrupt;
fn main() {
hprintln!("Hello, world!");
}
// This is the device specific bit: properly populated interrupt handlers
// Tough we are not using any of them in this example
#[allow(dead_code)]
#[used]
#[link_section = ".rodata.interrupts"]
static INTERRUPTS: interrupt::Handlers =
interrupt::Handlers { ..interrupt::DEFAULT_HANDLERS };