123456789101112131415161718192021222324252627282930313233 |
- //! Sends "Hello, world!" through the ITM port 0
- //!
- //! ITM is much faster than semihosting. Like 4 orders of magnitude or so.
- //!
- //! **NOTE** Cortex-M0 chips don't support ITM.
- //!
- //! You'll have to connect the microcontroller's SWO pin to the SWD interface. Note that some
- //! development boards don't provide this option.
- //!
- //! You'll need [`itmdump`] to receive the message on the host plus you'll need to uncomment two
- //! `monitor` commands in the `.gdbinit` file.
- //!
- //! [`itmdump`]: https://docs.rs/itm/0.2.1/itm/
- //!
- //! ---
- #![no_main]
- #![no_std]
- use panic_halt as _;
- use cortex_m::{iprintln, Peripherals};
- use cortex_m_rt::entry;
- #[entry]
- fn main() -> ! {
- let mut p = Peripherals::take().unwrap();
- let stim = &mut p.ITM.stim[0];
- iprintln!(stim, "Hello, world!");
- loop {}
- }
|