Getting the cycles count in hifi4 of RT600

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Getting the cycles count in hifi4 of RT600

跳至解决方案
1,109 次查看
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 项奖励
1 解答
1,096 次查看
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 项奖励
3 回复数
903 次查看
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 项奖励
1,027 次查看
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 项奖励
1,097 次查看
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 项奖励