Tool/software:
Hi Champ,
I am asking for my customer.
Referring to this post,
As the linker command file has created an output section named .TI.ramfuncs, user must manually do the FLASH to RAM copy with the memcpy in the application code before any of the functions in the Ramfuncs section are called.
But from our test, we have seen the #pragma CODE_SECTION(".TI.ramfunc") also does the same thing, to allocate space for the symbol that is loaded to flash and executed from RAM.
By trying to comment out the memcpy in the application code, ONLY leave the line #pragma CODE_SECTION(ADCC1_ISR, ".TI.ramfunc") before ADCC1_ISR and have Load at One Address, Run from a Different Address in the linker command file as shown below. In the compiled .map file, the ADCC1_ISR.obj was born at the load address of the flash and it was still mapped to the RAM w/o the memcpy line to do the FLASH to RAM copy.
/* In a C file */
// memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize); // comment out the memcpy
#pragma CODE_SECTION(ADCC1_ISR, ".TI.ramfunc")
__interrupt void ADCC1_ISR( void )
{
...
}
/* In a linker command file */
.TI.ramfunc : LOAD = FLASH_BANK0_SEC1|FLASH_BANK0_SEC2 | FLASH_BANK0_SEC3 | FLASH_BANK0_SEC4,
RUN = RAMLS0_1_2_3,
LOAD_START(RamfuncsLoadStart),
LOAD_SIZE(RamfuncsLoadSize),
LOAD_END(RamfuncsLoadEnd),
RUN_START(RamfuncsRunStart),
RUN_SIZE(RamfuncsRunSize),
RUN_END(RamfuncsRunEnd),
ALIGN(4)
1. Would the expert please clarify is #pragma CODE_SECTION(".TI.ramfunc") doing the exact same things as memcpy to have the symbol loaded to flash and executed from RAM ? since it was seen the .obj of the symbol was also mapped to the RAM and executing the symbol from RAM.
2. If not, please explain what are the two differences ?
3. Are these two must be tied and used together, to have the symbol executing from outpst section ".TI.ramfunc" ?
I'd appreciate any insights you can provide.
Thanks and regards,
Johnny