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.
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
解決済! 解決策の投稿を見る。
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
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
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
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