]>
Commit | Line | Data |
---|---|---|
1 | ------------------------------------------------------------------------------- | |
2 | ARM ETM/ITM Tracing | |
3 | ------------------------------------------------------------------------------- | |
4 | ||
5 | This is an example capture from ARM Cortex-M3 ETM/ITM trace stream. | |
6 | ||
7 | The trace was captured from STM32F105 microcontroller while running | |
8 | this software (revision 5a1553c): | |
9 | https://github.com/PetteriAimonen/STM32_Trace_Example | |
10 | ||
11 | The example software outputs both ITM and ETM trace as follows: | |
12 | ||
13 | 1) The main loop blinks PC8 approx every 10 ms. | |
14 | On every blink it prints "On" and "Off" to ITM port 0. | |
15 | ||
16 | 2) TIM2 interrupt blinks PC9 approx every 6 ms. | |
17 | It is kept on for the duration of a bubble_sort() call. | |
18 | ETM tracing is enabled for the duration of that subroutine. | |
19 | Sort results are printed to ITM port 1. | |
20 | ||
21 | 3) DWT is continuously reporting exception status and periodically | |
22 | reporting PC values (these go to the ITM stream). | |
23 | ||
24 | Both ITM and ETM are mixed into the same stream by TPIU module | |
25 | ITM is configured as stream 1 and ETM as stream 2. | |
26 | ||
27 | Trace output is configured as 8 MHz UART protocol from TRACESWO pin. | |
28 | ||
29 | ||
30 | Logic analyzer setup | |
31 | -------------------- | |
32 | ||
33 | The logic analyzer used was an FX2 based device (at 24MHz): | |
34 | ||
35 | Probe STM32F105 | |
36 | --------------------- | |
37 | 3 PC9 | |
38 | 5 SWO | |
39 | 7 PC8 | |
40 | ||
41 | ||
42 | Data | |
43 | ---- | |
44 | ||
45 | Capture command: | |
46 | ||
47 | sigrok-cli -d fx2lafw -c samplerate=24MHz -C 4=SWO,2=PC9,6=PC8 -o trace_example.sr --time 50 | |
48 | ||
49 | Decoding command for ITM output: | |
50 | ||
51 | sigrok-cli -i trace_example.sr -P \ | |
52 | uart:rx=SWO:baudrate=8000000,arm_tpiu:stream=1,arm_itm:elffile=trace_example.elf | |
53 | ||
54 | Decoding command for ETM output: | |
55 | ||
56 | sigrok-cli -i trace_example.sr -P \ | |
57 | uart:rx=SWO:baudrate=8000000,arm_tpiu:stream=2,arm_etmv3:elffile=trace_example.elf | |
58 |