hello.rs 390 B

1234567891011121314151617181920
  1. //! Prints "Hello, world!" on the host console using semihosting
  2. #![no_main]
  3. #![no_std]
  4. use panic_halt as _;
  5. use cortex_m_rt::entry;
  6. use cortex_m_semihosting::{debug, hprintln};
  7. #[entry]
  8. fn main() -> ! {
  9. hprintln!("Hello, world!").unwrap();
  10. // exit QEMU
  11. // NOTE do not run this on hardware; it can corrupt OpenOCD state
  12. debug::exit(debug::EXIT_SUCCESS);
  13. loop {}
  14. }