4 releases
new 0.1.3 | Jan 7, 2025 |
---|---|
0.1.2 | Jan 7, 2025 |
0.1.1 | Jan 6, 2025 |
0.1.0 | Jan 6, 2025 |
#93 in Embedded development
202 downloads per month
9KB
74 lines
ITM Parser
itm-parser
is a command-line tool for parsing and formatting ITM (Instrumentation Trace Macrocell) output. It simplifies debugging by converting raw ITM messages into human-readable ASCII text, working seamlessly with probe-rs
in the background.
Note: itm-parser
internally uses probe-rs
. Ensure probe-rs
is installed before using this tool.
Features
- Parses ITM Instrumentation packets (e.g.,
Ok(Instrumentation { port: 0, payload: [...] })
). - Decodes payloads into readable ASCII text.
- Supports newline characters (
\n
) in payloads for proper log message formatting.
Installation
Step 1: Install probe-rs
itm-parser
relies on probe-rs
to interact with your embedded device. Install probe-rs
using Cargo:
cargo install probe-rs-tools
Step 2: Install itm-parser
Once probe-rs
is installed, install itm-parser
:
cargo install itm-parser
Usage
Run the itm-parser
command with required arguments. Internally, it uses probe-rs itm swo to interact with your embedded device.
Command Syntax
itm-parser --chip <CHIP> [--probe <VID:PID>] --connect-under-reset <DURATION> <CLOCK> <BAUD>
Arguments
- --chip (required): The target chip identifier (e.g., STM32F303CC).
- --probe VID:PID (optional): The VID:PID of the debug probe to use (e.g., 0483:374b). If omitted, the default probe will be used. To get VID:PID of the probe run the command `probe-rs list'
- --connect-under-reset flag tells the debugger (in this case, probe-rs) to hold the target MCU in reset while it is establishing a debug connection. So you have to press the reset button of the board to run the code.
- (required): Duration of the trace in milliseconds.
- (required): Clock speed feeding the TPIU/SWO module in Hz.
- (required): Desired baud rate for SWO output.
Example
itm-parser --chip STM32F303CC --connect-under-reset 10000 8000000 1000000
Output
If the raw ITM packets contain:
Ok(Instrumentation { port: 0, payload: [72, 101, 108, 108, 111, 10] })
Ok(Instrumentation { port: 0, payload: [87, 111, 114, 108, 100, 10] })
itm-parser
will decode and display:
Hello
World
Dependencies
~1.1–1.7MB
~32K SLoC