Hi there
It's known that when C28x users want to boot their apps from flash, they need to :
1、use the proper linker.cmd
2、and call the classic memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (unsigned long)&RamfuncsLoadSize) before InitFlash() (well of course, don't forget the variable declarations)
This method has been proven and it did work on my programmes, but I've got a question that's been haunting me:
See these codes first:
//----------------------
//in the main.c
//----------------------
……
void main()
{
InitSysCtrl();
memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (unsigned long)&RamfuncsLoadSize);
InitFlash();
user_fxn(bla);
……
}
//----------------------
//and in the linker.cmd we've got: (take the linker file for TMS320F28335 w/SYSBIOS for example)
//----------------------
SECTIONS
{
/* Allocate program areas: */
.cinit : > FLASH PAGE = 0
.pinit : > FLASH PAGE = 0
.text : > FLASH PAGE = 0
codestart : > BEGIN PAGE = 0
ramfuncs : LOAD = FLASH PAGE = 0,
RUN = L07SARAM PAGE = 1,
LOAD_START(_RamfuncsLoadStart),
LOAD_SIZE(_RamfuncsLoadSize),
LOAD_END(_RamfuncsLoadEnd),
RUN_START(_RamfuncsRunStart)
……
}
We can easily tell that which section of code is copied from flash to ram is actually determined by RamfuncsLoadStart and the other three variable exist. But I can find only these two places that these four variables locate. So I really don't understand, how the compiler, or system, decides the value of these four variables, and how can I know which section of my code, or which user fxn, is actually copied to RAM. Or this method simply copies all my fxns to RAM?
Thanks for reading and I do expect for your valuable reply.