Part Number: TMS320F28379D
Hi Sir/Madam,
I am using dclfuncs and DCL_refgen in RAM fw. What changes we need to do in flash linker command file , so that I can use these function?
Thanks and Regards,
Prashant Gugle
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Part Number: TMS320F28379D
Hi Sir/Madam,
I am using dclfuncs and DCL_refgen in RAM fw. What changes we need to do in flash linker command file , so that I can use these function?
Thanks and Regards,
Prashant Gugle
Hi Prashant,
DCL functions must load from Flash but execute from RAM. This means your flash linker command file needs a dual LOAD/RUN address configuration for the dclfuncs section, plus a memcpy() call at startup to physically transfer the code from Flash to RAM before any DCL function is invoked. You can modifiy your linker cmd in the following way.
So if your project already has a .TI.ramfunc section, then just add dclfuncs to the same group. You will have to create a GROUP for All LOAD/RUN specifiers automatically apply to both sections.
For example
GROUP : LOAD = FLASH_BANK0_SEC7,
RUN = RAMLS0_RAMLS1,
START(RamfuncsRunStart),
LOAD(RamfuncsLoadStart),
SIZE(RamfuncsLoadSize)
{
.TI.ramfunc
dclfuncs
}
If you don't have an existing .TI.ramfunc section then you can create one for dclfuncs so it runs from RAM. So you can add something like this in your SECTIONS block in the linker cmd file.
dclfuncs : LOAD = FLASH_BANK0_SEC7,
RUN = RAMLS0_RAMLS1,
START(DCLfuncsRunStart),
LOAD(DCLfuncsLoadStart),
SIZE(DCLfuncsLoadSize),
ALIGN(8),
PAGE = 0
Now you also need to copy the DCL functions from Flash to RAM before you make any DCL calls. SO oyu can add this to your startup code - in main.c after initPieVectTable() or even in device.c
// Declare linker-generated symbols
extern uint32_t DCLfuncsRunStart;
extern uint32_t DCLfuncsLoadStart;
extern uint32_t DCLfuncsLoadSize;
// Copy DCL functions from Flash to RAM
memcpy((uint32_t *)&DCLfuncsRunStart,
(uint32_t *)&DCLfuncsLoadStart,
(uint32_t)&DCLfuncsLoadSize);
Rebuild your project after this.
Thanks,
Ira
Hi Ira,
Since I have .TI.ramfunc in #ifdef I will have to do it 3 times
#ifdef __TI_COMPILER_VERSION__
#if __TI_COMPILER_VERSION__ >= 15009000
#if defined(__TI_EABI__)
GROUP : LOAD = FLASHD,
RUN = RAMLS0,
LOAD_START(RamfuncsLoadStart),
LOAD_SIZE(RamfuncsLoadSize),
LOAD_END(RamfuncsLoadEnd),
RUN_START(RamfuncsRunStart),
RUN_SIZE(RamfuncsRunSize),
RUN_END(RamfuncsRunEnd),
PAGE = 0, ALIGN(8)
{
.TI.ramfunc
dclfuncs
}
#else
GROUP : LOAD = FLASHD,
RUN = RAMLS0,
LOAD_START(_RamfuncsLoadStart),
LOAD_SIZE(_RamfuncsLoadSize),
LOAD_END(_RamfuncsLoadEnd),
RUN_START(_RamfuncsRunStart),
RUN_SIZE(_RamfuncsRunSize),
RUN_END(_RamfuncsRunEnd),
PAGE = 0, ALIGN(8)
{
.TI.ramfunc
dclfuncs
}
#endif
#else
GROUP : LOAD = FLASHD,
RUN = RAMLS0,
LOAD_START(_RamfuncsLoadStart),
LOAD_SIZE(_RamfuncsLoadSize),
LOAD_END(_RamfuncsLoadEnd),
RUN_START(_RamfuncsRunStart),
RUN_SIZE(_RamfuncsRunSize),
RUN_END(_RamfuncsRunEnd),
PAGE = 0, ALIGN(8)
{
ramfuncs
dclfuncs
}
#endif
#endif
And I don't need to copy this right?
// Copy DCL functions from Flash to RAM
memcpy((uint32_t *)&DCLfuncsRunStart, (uint32_t *)&DCLfuncsLoadStart,(uint32_t)&DCLfuncsLoadSize);
Thanks and Regards,
Prashant Gugle
Hi Prashant,
Correct, you have to add dclfuncs in all the 3 cases. You will have to do the memcpy() in your startup routine as well. You can directly say memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
Because SIZE(RamfuncsLoadSize) covers the combined size of .TI.ramfunc + dclfuncs, this single memcpy() call copies both sections in one shot.
Thanks,
Ira
Hi Ira,
I have copied in all the 3 cases dclfuncs and also added memcpy function after device_init() in main().
Thanks and Regards,
Prashant Gugle
Hi Ira,
memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
was already there in device.c file.
Thanks and Regards,
Prashant Gugle
Hi Prashant,
Is the project working as expected i.e. are you able to run the DCL functions?
Thanks,
Ira
Hi Ira,
Project is working as expected and I am able to run DCL functions.
Thanks and Regards,
Prashant Gugle