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.

cla variable remains zero



Hi all,

I am trying to implement a task in CLA.

 I have taken a global variable and incrementing it while watching it in watch window.

Code is shown below

 

And dis assembly is shown below

 

But it seems that neither the variable is updated nor incremented its value remains 0 only.

 

The variable is taken globally in CLA (I tried taking it locally also)

 

Cla clock is turned on

  CpuSysRegs.PCLKCR0.bit.CLA1 = 1;

Memory allocation is as mentioned below

 

    //

    // Select LS5RAM to be the programming space for the CLA

    // First configure the CLA to be the master for LS5 and then

    // set the space to be a program block

    //

    MemCfgRegs.LSxMSEL.bit.MSEL_LS5 = 1;

    MemCfgRegs.LSxCLAPGM.bit.CLAPGM_LS5 = 1;

 

    //

    // Next configure LS0RAM and LS1RAM as data spaces for the CLA

    // First configure the CLA to be the master for LS0(1) and then

    // set the spaces to be code blocks

    //

    MemCfgRegs.LSxMSEL.bit.MSEL_LS0 = 1;

    MemCfgRegs.LSxCLAPGM.bit.CLAPGM_LS0 = 0;

 

    MemCfgRegs.LSxMSEL.bit.MSEL_LS1 = 1;

    MemCfgRegs.LSxCLAPGM.bit.CLAPGM_LS1 = 0;

 

one more thing when i connect CLA with jtag tool it looks like this

Can you please tell me what am I missing?

  • Hi Keyur,

    Keyur Acharya said:

        MemCfgRegs.LSxMSEL.bit.MSEL_LS1 = 1;

        MemCfgRegs.LSxCLAPGM.bit.CLAPGM_LS1 = 0;

    So it looks like theta (stored in .cla_ebss) is in RAMLS1. So i would view the above two registers in the watch window and make sure those bits are correct. Make sure that writes to MemCfgRegs are wrapped in EALLOW EDIS macros.

    The CLA comes up with no symbol info when you connect to it. What you see is correct, you need to load the symbols to be able to debug in C. Here is a training video that demonstrates the idea:

    training.ti.com/c2000-cla-c-compiler-part-4-debugging-ccsv5

  • Hi vishal,

    Thanks for the reply.

    1)      How could you come to know that the variable is being stored in .cla_ebss? I see nothing like this declared in linker command file. See the image.

    2)      I checked both the registers in watch window and they are correct.

    3)      Yes they are wrapped by EALLOW and EDIS macros.

    4)      I have seen the video of debug but I observe something different than video,

     The program counter of cla “MPC” continues to increment even after MSTOP instruction. (please note that i have only triggered one task of CLA)

    5)      Value of variable “theta” still not change.

  • Keyur Acharya said:
    How could you come to know that the variable is being stored in .cla_ebss? I see nothing like this declared in linker command file. See the image.

    Sorry i meant .bss_cla. 

    From the last snapshot you posted, in the disassembly window you can see task2 actually resides in RAMLS4 (0xa016), so i imagine the section "Cla1Prog" is placed in RAMLS4. It looks like you have configured RAMLS5 as your CLA program RAM?

  • Hi vishal,

    Thanks for the sharp observation. I could not have found that out. :)

    I added following two lines

        MemCfgRegs.LSxMSEL.bit.MSEL_LS4 = 1;

        MemCfgRegs.LSxCLAPGM.bit.CLAPGM_LS4 = 1;

     

    And it works!!

    But I am wondering why the CLA demo codes don’t have same problem?

    As I am checking “cla_divide_cpu01” this demo project.

    There is "2807x_RAM_CLA_lnk_cpu1.cmd" file being used for linking

    That file has merged RAML4 and RAML5 as shown below.

     

    But in demo code also they have made RAML5 as program memory (nothing done about RAML4!) see image below.

     

    I was also doing the same.

    Regards,

    Keyur Acharya

  • Hmm, yeah that needs to be corrected. I guess in the example, you just get lucky with the linker assigning Cla1Prog to RAMLS5 instead of RAMLS4. Ill file a ticket to get that added on the next revision.