Reputation: 2004
By configuring the PMU of the Cortex-R5 it's possible to get a cycle count. However the counter is 32-bit, which means it wraps after some seconds. Is there a way to get or emulate a 64-bit counter?
Upvotes: 0
Views: 310
Reputation: 12169
Option 1 - Set PMCR.D
to 1 and count every 64 cycles, to trade accuracy for range, which effectively gives you a 38-bit counter.
Option 2 - Set up PMINTENSET
to raise an interrupt on a 32-bit overflow and write a small driver to accumulate into a 64-bit value in software. This relies on the PMU IRQ being wired up to the interrupt controller; it normally is but isn't guaranteed.
Upvotes: 1