Skip to content
Snippets Groups Projects
Select Git revision
  • 2d80f3631bc3bf382ae24c25dbf8ff33af2ad430
  • master default
  • dma
  • v0.2.0
  • v0.1.1
  • v0.1.0
6 results

README.md

Blame
  • itm.rs 812 B
    //! 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 {}
    }