initial commit with my changes
This commit is contained in:
33
examples/itm.rs
Normal file
33
examples/itm.rs
Normal file
@@ -0,0 +1,33 @@
|
||||
//! 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 {}
|
||||
}
|
Reference in New Issue
Block a user