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 🙂

Links

Advertisements

One thought 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
    https://mcuoneclipse.com/2012/09/07/tutorial-enlighting-the-freedom-kl25z-board/

    Thank you
    Cristian

    Like

What do you think?

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

WordPress.com Logo

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

Google+ photo

You are commenting using your Google+ 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.