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

The ARM DWT (Data Watchpoint and Trace) is an optional feature of the ARM-Cortex-M, and many Cortex-M3, M4 and M7 devices have it implemented. With it comes a cycle counter which 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 cycle counter in the Eclipse Registers view:

Cycle Counter in Register 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 🙂


3 thoughts on “Measuring ARM Cortex-M CPU Cycles Spent with the MCUXpresso Eclipse Registers View

  1. Hi Erich
    Maybe something is wrong with me, but I couldn’t complete even 1 project with MCUXpresso, I’m still using KDS, can you please make a step-by-step tutorial for a simple RS232 application? For example one thing I could not achieve: how do you set baud(rate) for such an application
    I really would need a tutorial like this one

    Thank you


  2. Pingback: Be aware: Floating Point Operations on ARM Cortex-M4F | MCU on Eclipse

  3. Pingback: SWO with ARM Cortex-M33 | MCU on Eclipse

What do you think?

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.