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?