Hi Manish,
The simplest way is just let it know to the linker. For example:
#pragma CODE_SEG DEFAULT_RAM
void PFLASH_Send_Command(void)
{
DisableInterrupts;
FSTAT_CCIF = 1; //launch command
while(FSTAT_CCIF == 0){}; //wait for done
EnableInterrupts;
}
#pragma CODE_SEG DEFAULT
The Starts12z.c code will automatically load your code into RAM.
Note: The DEFAULT_RAM could be used only for S12Z and CW10. The S12(X) linker in CW 5.1(or 5.2; Classic IDE) needs use user segment instead of the default (like DEFAULT_RAM).
You are right that speed of Flash reading might limit code execution, but I will not expect that the speed increasing ratio will be directly 2. It is mainly because not all instructions have shortest execution time and because the flash is read few bus cycles prior instruction execution. The ratio will depend on executed instructions. However, I never measure it.
I hope it helps you.
Have a great day,
Radek
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------