Getting the cycles count in hifi4 of RT600

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

Getting the cycles count in hifi4 of RT600

Jump to solution
1,099 Views
sharvin
Contributor I

Hi Everyone,

I am trying to get cycle count of a function running in hifi4 of RT685EVK. I connect with the debug jlink interface of the RT685 through xt-ocd. When I try to profile using the xplorer ide, I get message as shown below.

sharvin_0-1645187018636.jpeg

If it is not possible to profile in the hardware through the xtensa xplorer, is there any xtensa register or APIs that I can read for getting the cycle counts?

Thanks and regards,

Sharvin

 

0 Kudos
1 Solution
1,086 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @sharvin ,

   If you want to get cycle count of a function, I think you can use the timer to calcuate the time, then get the cycle count, eg, you can use systick, before the API function, clear the count, then enable the timer, and call API, after API finished, stop count, and read the timer count, then calculate the cycle count with your timer count frequency.

   About the xplorer ide, you need to use it with the JLINK debugger, more details, please refer to the SDK doc:

SDK_2_11_0_EVK-MIMXRT685\docs\Getting Started with Xplorer for EVK-MIMXRT685.pdf

  You can download SDK from this link:

https://mcuxpresso.nxp.com/en/builder?hw=EVK-MIMXRT685

 

Wish it helps you!

If you still have questions about it, please kindly let me know.

Best Regards,

Kerry

View solution in original post

0 Kudos
3 Replies
893 Views
SylFluent
Contributor I

Hi Kerry,

It works for me too, if I need to convert cycle count to millisecond, what divider should I use as frequency?

Regards,

Sylvain

 

0 Kudos
1,017 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @sharvin ,

   

customers get cycle counts by using below method on a real HW. This is most convenient way to measure the required budget to run a software.

 

static unsigned long inline get_ccount (void)

{

    unsigned long r;

    __asm__ volatile ("rsr.ccount %0" : "=r" (r));

    return r;

}

 

tic = get_ccount();

processing_function();

toc = get_ccount();

printf("processing takes %d cycles \r\n", toc - tic);

 

Wish it helps you!

Best Regards,

Kerry

0 Kudos
1,087 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @sharvin ,

   If you want to get cycle count of a function, I think you can use the timer to calcuate the time, then get the cycle count, eg, you can use systick, before the API function, clear the count, then enable the timer, and call API, after API finished, stop count, and read the timer count, then calculate the cycle count with your timer count frequency.

   About the xplorer ide, you need to use it with the JLINK debugger, more details, please refer to the SDK doc:

SDK_2_11_0_EVK-MIMXRT685\docs\Getting Started with Xplorer for EVK-MIMXRT685.pdf

  You can download SDK from this link:

https://mcuxpresso.nxp.com/en/builder?hw=EVK-MIMXRT685

 

Wish it helps you!

If you still have questions about it, please kindly let me know.

Best Regards,

Kerry

0 Kudos