This application report describes methods for measuring code execution time of TMS470 and TMS570 microcontrollers. Besides the typical pin toggle approach, where the duration between two pin toggles is measured, e.g., with an oscilloscope, Hercules MCUs support cycle count methods to measure the code execution time in terms of clock cycles.
The real-time-interrupt (RTI) module hardware counters can be used to count the clock cycles required to execute the code. In case of a Cortex-R4F-based TMS570 microcontroller, a third measurement option can be chosen. The performance monitoring unit (PMU) integrated into the Cortex-R4F CPU can be configured to count the CPU clock cycles or other CPU events of interest.