]> git.lizzy.rs Git - rust.git/blob - src/test/run-make/thumb-none-qemu/example/src/main.rs
Auto merge of #63089 - kennytm:use-try-run-for-linkchecker, r=Mark-Simulacrum
[rust.git] / src / test / run-make / thumb-none-qemu / example / src / main.rs
1 // #![feature(stdsimd)]
2 #![no_main]
3 #![no_std]
4
5 extern crate cortex_m;
6
7 extern crate cortex_m_rt as rt;
8 extern crate cortex_m_semihosting as semihosting;
9 extern crate panic_halt;
10
11 use core::fmt::Write;
12 use cortex_m::asm;
13 use rt::entry;
14
15 entry!(main);
16
17 fn main() -> ! {
18     let x = 42;
19
20     loop {
21         asm::nop();
22
23         // write something through semihosting interface
24         let mut hstdout = semihosting::hio::hstdout().unwrap();
25         write!(hstdout, "x = {}\n", x);
26
27         // exit from qemu
28         semihosting::debug::exit(semihosting::debug::EXIT_SUCCESS);
29     }
30 }