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.
Dear all,
For a flash build C28x-CLA1 program , i came to an understanding that bfore we run cla we need to copy cla programs to configured memory RAM .This copy using memcpy() function is earlier seen by using pragma command to specify to which section of flash the code should reside and to which portion of ram we will load it while running . But in CLA example for epwm i cannot find usage of Ca1Prog section specification in .cla source file.
How we are loading cla code into Ls ram ?. Should nt we specify the section by some method like
__interrupt void cpuTimer0ISR(void);
#pragma CODE_SECTION(cpuTimer0ISR, "isrfunc")
in the above code we are specifying isrfunc section for timerisr function.
and this linker words will make it run. at RAMGS15
isrfunc : LOAD = FLASH0| FLASH1,
RUN = RAMGS15,
LOAD_START(isrfuncLoadStart),
LOAD_END(isrfuncLoadEnd),
RUN_START(isrfuncRunStart),
LOAD_SIZE(isrfuncLoadSize)
but am not able to find any such method of pragma usage for the Cla1Prog section in the pwm cla example in c2000 .
how the compiler comes to know it should keep the functions in .cla source file in FLASH4 only
Cla1Prog : LOAD = FLASH4,
RUN = RAMLS5,
LOAD_START(Cla1funcsLoadStart),
LOAD_END(Cla1funcsLoadEnd),
RUN_START(Cla1funcsRunStart),
LOAD_SIZE(Cla1funcsLoadSize),
ALIGN(8)
also please give an idea on following code from cmd file
/* CLA C compiler sections */
//
// Must be allocated to memory the CLA has write access to
//
CLAscratch :
{ *.obj(CLAscratch)
. += CLA_SCRATCHPAD_SIZE;
*.obj(CLAscratch_end) } > RAMLS1
.scratchpad : > RAMLS1
.bss_cla : > RAMLS1
cla_shared : > RAMLS1
#if defined(__TI_EABI__)
.const_cla : LOAD = FLASH2,
RUN = RAMLS1,
RUN_START(Cla1ConstRunStart),
LOAD_START(Cla1ConstLoadStart),
LOAD_SIZE(Cla1ConstLoadSize)
#else
.const_cla : LOAD = FLASH2,
RUN = RAMLS1,
RUN_START(_Cla1ConstRunStart),
LOAD_START(_Cla1ConstLoadStart),
LOAD_SIZE(_Cla1ConstLoadSize)
Thanks and regards,
Stevin Martin
CLA_SCRATCHPAD_SIZE = 0x100; --undef_sym=__cla_scratchpad_end --undef_sym=__cla_scratchpad_start MEMORY { /* BEGIN is used for the "boot to Flash" bootloader mode */ BEGIN : origin = 0x080000, length = 0x000002 BOOT_RSVD : origin = 0x000002, length = 0x0001AF /* Part of M0, BOOT rom will use this for stack */ RAMM0 : origin = 0x0001B1, length = 0x00024F RAMM1 : origin = 0x000400, length = 0x0003F8 /* on-chip RAM block M1 */ // RAMM1_RSVD : origin = 0x0007F8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */ RAMD0 : origin = 0x00C000, length = 0x000800 RAMD1 : origin = 0x00C800, length = 0x000800 RAMLS0 : origin = 0x008000, length = 0x000800 RAMLS1 : origin = 0x008800, length = 0x000800 RAMLS2 : origin = 0x009000, length = 0x000800 RAMLS3 : origin = 0x009800, length = 0x000800 RAMLS4 : origin = 0x00A000, length = 0x000800 RAMLS5 : origin = 0x00A800, length = 0x000800 RAMLS6 : origin = 0x00B000, length = 0x000800 RAMLS7 : origin = 0x00B800, length = 0x000800 RAMGS0 : origin = 0x00D000, length = 0x001000 RAMGS1 : origin = 0x00E000, length = 0x001000 RAMGS2 : origin = 0x00F000, length = 0x001000 RAMGS3 : origin = 0x010000, length = 0x001000 RAMGS4 : origin = 0x011000, length = 0x001000 RAMGS5 : origin = 0x012000, length = 0x001000 RAMGS6 : origin = 0x013000, length = 0x001000 RAMGS7 : origin = 0x014000, length = 0x001000 RAMGS8 : origin = 0x015000, length = 0x001000 RAMGS9 : origin = 0x016000, length = 0x001000 RAMGS10 : origin = 0x017000, length = 0x001000 RAMGS11 : origin = 0x018000, length = 0x001000 RAMGS12 : origin = 0x019000, length = 0x001000 RAMGS13 : origin = 0x01A000, length = 0x001000 RAMGS14 : origin = 0x01B000, length = 0x001000 RAMGS15 : origin = 0x01C000, length = 0x000FF8 // RAMGS15_RSVD : origin = 0x01CFF8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */ /* Flash sectors */ FLASH0 : origin = 0x080002, length = 0x001FFE /* on-chip Flash */ FLASH1 : origin = 0x082000, length = 0x002000 /* on-chip Flash */ FLASH2 : origin = 0x084000, length = 0x002000 /* on-chip Flash */ FLASH3 : origin = 0x086000, length = 0x002000 /* on-chip Flash */ FLASH4 : origin = 0x088000, length = 0x008000 /* on-chip Flash */ FLASH5 : origin = 0x090000, length = 0x008000 /* on-chip Flash */ FLASH6 : origin = 0x098000, length = 0x008000 /* on-chip Flash */ FLASH7 : origin = 0x0A0000, length = 0x008000 /* on-chip Flash */ FLASH8 : origin = 0x0A8000, length = 0x008000 /* on-chip Flash */ FLASH9 : origin = 0x0B0000, length = 0x008000 /* on-chip Flash */ FLASH10 : origin = 0x0B8000, length = 0x002000 /* on-chip Flash */ FLASH11 : origin = 0x0BA000, length = 0x002000 /* on-chip Flash */ FLASH12 : origin = 0x0BC000, length = 0x002000 /* on-chip Flash */ FLASH13 : origin = 0x0BE000, length = 0x001FF0 /* on-chip Flash */ // FLASH13_RSVD : origin = 0x0BFFF0, length = 0x000010 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */ CPU1TOCPU2RAM : origin = 0x03A000, length = 0x000800 CPU2TOCPU1RAM : origin = 0x03B000, length = 0x000800 CPUTOCMRAM : origin = 0x039000, length = 0x000800 CMTOCPURAM : origin = 0x038000, length = 0x000800 CANA_MSG_RAM : origin = 0x049000, length = 0x000800 CANB_MSG_RAM : origin = 0x04B000, length = 0x000800 RESET : origin = 0x3FFFC0, length = 0x000002 CLA1_MSGRAMLOW : origin = 0x001480, length = 0x000080 CLA1_MSGRAMHIGH : origin = 0x001500, length = 0x000080 } SECTIONS { codestart : > BEGIN, ALIGN(8) .text : >> FLASH1 | FLASH2 | FLASH3 | FLASH4, ALIGN(8) .cinit : > FLASH1, ALIGN(8) .switch : > FLASH1, ALIGN(8) .reset : > RESET, TYPE = DSECT /* not used, */ .stack : > RAMM1 #if defined(__TI_EABI__) .init_array : > FLASH1, ALIGN(8) .bss : > RAMLS3 .bss:output : > RAMLS3 .data : > RAMLS4 .sysmem : > RAMLS4 /* Initalized sections go in Flash */ .const : > FLASH5, ALIGN(8) #else .pinit : > FLASH1, ALIGN(8) .ebss : > RAMLS3 .esysmem : > RAMLS4 /* Initalized sections go in Flash */ .econst : >> FLASH4 | FLASH5, ALIGN(8) #endif MSGRAM_CPU1_TO_CPU2 : > CPU1TOCPU2RAM, type=NOINIT MSGRAM_CPU2_TO_CPU1 : > CPU2TOCPU1RAM, type=NOINIT MSGRAM_CPU_TO_CM : > CPUTOCMRAM, type=NOINIT MSGRAM_CM_TO_CPU : > CMTOCPURAM, type=NOINIT dclfuncs : > FLASH1, ALIGN(8) /* CLA specific sections */ #if defined(__TI_EABI__) Cla1Prog : LOAD = FLASH4, RUN = RAMLS5, LOAD_START(Cla1funcsLoadStart), LOAD_END(Cla1funcsLoadEnd), RUN_START(Cla1funcsRunStart), LOAD_SIZE(Cla1funcsLoadSize), ALIGN(8) #else Cla1Prog : LOAD = FLASH4, RUN = RAMLS5, LOAD_START(_Cla1funcsLoadStart), LOAD_END(_Cla1funcsLoadEnd), RUN_START(_Cla1funcsRunStart), LOAD_SIZE(_Cla1funcsLoadSize), ALIGN(8) #endif CLADataLS0 : > RAMLS0 CLADataLS1 : > RAMLS1 Cla1ToCpuMsgRAM : > CLA1_MSGRAMLOW, type=NOINIT CpuToCla1MsgRAM : > CLA1_MSGRAMHIGH, type=NOINIT Cla1DataRam : >> RAMLS0 | RAMLS1 /* CLA C compiler sections */ // // Must be allocated to memory the CLA has write access to // CLAscratch : { *.obj(CLAscratch) . += CLA_SCRATCHPAD_SIZE; *.obj(CLAscratch_end) } > RAMLS1 .scratchpad : > RAMLS1 .bss_cla : > RAMLS1 cla_shared : > RAMLS1 #if defined(__TI_EABI__) .const_cla : LOAD = FLASH2, RUN = RAMLS1, RUN_START(Cla1ConstRunStart), LOAD_START(Cla1ConstLoadStart), LOAD_SIZE(Cla1ConstLoadSize) #else .const_cla : LOAD = FLASH2, RUN = RAMLS1, RUN_START(_Cla1ConstRunStart), LOAD_START(_Cla1ConstLoadStart), LOAD_SIZE(_Cla1ConstLoadSize) #endif #if defined(__TI_EABI__) .TI.ramfunc : {} LOAD = FLASH3, RUN = RAMD0, LOAD_START(RamfuncsLoadStart), LOAD_SIZE(RamfuncsLoadSize), LOAD_END(RamfuncsLoadEnd), RUN_START(RamfuncsRunStart), RUN_SIZE(RamfuncsRunSize), RUN_END(RamfuncsRunEnd), ALIGN(8) #else .TI.ramfunc : {} LOAD = FLASH3, RUN = RAMD0, LOAD_START(_RamfuncsLoadStart), LOAD_SIZE(_RamfuncsLoadSize), LOAD_END(_RamfuncsLoadEnd), RUN_START(_RamfuncsRunStart), RUN_SIZE(_RamfuncsRunSize), RUN_END(_RamfuncsRunEnd), ALIGN(8) #endif } /* //=========================================================================== // End of file. //=========================================================================== */
How we are loading cla code into Ls ram ?
You need some initialisation code like this:
extern uint32_t Cla1funcsRunStart, Cla1funcsLoadStart, Cla1funcsLoadSize; // // Copy over code from FLASH to RAM // memcpy((uint32_t *)&Cla1funcsRunStart, (uint32_t *)&Cla1funcsLoadStart, (uint32_t)&Cla1funcsLoadSize);
how the compiler comes to know it should keep the functions in .cla source file
Program code in your CLA file is automatically allocated to output section Cla1Prog. You can then choose where (i.e. which FLASH sector).to locate Cla1Prog in your linker file.
Hi Stevin,
Compiler will take care of placing the CLA code/data/const to separate sections like Cla1Prog, bss_cla, const_cla etc. All the files with extension .cla is compiled by CLA compiler and sections are defined accordingly.
Regards,
Veena
Should nt we specify the section by some method like
No you don't need a #pragma section because the CLA compiler always uses output section "Cla1Prog". The section name is hardwired into the compiler so you don't need to specify anything.
Hello all,
Soooo thank you for all the fast response, I get it now.
Thanks and regards,
Stevin Martin