Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Measuring ARM Cortex-M CPU Cycles Spent With the MCUXpresso Eclipse Registers View

DZone's Guide to

Measuring ARM Cortex-M CPU Cycles Spent With the MCUXpresso Eclipse Registers View

Want to learn how to measure an ARM Cortex-M CPU Cycle? Here's how in this tutorial on using the MCUXpresso Eclipse Registers View.

· IoT Zone ·
Free Resource

The ARM DWT (Data Watchpoint and Trace) is an optional feature of the ARM-Cortex-M. Many Cortex-M3, M4, and M7 devices have it implemented. With it comes a cycle counter that counts the cycles spent. In Cycle Counting on ARM Cortex-M with DWT, I described an approach how the application on the target can access the cycle counter.

The MCUXpresso IDE shows that the cycle counter in the Eclipse Registers view:

Cycle Counter in Register View

The NXP MCUXpresso IDE has implemented a custom extension to show the cycle counter register value as a pseudo register.

The screenshot above is with using the MCUXpresso IDE 10.2.0 on a FRDM-K64F (ARM Cortex-M4) using the LinkServer debug connection.

 As of MCUXpresso IDE 10.2.0 build 759, the P&E and SEGGER interface does not support that feature.

The other pseudo register is the ‘cycledelta’ one. This one shows the cycles since the last time the target was stopped. With doing source level stepping, this shows me directly the number of cycles spent for that step, same for assembly level stepping. In a similar way, I can measure the cycles spent in function with setting a breakpoint at the beginning and at the end of the function — simple and effective.

Happy counting!

Topics:
iot ,arm cortex ,cpu cycles ,cycle counting ,tutorial

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}