How to use CYCLE in Core Registers?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to use CYCLE in Core Registers?

1,064 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jnd on Thu Mar 11 16:10:48 MST 2010
Hi,

I'd like to count cycles for one loop and haven't figured how could I do it. I found these two rows in Core Registers tab which sound promising:

CYCLE indicates the number of cycles executed since reset
CYCLEDELTA indicates the number of cycles executed since the last start

But they never change. I tried setting them to something but that didn't help. Is there any way to use them? How to display elapsed cycles of executed code in the debugger? I had idea about using timer but found it runs freely even when the execution is suspended.
0 Kudos
Reply
5 Replies

1,030 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Sat Mar 13 02:32:56 MST 2010
Hi,

Yes, SYSTICKCLKDIV has been removed, and will be in the next release.
0 Kudos
Reply

1,030 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jnd on Fri Mar 12 18:33:21 MST 2010
Yes, I have the LPC1114 board. It seems I can use the systick timer instead, it counts as the program gets executed and stops when suspended. I'll try to play with it and see if it's usable.

BTW when you are removing those two registers, you should also take out the SYSTICKCLKDIV, it seems to be another "leftover" from LPC13XX. LPC111X UM rev 10: Systick clock divider removed from syscon block.
0 Kudos
Reply

1,030 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Fri Mar 12 13:54:01 MST 2010
I believe I wrongly presumed you were using the LPC1343, but it would seem you have the LPC1114 board, correct? The DWT cycle count register is not implemented on this Cortex M0 part, so there is no cycle count available. Code Red plans to remove these two registers from the register display in a future release.

Regards,

CodeRedSupport


Quote: jnd
I checked now on other machine and the result is same: both Cycle and CycleDelta remains at zero all the time. I'm using breakpoints. Even if I try some example project (systick, blinky) it doesn't change.

When I write some value to Cycle and press run, on the next breakpoint two's complement of that value appears in CycleDelta, Cycle gets cleared to 0 and that's the end of the show.

0 Kudos
Reply

1,030 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jnd on Fri Mar 12 11:57:03 MST 2010
I checked now on other machine and the result is same: both Cycle and CycleDelta remains at zero all the time. I'm using breakpoints. Even if I try some example project (systick, blinky) it doesn't change.

When I write some value to Cycle and press run, on the next breakpoint two's complement of that value appears in CycleDelta, Cycle gets cleared to 0 and that's the end of the show.
0 Kudos
Reply

1,030 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Thu Mar 11 23:08:38 MST 2010
Your description of the register function is correct. We do not have other reports of a problem, and a quick check in-house indicates the behavior is as expected. The display may not be what you expect depending on how the debugger satisfies a run request. CycleDelta shows the cycle count of the last run event. So, if you selected a "Run to Line" and the debug engine decided to instruction-step to the target address (instead of set a breakpoint and execute at full speed), you'll see the cycle delta from the last instruction-step. When counting cycles, it's best to run to a defined breakpoint than to let the debugger decide how to get there. You really only care about this when counting cycles, or in an interrupt rich environment.

Regards,

CodeRedSupport


Quote: jnd
Hi,

I'd like to count cycles for one loop and haven't figured how could I do it. I found these two rows in Core Registers tab which sound promising:

CYCLE indicates the number of cycles executed since reset
CYCLEDELTA indicates the number of cycles executed since the last start

But they never change. I tried setting them to something but that didn't help. Is there any way to use them? How to display elapsed cycles of executed code in the debugger? I had idea about using timer but found it runs freely even when the execution is suspended.

0 Kudos
Reply