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.

TMS320F280049C: Linker error for CLA tasks

Part Number: TMS320F280049C
Other Parts Discussed in Thread: C2000WARE

I am working on a power project and want to use the CLA for some parralell control computation, but the linking of the file to initialise the CLA is nor successful.  During linking I get this error:-

Description Resource Path Location Type
unresolved symbol Cla1Task1(), first referenced in ./control/con_cla.obj pro_c C/C++ Problem

I presume it has to do with the linker file and some CLA configuration problem.  I have not been able to find the problem.  Sections of the code is below:

Configuration of my CLA 

my con_cla.c file is below

void InitCla(void)
{

SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_CLA1);

#ifdef _FLASH
//--- Copy the CLA program code from its load address to the CLA program
//--- memory (using memcpy() from RTS library).
memcpy(&Cla1ProgRunStart, &Cla1ProgLoadStart, (uint32_t)&Cla1ProgLoadSize);
#endif

/**< Shared between the CPU and the CLA */
MemCfg_setLSRAMMasterSel(MEMCFG_SECT_LS2, MEMCFG_LSRAMMASTER_CPU_CLA1);
MemCfg_setLSRAMMasterSel(MEMCFG_SECT_LS3, MEMCFG_LSRAMMASTER_CPU_CLA1);
MemCfg_setLSRAMMasterSel(MEMCFG_SECT_LS4, MEMCFG_LSRAMMASTER_CPU_CLA1);
MemCfg_setLSRAMMasterSel(MEMCFG_SECT_LS5, MEMCFG_LSRAMMASTER_CPU_CLA1);


/**< Memory configuration for CLA data or CLA programme memory */
MemCfg_setCLAMemType(MEMCFG_SECT_LS2, MEMCFG_CLA_MEM_PROGRAM);
MemCfg_setCLAMemType(MEMCFG_SECT_LS3, MEMCFG_CLA_MEM_PROGRAM);
MemCfg_setCLAMemType(MEMCFG_SECT_LS4, MEMCFG_CLA_MEM_DATA);
MemCfg_setCLAMemType(MEMCFG_SECT_LS5, MEMCFG_CLA_MEM_DATA);

#pragma diag_suppress=770
CLA_mapTaskVector(CLA1_BASE, CLA_MVECT_1, (uint16_t)&Cla1Task1);
CLA_mapTaskVector(CLA1_BASE, CLA_MVECT_2, (uint16_t)&Cla1Task2);
CLA_mapTaskVector(CLA1_BASE, CLA_MVECT_3, (uint16_t)&Cla1Task3);
CLA_mapTaskVector(CLA1_BASE, CLA_MVECT_4, (uint16_t)&Cla1Task4);
CLA_mapTaskVector(CLA1_BASE, CLA_MVECT_5, (uint16_t)&Cla1Task5);
CLA_mapTaskVector(CLA1_BASE, CLA_MVECT_6, (uint16_t)&Cla1Task6);
CLA_mapTaskVector(CLA1_BASE, CLA_MVECT_7, (uint16_t)&Cla1Task7);
CLA_mapBackgroundTaskVector(CLA1_BASE, (uint16_t)&Cla1Task8);
#pragma diag_warning=770

/**< Map interrupt routines to interrupts */
Interrupt_register(INT_CLA1_1, &Cla1Task1ISR);
Interrupt_register(INT_CLA1_1, &Cla1Task2ISR);
Interrupt_register(INT_CLA1_1, &Cla1Task3ISR);
Interrupt_register(INT_CLA1_1, &Cla1Task4ISR);
Interrupt_register(INT_CLA1_1, &Cla1Task5ISR);
Interrupt_register(INT_CLA1_1, &Cla1Task6ISR);
Interrupt_register(INT_CLA1_1, &Cla1Task7ISR);

/**< select interrupt source */
CLA_setTriggerSource(CLA_TASK_1, CLA_TRIGGER_SOFTWARE);
CLA_setTriggerSource(CLA_TASK_2, CLA_TRIGGER_SOFTWARE);
CLA_setTriggerSource(CLA_TASK_3, CLA_TRIGGER_SOFTWARE);
CLA_setTriggerSource(CLA_TASK_4, CLA_TRIGGER_SOFTWARE);
CLA_setTriggerSource(CLA_TASK_5, CLA_TRIGGER_SOFTWARE);
CLA_setTriggerSource(CLA_TASK_6, CLA_TRIGGER_SOFTWARE);
CLA_setTriggerSource(CLA_TASK_7, CLA_TRIGGER_SOFTWARE);
CLA_setTriggerSource(CLA_TASK_8, CLA_TRIGGER_SOFTWARE);

/**< Disable background task */
CLA_disableBackgroundTask(CLA1_BASE);

/**< enable background task */
CLA_enableBackgroundTask(CLA1_BASE);

/**< Enable use of software to start a task */
CLA_enableIACK(CLA1_BASE);

/**< start background task */
CLA_startBackgroundTask(CLA1_BASE);

/**< Enable CLA task interrupts */
CLA_enableTasks(CLA1_BASE, CLA_TASKFLAG_1);
CLA_enableTasks(CLA1_BASE, CLA_TASKFLAG_2);
CLA_enableTasks(CLA1_BASE, CLA_TASKFLAG_3);
CLA_enableTasks(CLA1_BASE, CLA_TASKFLAG_4);
CLA_enableTasks(CLA1_BASE, CLA_TASKFLAG_5);
CLA_enableTasks(CLA1_BASE, CLA_TASKFLAG_6);
CLA_enableTasks(CLA1_BASE, CLA_TASKFLAG_7);


