1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//! Log panic messages using the ITM (Instrumentation Trace Macrocell)
//!
//! This crate contains an implementation of `panic_fmt` that logs panic messages to the ITM
//! stimulus port 0. Before printing the message the panic handler disables (masks) all the device
//! specific interrupts. After printing the message the panic handler goes into an infinite loop.
//!
//! # Usage
//!
//! ``` ignore
//! #![no_std]
//!
//! extern crate panic_itm;
//!
//! fn main() {
//! panic!("FOO")
//! }
//! ```
//!
//! ``` text
//! (gdb) monitor tpiu config external uart off 8000000 2000000
//! (gdb) monitor itm port 0 on
//! (gdb) continue
//! (..)
//! ```
//!
//! ``` text
//! $ itmdump -f /dev/ttyUSB0
//! panicked at 'FOO', src/main.rs:6:5
//! ```
extern crate cortex_m;
use PanicInfo;
use ;
use interrupt;
use iprintln;
use ITM;
!