aboutsummaryrefslogtreecommitdiff
path: root/cortex-m-rt/examples/qemu.rs
diff options
context:
space:
mode:
authorGravatar bors[bot] <bors[bot]@users.noreply.github.com> 2019-03-18 18:39:19 +0000
committerGravatar bors[bot] <bors[bot]@users.noreply.github.com> 2019-03-18 18:39:19 +0000
commit1d40f01c80b4a02f79bcf59510a7c92862edaafc (patch)
treee291c56b97880f03650be7c097c06a7ca6ec1b0e /cortex-m-rt/examples/qemu.rs
parent02317e6431274955188b69a7b463ab24a528b30e (diff)
parentbb25ff4507f72859b4b6f09a0b81632873053abf (diff)
downloadcortex-m-1d40f01c80b4a02f79bcf59510a7c92862edaafc.tar.gz
cortex-m-1d40f01c80b4a02f79bcf59510a7c92862edaafc.tar.zst
cortex-m-1d40f01c80b4a02f79bcf59510a7c92862edaafc.zip
Merge #182
182: Add thumbv8m.main support. r=korken89 a=thejpster * Add thumbv8m.main support. * Also adds feature flags into build.rs so SecureFault gets included. Co-authored-by: Jonathan 'theJPster' Pallant <github@thejpster.org.uk>
Diffstat (limited to 'cortex-m-rt/examples/qemu.rs')
-rw-r--r--cortex-m-rt/examples/qemu.rs19
1 files changed, 15 insertions, 4 deletions
diff --git a/cortex-m-rt/examples/qemu.rs b/cortex-m-rt/examples/qemu.rs
index e2cd895..7553e70 100644
--- a/cortex-m-rt/examples/qemu.rs
+++ b/cortex-m-rt/examples/qemu.rs
@@ -2,18 +2,22 @@
#![no_main]
#![no_std]
-extern crate cortex_m;
+extern crate cortex_m;
extern crate cortex_m_rt as rt;
+
+#[cfg(not(armv8m))]
extern crate cortex_m_semihosting as semihosting;
+
extern crate panic_halt;
-use core::fmt::Write;
use cortex_m::asm;
use rt::entry;
+#[cfg(not(armv8m))]
#[entry]
fn main() -> ! {
+ use core::fmt::Write;
let x = 42;
loop {
@@ -21,9 +25,16 @@ fn main() -> ! {
// write something through semihosting interface
let mut hstdout = semihosting::hio::hstdout().unwrap();
- write!(hstdout, "x = {}\n", x);
-
+ write!(hstdout, "x = {}\n", x).unwrap();
// exit from qemu
semihosting::debug::exit(semihosting::debug::EXIT_SUCCESS);
}
}
+
+#[cfg(armv8m)]
+#[entry]
+fn main() -> ! {
+ loop {
+ asm::nop();
+ }
+}