Hi
I am trying to move code to ITC memory and verify that it indeed greatly improves performance.
I looked at the linker scripts generated by MCU Xpresso, and learned that the code decorated with "RamFunction" is moved to ram.
I added this code to a standard MCU Xpresso generated project for my RT 1020 EVK board
GPIO1->DR ^= (1UL << 15);
for (volatile int i=0; i<100000; i++)
{
Nonsense();
}
GPIO1->DR ^= (1UL << 15);
And the Nonsense function here
void Nonsense()
{
GPIO1->DR ^= (1UL << 23);
for (volatile int i=0; i<1000; ++i)
{
__asm volatile ("nop");
}
GPIO1->DR ^= (1UL << 23);
}
I ran my baseline test, and in my logic analyzer I could see that every outer loop took roughly 1.8s.
Next I decorated both main and Nonsense() with the ramfunction macro as follows:
RAMFUNCTION_SECTION_CODE(void Nonsense())
{
GPIO1->DR ^= (1UL << 23);
for (volatile int i=0; i<1000; ++i)
{
__asm volatile ("nop");
}
GPIO1->DR ^= (1UL << 23);
}
RAMFUNCTION_SECTION_CODE(int main(void))
{
...
...
}
But the results are the same. It takes roughly 1.8seconds to complete the outer loop.
Am I completely missing the obvious here? Can somebody tell me how to get the performance boost I am trying to achieve by moving code to ITC? Or explain why this isn't showing any improvement at all?
Solved! Go to Solution.
Hello Bp1979,
Have you followed the steps in section 17.13.5 of the MCUXpresso IDE User Guide?
https://www.nxp.com/docs/en/user-guide/MCUXpresso_IDE_User_Guide.pdf
As for performance depending on the kind of memory where the code resided, AN12437 (link below) and the following Knowledge Base document does cover the differences in speed between them.
https://www.nxp.com/docs/en/application-note/AN12437.pdf
I hope that this information helps.
Regards,
Gustavo
Hi,
It seems that the reason is not where you place your code, for the code
is simple, I think the factor is the memory access caused by the for(volatile int i...)
Regards,
Crist
Hello Bp1979,
Have you followed the steps in section 17.13.5 of the MCUXpresso IDE User Guide?
https://www.nxp.com/docs/en/user-guide/MCUXpresso_IDE_User_Guide.pdf
As for performance depending on the kind of memory where the code resided, AN12437 (link below) and the following Knowledge Base document does cover the differences in speed between them.
https://www.nxp.com/docs/en/application-note/AN12437.pdf
I hope that this information helps.
Regards,
Gustavo