Interrupt_enable(INT_CLA1_1);
Interrupt_enable(INT_CLA1_2);
Interrupt_enable(INT_CLA1_3);
Interrupt_enable(INT_CLA1_4);
}

Secion of my linker command file is below:

/*** User Defined Sections ***/
dclfuncs : > RAMLS4, PAGE = 1 /* Link dcl functions to RAM */
dmaMemBufs : > RAMGS3, PAGE = 1 /* Link to DMA accessible memory */
Cla1ToCpuMsgRAM : > CLA1_MSGRAMLOW, PAGE = 1 /* Link to CLA Message RAM */
CpuToCla1MsgRAM : > CLA1_MSGRAMHIGH, PAGE = 1 /* Link to CLA Message RAM */
//dclfuncs : > RAMLS4, PAGE = 1 /* Link dcl functions to RAM */
Cla1Data1 : > RAMLS4, PAGE = 1 /* Link to CLA Data RAM */
Cla1Data2 : > RAMLS5, PAGE = 1 /* Link to CLA Data RAM */

/* Section Cla1Prog used by file Cla.c */
Cla1Prog : LOAD = FLASH_BANK0_SEC12, /* Load to flash, run from CLA Program RAM */
RUN = RAMLS2 | RAMLS3,
LOAD_START(_Cla1ProgLoadStart),
//LOAD_END(_Cla1ProgLoadEnd),
RUN_START(_Cla1ProgRunStart),
LOAD_SIZE(_Cla1ProgLoadSize),
PAGE = 0, ALIGN(4)

The linker command file is configured to run the codes from the flash memory

in my .map file the CLA functions are all undefined

 
n/a UNDEFED _Cla1Task1ISR__Fv
n/a UNDEFED _Cla1Task1__Fv
n/a UNDEFED _Cla1Task2ISR__Fv
n/a UNDEFED _Cla1Task2__Fv
n/a UNDEFED _Cla1Task3ISR__Fv
n/a UNDEFED _Cla1Task3__Fv
n/a UNDEFED _Cla1Task4ISR__Fv
n/a UNDEFED _Cla1Task4__Fv

The defination of my CLA task is below

extern interrupt void Cla1Task1();

interrupt void Cla1Task1 (void)
{
// Convert result to signed 16-bit and store

cla_triggers[cla_task1_dc2dc_] = 0;
__asm(" ESTOP0");
}

Please what can the problem be or what have I fogotten to configure?

  • Hi,

    The Cla1Task1 is being mapped to a CLA task but the code snippet posted above is using "ESTOP0" so it looks like it is being defined on the C28 side instead of CLA side. The C2000Ware has some reference examples on using the CLA at "C2000Ware\driverlib\f28004x\examples\cla" directory that will be helpful.

    Thanks,

    Ashwini

  • Also, please refer to the CLA Software Development Guide. It has good information:

    https://software-dl.ti.com/C2000/docs/cla_software_dev_guide/index.html

    Thanks,

    Ashwini

  • Thanks for your reply.  I have gone through the examples and I have removed the "ESTOP0".  I still got the same error 

    - unresolved symbol _Cla1Task1, first referenced in ./control/con_cla.obj

    I presume the task is compile or linker related  or it might be because I am mixing cpp and c code.

    The programme compile but the linking was the problem.  the CLAtasks are not recognised in the initialisaiton function i defined

  • Hi,

    I assume con_cla is C28 source code that is initializing the CLA. If so, does this file include a header file that defines the Cla1Task1. This will be needed in the header file.

    __attribute__((interrupt)) void Cla1Task1(void);

    Thanks,

    Ashwini

  • Thank you Ashwini.

    I just located the problem.  The varible for message between the CPU and CLA was not decleared in the .cla file.

    Now I have another problem.  I get the below error message

    Description Resource Path Location Type
    unresolved symbol _CLA_forceTasks, first referenced in ./control/cont_charg_dc2dc.obj pro_c C/C++ Problem.

    The cont_charg_dc2dc.obj is gotten from the cont_charg_dc2dc.cla file.

    This is from this function below:

    interrupt void Cla1Task8(void)
    {
    if (cla_triggers[cla_task1_dc2dc_] == 1)
    {

    CLA_forceTasks(CLA1_BASE, CLA_TASKFLAG_1);
    }
    }

    I think it is caused by the fact that the CLA_forceTasks is a function that is decleared as an inline in the cla.h file hence the problem.  

    Am i not supposed to use the functions in the cla.h file in my .cla file.  How best am I to solve this error.

    Thanks.

  • Hi,

    The CLA_forceTasks is for use by C28 code as it involves registers accessible by C28 only. The equivalent of this API on the CLA side is CLA_forceSoftwareInterrupt which uses registers accessible by CLA for the same action.

    In the header file the APIs accessible by C28 side are under #ifdef __TMS320C28XX__ and will not be visible to code on the CLA side hence the compiler warning for undefined symbol even though it is defined in the cla.h file.

    Thanks,

    Ashwini