Skip to content
This repository was archived by the owner on Dec 15, 2021. It is now read-only.

Commit ad0a8da

Browse files
author
Alex Helfet
committed
Update README.md and crate documentation with new features.
Cherry-pick from master (a75b042). # Conflicts: # src/lib.rs
1 parent dad78e1 commit ad0a8da

File tree

2 files changed

+65
-12
lines changed

2 files changed

+65
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# `itm`
55

6-
> Tool to parse and dump [ITM] packets
6+
> A Rust crate and tool `itmdump` to parse and dump ARM [ITM] packets.
77
88
[ITM]: http://infocenter.arm.com/help/topic/com.arm.doc.ddi0314h/Chdbicbg.html
99

src/lib.rs

Lines changed: 64 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,54 @@
1-
//! Tool to parse and dump [ITM] packets
1+
//! A library and tool (`itmdump`) to parse and dump ARM ITM packets.
22
//!
3-
//! [ITM]: http://infocenter.arm.com/help/topic/com.arm.doc.ddi0314h/Chdbicbg.html
3+
//! ## Usage
44
//!
5-
//! Right now, this tool only handles instrumentation packets from the stimulus
6-
//! port 0.
5+
//! ``` text
6+
//! itmdump (de13e34 2017-12-19)
7+
//!
8+
//! Reads data from an ARM CPU ITM and decodes it.
9+
//!
10+
//! Input is from an existing file (or named pipe) at a supplied path, or else from standard input.
11+
//!
12+
//! USAGE:
13+
//! itmdump [FLAGS] [OPTIONS]
14+
//!
15+
//! FLAGS:
16+
//! -F, --follow Keep the file open after reading through it and append new output as it is written. Like `tail -f'.
17+
//! -h, --help Prints help information
18+
//! -V, --version Prints version information
19+
//!
20+
//! OPTIONS:
21+
//! -f, --file <file> Path to file (or named pipe) to read from
22+
//! -s, --stimulus <port> Stimulus port to extract ITM data for. [default: 0]
23+
//! ```
24+
//!
25+
//! ### Example: reading from saved ITM data in a file
26+
//! ``` text
27+
//! $ itmdump -f /tmp/itm.dump
28+
//! PANIC at 'Hello, world!', examples/panic.rs:13
29+
//! ```
730
//!
8-
//! # Usage
31+
//! ### Example: reading from OpenOCD via a named pipe
32+
//!
33+
//! [OpenOCD][openocd home] is an open-source tool to debug and flash
34+
//! microcontrollers.
35+
//!
36+
//! Reading via a named pipe works well on POSIX machines; e.g. Linux
37+
//! or macOS, but not Windows.
938
//!
1039
//! ``` text
11-
//! $ itmdump /tmp/itm.fifo
40+
//! $ mkfifo /tmp/itm.fifo
41+
//! $ itmdump -f /tmp/itm.fifo
1242
//! ```
1343
//!
14-
//! This will create a named pipe: `/tmp/itm.fifo`. Another application, e.g.
15-
//! OpenOCD, will have to be connected (open+write) to this pipe. Here's an
16-
//! example command for OpenOCD+GDB that does that. (But
17-
//! [read their documentation!]).
44+
//! This will create a named pipe: `/tmp/itm.fifo`. Another
45+
//! application, e.g. OpenOCD, will have to connect to this pipe and
46+
//! write to it. Here's an example command for OpenOCD
47+
//! + GDB that does that. ([OpenOCD documentation on ITM and
48+
//! TPIU][openocd v7m]).
1849
//!
19-
//! [read their documentation!]: http://openocd.org/doc/html/Architecture-and-Core-Commands.html
50+
//! [openocd home]: http://openocd.org/
51+
//! [openocd v7m]: http://openocd.org/doc/html/Architecture-and-Core-Commands.html#ARMv7_002dM-specific-commands
2052
//!
2153
//! ``` text
2254
//! (gdb) monitor tpiu config internal /tmp/itm.fifo uart off 8000000
@@ -29,6 +61,27 @@
2961
//! PANIC at 'Hello, world!', examples/panic.rs:13
3062
//! ```
3163
//!
64+
//! ### Example: monitoring a file
65+
//!
66+
//! `itmdump` can monitor a file and dump new ITM data written to it
67+
//! (similar to `tail -f`).
68+
//!
69+
//! This may be useful on Windows especially where POSIX named pipes
70+
//! are not available. Just let OpenOCD capture to a file and monitor
71+
//! it with `itmdump`.
72+
//!
73+
//! ``` text
74+
//! $ itmdump -f /tmp/itm.live -F
75+
//! PANIC at 'Hello, world!', examples/panic.rs:13
76+
//! ```
77+
//!
3278
//! # References
3379
//!
3480
//! - ARMv7-M Architecture Reference Manual - Appendix D4.2 Packet descriptions
81+
//!
82+
//! Available to download [as a PDF][ARMv7-m]
83+
//! after a free registration.
84+
//! [ARMv7-m]: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0403e.b/index.html
85+
//!
86+
//! - [ARM CoreSight Technical Reference Manual section on ITM][CoreSight ITM]
87+
//! [CoreSight ITM]: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0314h/CAAGGCDH.html

0 commit comments

Comments
 (0)