A Program Trace Macrocell (PTM) is a real-time trace module providing instruction tracing of an ARM® core. It traces way-points in:
• All indirect branches conditional
• Unconditional direct branches
• All exceptions
PTM also generates processing elements. This way the PTM module is triggered when there is a deviation from the normal code flow. The ETM v4 in NVIDIA® Jetson™ TX2 series and NVIDIA® Jetson™ TX1 devices, and protocols use waypoints and correlate the trace to the code image, vmlinux. These PTM packets can be decoded later using mem_parser to obtain the complete CPU instruction flow.
PTM is advantageous may be necessary for:
• Debugging - On many production systems it is not possible to connect JTAG devices. In these cases you can use PTM to check which instructions ran before the CPU crashed.
• Code Profiling - Because there is no Watchdog Timer (WDT) reset, code profiling checks are possible, provided a start and end address.
• Performance Analysis - PTM has no performance overhead as compared with ftrace. PTM can also provide instruction counts and timestamps that can be used for performance analysis.
PTM is a component of the ARM coresight framework. Detailed information about the framework is available at:
You can enable and disable trace capture at runtime. The content of the ETF/ETR on Jetson TX2 or Jetson TX1 devices, during the period that trace capture is enabled, can be read back to parse.
echo 1 > /sys/bus/coresight/devices/9940000.ptm/mode [set EXC bit i.e. bit 24 in ETMTECR1 to trace all memory. Refer *etm*architecture*.pdf, ignore this if you don't know the result.]
echo 1 > /sys/bus/coresight/devices/9a40000.ptm/mode [set EXC bit i.e. bit 24 in ETMTECR1 to trace all memory. Refer *etm*architecture*.pdf, ignore this if you don't know the result.]
echo 1 > /sys/bus/coresight/devices/9b40000.ptm/mode [set EXC bit i.e. bit 24 in ETMTECR1 to trace all memory. Refer *etm*architecture*.pdf, ignore this if you don't know the result.]