I'm trying to profile a C function (which is called from an interrupt, but I can extract it and profile it elsewhere) on a Cortex M4.
What are the possibilities to count the number of cycles typically used in this function ? Function shall run in ~4000 cycles top, so RTC isn't an option I guess, and manually counting cycles from disassembly can be painful - and only useful if averaged because I'd like to profile on a typical stream with typical flash / memory usage pattern.
I have heard about cycle counter registers and MRC instructions, but they seem to be available for A8/11. I haven't seen such instructions in cortex-Mx micros.