aboutsummaryrefslogtreecommitdiff
path: root/cortex-m-rt/examples/qemu.rs
diff options
context:
space:
mode:
authorGravatar Hideki Sekine <sekineh@me.com> 2018-09-21 02:01:39 +0900
committerGravatar Hideki Sekine <sekineh@me.com> 2018-09-21 02:01:39 +0900
commitb20f27d983624478a956d70e113c82138dea3ed8 (patch)
treebcfacb37d78c871907c355817f89fd82cb62a171 /cortex-m-rt/examples/qemu.rs
parent87771282d1b87d1a1b40e18f9c8f829ad01a6e7f (diff)
downloadcortex-m-b20f27d983624478a956d70e113c82138dea3ed8.tar.gz
cortex-m-b20f27d983624478a956d70e113c82138dea3ed8.tar.zst
cortex-m-b20f27d983624478a956d70e113c82138dea3ed8.zip
make build pass.
Diffstat (limited to 'cortex-m-rt/examples/qemu.rs')
-rw-r--r--cortex-m-rt/examples/qemu.rs36
1 files changed, 19 insertions, 17 deletions
diff --git a/cortex-m-rt/examples/qemu.rs b/cortex-m-rt/examples/qemu.rs
index f3850d5..0bae8e7 100644
--- a/cortex-m-rt/examples/qemu.rs
+++ b/cortex-m-rt/examples/qemu.rs
@@ -1,31 +1,31 @@
-#![feature(stdsimd)]
+// #![feature(stdsimd)]
#![no_main]
#![no_std]
extern crate cortex_m;
-#[macro_use(entry, exception)]
extern crate cortex_m_rt as rt;
extern crate cortex_m_semihosting as semihosting;
-extern crate panic_abort;
+extern crate panic_semihosting;
extern crate unreachable;
-use core::arch::arm;
use core::fmt::Write;
-use rt::ExceptionFrame;
-
-entry!(main);
+use cortex_m::asm;
+use rt::{entry, exception, ExceptionFrame};
+#[entry]
fn main() -> ! {
let x = 42;
loop {
- unsafe { arm::__NOP() }
+ asm::nop();
// write something through semihosting interface
let mut hstdout = semihosting::hio::hstdout().unwrap();
write!(hstdout, "x = {}\n", x);
+ asm::nop();
+
// exit from qemu
semihosting::debug::exit(semihosting::debug::EXIT_SUCCESS);
@@ -36,18 +36,20 @@ fn main() -> ! {
}
}
-// define the hard fault handler
-exception!(HardFault, hard_fault);
-
+#[exception]
#[inline(always)]
-fn hard_fault(_ef: &ExceptionFrame) -> ! {
+fn HardFault(_ef: &ExceptionFrame) -> ! {
loop {
- unsafe { arm::__NOP() }
+ asm::nop()
}
}
-// define the default exception handler
-exception!(*, default_handler);
-
+#[exception]
#[inline(always)]
-fn default_handler(_irqn: i16) {}
+fn DefaultHandler(_irqn: i16) {}
+
+// use core::panic::PanicInfo;
+// #[panic_handler]
+// fn panic(_info: &PanicInfo) -> ! {{
+// semihosting::debug::exit(semihosting::debug::EXIT_SUCCESS)}
+// }