上的ARM Cortex M4(或M3)周期计数器? [英] Cycle counter on ARM Cortex M4 (or M3)?
问题描述
我试图来分析一个C函数(这是从一个叫中断,但我可以提取它和其他个人资料吧)上的Cortex M4。
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.
哪些计数通常此功能所用的周期数的可能性?
功能应顶部运行〜4000个周期,所以RTC是不是我想的选项,从拆卸手动计数周期可以是痛苦的 - 只有有用的,如果平均,因为我想用典型的闪存/内存典型的流简介使用模式。
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.
我听说过周期计数寄存器和指令MRC,但他们似乎可用于A8 / 11。我没有在皮质-MX万分之一见过这样的指令。
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.
推荐答案
看看在DWT_CYCCNT寄存器中定义的此处。注意,该寄存器是实现相关的。谁是芯片供应商?我知道STM32实现提供了这组寄存器。
Take a look at the DWT_CYCCNT register defined here. Note that this register is implementation-dependent. Who is the chip vendor? I know the STM32 implementation offers this set of registers.
这篇文章提供了使用DWT周期计数寄存器的时序说明。 (见表格后二零零九年十二月一十一日 - 下午6点29分)
This post provides instructions for using the DWT Cycle Counter Register for timing. (See the post form 11 December 2009 - 06:29 PM)
这个堆栈溢出后是如何DWT_CYCCNT还有一个例子。
This Stack overflow post is an example on how to DWT_CYCCNT as well.
这篇关于上的ARM Cortex M4(或M3)周期计数器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!