From 7021b27e342054eb790300f51fd306bd30e7c30c Mon Sep 17 00:00:00 2001 From: eV Date: Sun, 4 Nov 2018 19:40:09 +0000 Subject: [PATCH] add hello example, update to use upstream repos --- Cargo.toml | 14 ++++++++++---- examples/hello.rs | 28 ++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 examples/hello.rs diff --git a/Cargo.toml b/Cargo.toml index 8d3790e..b100492 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,18 +9,24 @@ vcell = "0.1.0" [dependencies.cortex-m] git = "https://github.com/rust-embedded/cortex-m" +rev = "b70a2179f4e8ee7908b61a6a97970e0cfcf2f313" [dependencies.cortex-m-rt] -git = "https://github.com/evq/cortex-m-rt" -branch = "thumbv8m.base" +git = "https://github.com/rust-embedded/cortex-m-rt" +rev = "9cd01176a6a9985c9bc0040801ed593687dd6ab1" optional = true [dev-dependencies.cortex-m-rt] -git = "https://github.com/evq/cortex-m-rt" -branch = "thumbv8m.base" +git = "https://github.com/rust-embedded/cortex-m-rt" +rev = "9cd01176a6a9985c9bc0040801ed593687dd6ab1" + +[dev-dependencies.cortex-m-semihosting] +git = "https://github.com/rust-embedded/cortex-m-semihosting" +rev = "471378bc848172e12e22b9a3b83190747e70bf5c" [dev-dependencies.panic-semihosting] git = "https://github.com/evq/panic-semihosting" +rev = "3d7041af24969f32606e5eb804e23eaac7fb0bfa" [features] rt = ["cortex-m-rt/device"] diff --git a/examples/hello.rs b/examples/hello.rs new file mode 100644 index 0000000..89a786a --- /dev/null +++ b/examples/hello.rs @@ -0,0 +1,28 @@ +#![no_main] +#![no_std] +extern crate atsaml11xxx; + +extern crate cortex_m; +extern crate cortex_m_rt; +// makes `panic!` print messages to the host stderr using semihosting +extern crate panic_semihosting; + +extern crate cortex_m_semihosting; + +use core::fmt::Write; + +use cortex_m_rt::entry; +use cortex_m_semihosting::hio; + +// use `main` as the entry point of this application +// `main` is not allowed to return +#[entry] +fn main() -> ! { + let mut stdout = hio::hstdout().unwrap(); + + let language = "Rust"; + let ranking = 1; + + write!(stdout, "{} on embedded is #{}!", language, ranking); + loop {} +}