embeddeduclinuxcoldfire

High resolution timer on Coldfire (MCF5328)


I've inherited a embedded project that requires some simple, per-function performance profiling. It consists of a Coldfire (MCF5328) running uClinux (2.6.17.7-uc1).

I'm not an expert on either the Coldfire, or uClinux (or Linux for that matter), so excuse my ignorance.

In Windows I would simply use QueryPerformanceCounter to access the x86 high-resolution timer. Record the counter before and after and compare the difference.

I've learned that Linux has a number of variations on QueryPerformanceCounter:

Or even access to the Time Stamp Counter via

None of these are available on the uClinux build this device is running. So it appears that the OS has no high-resolution timer access.

Does this mean that the Coldfire itself provides no such feature? Or did the author of the uClinux port leave them out? Is there something on the hardware that I can use, and how would go about using it?


Solution

  • I ended up using one of the four DMA Timers on the Coldfire. It was a simple matter to enable the timer as a free-running, non-interrupt generating, counter. This provides a 12.5ns counter (at 80Mhz).