aboutsummaryrefslogtreecommitdiff
path: root/cortex-m-rt
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
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')
-rw-r--r--cortex-m-rt/.cargo/config3
-rw-r--r--cortex-m-rt/Cargo.toml3
-rw-r--r--cortex-m-rt/examples/qemu.rs36
3 files changed, 25 insertions, 17 deletions
diff --git a/cortex-m-rt/.cargo/config b/cortex-m-rt/.cargo/config
new file mode 100644
index 0000000..837eee1
--- /dev/null
+++ b/cortex-m-rt/.cargo/config
@@ -0,0 +1,3 @@
+[target.thumbv7m-none-eabi]
+# uncomment this to make `cargo run` execute programs on QEMU
+runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -semihosting-config enable=on,target=native -nographic -kernel"
diff --git a/cortex-m-rt/Cargo.toml b/cortex-m-rt/Cargo.toml
index ae72260..19e29e5 100644
--- a/cortex-m-rt/Cargo.toml
+++ b/cortex-m-rt/Cargo.toml
@@ -17,6 +17,9 @@ cortex-m-rt-macros = { path = "macros", version = "0.1.1" }
[dev-dependencies]
cortex-m = "0.5.4"
panic-halt = "0.2.0"
+panic-semihosting = "0.5.0"
+cortex-m-semihosting = "0.3.1"
+unreachable = "1.0.0"
[dev-dependencies.rand]
default-features = false
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)}
+// }