Hello Victor,
Thanks a lot for your reply.
Actually we found the code execution speed of this microcontroller to be quite slow for our application and that is the reason why we are moving the code to RAM. Can anything be done to improve the code execution from flash as we don't want our RAM to be consumed much.
We verified the program execution speed by running the following code snippets inside the main and the core was set to 48MHz:
void main()
{
while(1)
{
Chip_GPIO_SetPinState(LPC_GPIO, 1, 13, FALSE);
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
Chip_GPIO_SetPinState(LPC_GPIO, 1, 13, TRUE);
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
}
}
The above code snippet produced a square waveform with an half cycle time of approximately 1.66us.
We again ran the same code with 10 more NOPs added to every half cycle. The snippet is as shown below:
void main()
{
while(1)
{
Chip_GPIO_SetPinState(LPC_GPIO, 1, 13, FALSE);
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
Chip_GPIO_SetPinState(LPC_GPIO, 1, 13, TRUE);
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
__asm("NOP");
}
}
This program produced a square wave on P1.13 with a half cycle period of 1.88us
The difference in time comes out to be around 220ns (execution time for 10 NOPs) and the per cycle execution of NOP comes to be around 22ns which fairly matches its theoretical value of 20.83ns. So, it appears that the code execution from flash takes significant time as per our needs. Is there any way by which the execution from the flash can be accelerated?
Thanks in Advance,
Akhilesh Sreedharan.