blob: 7553e70b644f56c445bde08bbd0e41f2017129b1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
// #![feature(stdsimd)]
#![no_main]
#![no_std]
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 cortex_m::asm;
use rt::entry;
#[cfg(not(armv8m))]
#[entry]
fn main() -> ! {
use core::fmt::Write;
let x = 42;
loop {
asm::nop();
// write something through semihosting interface
let mut hstdout = semihosting::hio::hstdout().unwrap();
write!(hstdout, "x = {}\n", x).unwrap();
// exit from qemu
semihosting::debug::exit(semihosting::debug::EXIT_SUCCESS);
}
}
#[cfg(armv8m)]
#[entry]
fn main() -> ! {
loop {
asm::nop();
}
}
|