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.

Dynamic Memory allocation in CLA

Other Parts Discussed in Thread: CONTROLSUITE

Hi,

I want to transfer large amount of data from Main CPU to CLA. As the CPUtoCLA Message RAM is limited,  1 )i wish to dynamically allocate memory in CPU (variables in memory CPUtoCLAMessageRAM),  2) transfer data to CLA and  3) free the allocated memory in CLA.  I know how to allocate memory dynamically in CPU. How to free the memory in CLA. What instruction  should i use?

Thanks in advance.

 

K.Sugantha

  • Hi,

    The CLA doesnt have write access to the CPUtoCLAMessageRAM so you cant clear that space from the CLA. If you wish to have the CLA access large data you would have to make that data global and not pass it through the message RAMs.


    In the attached project I have declared a large array in the .econst section in an assembly file under a gloabl symbol _TF. In CLAShared.h I declared this as an external variable

    extern float TF;

    In the CLA.asm file since we are including the CLAShared.h with the cdecls declaration, the symbol for the variable TF was now accessible to the CLA. You can then walk through this array using indirect addressing mode

       MMOVIZ    MR1,0 ;set the offset to 0
       MMOV16    MAR0,MR1,#_TF ; load offset + base (immediate value) address of variable into pointer MAR0
       MNOP  ;place 3 nops here
       MNOP
       MNOP
       MMOV32     MR0,*MAR0[2]++ ; load 1st value of array and increment point to next float location and so forth

    In this way, using a loop in assembly you could also clear the memory or write your own value to a variable

       MMOVIZ    MR2,#0xFFFF
       MMOVXI    MR2,#0xFFFF
       MMOVIZ    MR1,0
       MMOV16    MAR0,MR1,#_TF
       MNOP
       MNOP
       MNOP
       MMOV32    *MAR0[2]++,MR2; etc...

    8244.Piccolo_CLA_TemplateProject.zip

    Please note that the attached zip is just an illustration of the concept, it doenst actually do anything useful

  • Hi,

     

    Thank you very much for the response.

     

    I have one further clarification. CLA documents specifies that CLA can access only  CLA Data Memory , CLA to CPU Msg RAM and CPU to CLA Msg RAM. In the code what you have sent, the variable TF is in sect .econst.  I m not able to locate the .cmd file for this project, but i believe .econst is mapped to FLASH.

    I gather , if a variable is global and located in CLA Data Memory, main CPU can access it if

        Cla1Regs.MMEMCFG.bit.RAM1E = 0;

    and  CLA can access it if

        Cla1Regs.MMEMCFG.bit.RAM1E = 1;

     

    My doubt is, If a variable is global and located in FLASH, is it possible for CLA to access it? I think, no.

    It is sensible that both CLA and CPU should not have access to a variable at the same time. (Say) If CPU is writting to a variable and CLA is also writing to the same variable at the same time, system will crash..

     

    From above arguments, .econst should be mapped to CLA Data Memory..

     

    K.Sugantha

     

     

     

     

     

  • the 28035_RAM_CLA_lnk.cmd was used. It has been linked into the project. You need to have v124 of the Piccolo header files installed and you have to unzip the file to the original path location given in the zip.

    Location :C:\TI\controlSUITE\device_support\f2803x\v124\DSP2803x_common\cmd (if controlsuite was installed in the default location)

    You are correct in saying that the .econst section is mapped to CLA data memory. It is mapped to RAML2 which is also CLA data RAM1. You can use the RAM1E bit to switch the RAM back and forth between the CLA and CPU, although I feel it is much better to use the message Rams if your CLA only has to read the incoming data.

  • Hi,

     

    Thanks once again... i ve understood the concepts.

     

    K.Sugantha