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.

TMS320F28377S: LS 05 Ram does not get loaded with ClaProg program code

Part Number: TMS320F28377S
Other Parts Discussed in Thread: C2000WARE, CCSTUDIO

I am working on proof of function of the CLA  on a TMS320F28377S.  Well am certain it works, but demonstrating it works in our code base is the question.

I am using the mathworks example c28377Sblink_cla, that generates CLA code as prototype.  I modified the mathworks example to be even simpler.

In the end I have a .cla and .c files from the code generator.  using the mathworks linker control file,  I added the code and modified an existing linker control file.

In Flash:

Cla1funcsLoadStart
75D0    8100    74C0    00F4    7AC0    810C    7590    003C    7BC0    003D    7BC0    003C    7B40    003D    7B80    003C    7BC0    003C    7B80
0004    7F20    0000    7FA0    0000    7FA0    0000    7FA0    0024    7981    0000    7FA0    0000    7FA0    0000    7FA0    8106    7580    0000
7841    003C    7BC0    003C    7B80    0004    7F20    0000    7FA0    0000    7FA0    0000    7FA0    0008    7981    0000    7FA0    0000    7FA0
0000    7FA0    8106    7580    810C    75C0    4502    7841    8100    73C0    3000    7881    0004    7C20    8102    74C0    8100    73C0    4502
7841    00F0    7A80    3000    7881    0004    7C20    8104    74C0    0000    7842    406B    7580    0000    7841    FFFF    7882    0004    7C60
8102    73D0    0005    7EA0    0019    7C60    0004    7C80    406B    75C0    0000    7842    0000    7841    FFFF    7882    416B    7580    0004
7C60    8104    73D0    0005    7EA0    0019    7C60    0004    7C80    416B    75C0    0000    79AF    0000    7FA0    0000    7FA0    0000    7FA0
8108    73C0    1480    74C0    3842    7841    1502    73C0    2E45    7881    0004    7C00    40C9    7841    0FDB    7881    810A    0110    0004
7C20    8102    74C0    06D8    799F    0000    7FA0    0000    7FA0    0000    7FA0    0000    7D80    8100    74C0    40C9    7840    8102    73D0
0FDB    7880    0001    7D00    0000    7FA0    0000    7FA0    0000    7FA0    0018    7984    0000    7FA0    0000    7FA0    0000    7FA0    40C9
7840    0FDB    7880    0004    7C40    810A    74C0    000C    798E    0000    7FA0    0000    7FA0    0000    7FA0    00F4    7AC0    810A    74C0
0000    7841    8108    73C0    0001    7881    0004    7CC0    8108    74C0    0000    7FA0    0000    7FA0    0000    7FA0    0000    7F80
C$SW5, Cla1funcsLoadEnd

I LS 05 ram:  is not loaded.

Cla1funcsRunStart, HAL_MODULATION_fnProcess, c
0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000
0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000
0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000
0000    0000    0000
C$L1
0000    0000    0000    0000
C$L2
0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000
0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000
0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000
0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000
Cla1Task1, c
0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000
0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000
0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000
0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000    0000
C$L1

Linker command file:

  RAMLS_CLA_PROG      : origin = 0x00A800, length = 0x000800
  /* Control Law Accelerator (CLA) program code section */
  Cla1Prog        : LOAD = FLASH_CODE,
                    RUN = RAMLS_CLA_PROG,
                    LOAD_START(_Cla1funcsLoadStart),
                    LOAD_END(_Cla1funcsLoadEnd),
                    RUN_START(_Cla1funcsRunStart),
                    LOAD_SIZE(_Cla1funcsLoadSize),
                    PAGE = 0, ALIGN(4)

related GEL file lines

    *(int *)0x5F432 =0x003F;      /* RAM INIT FOR LS0..LS5  Memory    */

    /* Program memory maps */
    GEL_MapAddStr(0x00008000,0, 0x800, "R|W|AS2",0);                     /*   LS0 RAM (with PARITY) (4KBytes)                         */
    GEL_MapAddStr(0x00008800,0, 0x800, "R|W|AS2",0);                     /*   LS1 RAM (with PARITY) (4KBytes)                         */
    GEL_MapAddStr(0x00009000,0, 0x800, "R|W|AS2",0);                     /*   LS2 RAM (with PARITY) (4KBytes)                         */
    GEL_MapAddStr(0x00009800,0, 0x800, "R|W|AS2",0);                     /*   LS3 RAM (with PARITY) (4KBytes)                         */
    GEL_MapAddStr(0x0000A000,0, 0x800, "R|W|AS2",0);                     /*   LS4 RAM (with PARITY) (4KBytes)                         */
    GEL_MapAddStr(0x0000A800,0, 0x800, "R|W|AS2",0);                     /*   LS5 RAM (with PARITY) (4KBytes)                         */

    /* Data memory maps */
    GEL_MapAddStr(0x00008000,1, 0x800, "R|W|AS2",0);                     /*   LS0 RAM (with PARITY) (4KBytes)                         */
    GEL_MapAddStr(0x00008800,1, 0x800, "R|W|AS2",0);                     /*   LS1 RAM (with PARITY) (4KBytes)                         */
    GEL_MapAddStr(0x00009000,1, 0x800, "R|W|AS2",0);                     /*   LS2 RAM (with PARITY) (4KBytes)                         */
    GEL_MapAddStr(0x00009800,1, 0x800, "R|W|AS2",0);                     /*   LS3 RAM (with PARITY) (4KBytes)                         */
    GEL_MapAddStr(0x0000A000,1, 0x800, "R|W|AS2",0);                     /*   LS4 RAM (with PARITY) (4KBytes)                         */
    GEL_MapAddStr(0x0000A800,1, 0x800, "R|W|AS2",0);                     /*   LS5 RAM (with PARITY) (4KBytes)                         */


Any comments?

Can gel commands blocking something?

thanks
  • Hello,

    In the system initialization for the project, does the C28x perform a copy of code from flash to RAM?  This will be for any C28x code you want to run from RAM as well as the CLA code.  ?  

    There are examples of this in the C2000Ware driverlib examples for CLA. 

    Regards

    Lori

  • I will try tomorrow.

    Thanks

  • I added the following lines to copy the code:

    // <Step 2>: use void * memcpy ( void * destination, const void * source, size_t num )
      //           to copy over the "Cla1Prog" and ".const_cla" sections from Flash to RAM
      memcpy((uint32_t *)&Cla1ProgRunStart, (uint32_t *)&Cla1ProgLoadStart,
          (uint32_t)&Cla1ProgLoadSize );
      memcpy((uint32_t *)&Cla1ConstRunStart, (uint32_t *)&Cla1ConstLoadStart,
          (uint32_t)&Cla1ConstLoadSize );
    

    but the code does not build; the linker does not find those symbols.
    Cla1ProgRunStart, Cla1ProgLoadStart, Cla1ProgLoadSize, ect.

    I tried an example in the c200
    C:\ti\c2000\C2000Ware_3_03_00_00\driverlib\f2837xs\examples\cpu1\cla
    It too fails if I cause _FLASH to be 1.

    Please advise on the next step




  • I was able to build the

    C:\ti\c2000\C2000Ware_3_03_00_00\driverlib\f2837xs\examples\cpu1\cla

    example, when set the configuration to FLASH

    No how to make it work on my project?

    where most of the lines in the .cproject  have lines starting like this:

    <option id="com.ti.ccstudio.buildDefinitions.C2000_18.1.linkerID.....

    Im lost at the moment.

  • Marlo Gothe said:
    the linker does not find those symbols.
    Cla1ProgRunStart, Cla1ProgLoadStart, Cla1ProgLoadSize, ect.

    In the C code these should be defined as extern since the linker itself will create them when it creates the section (refer to your linker .cmd file fragment in the first post)

    extern uint32_t Cla1ProgRunStart, Cla1ProgLoadStart, Cla1ProgLoadSize .... .etc

    You may find the "getting started" resources listed here helpful - in particular the CLA hands on workshop. 

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

  • Sorry for the delay,

    With this code change:

    extern uint32_t Cla1ProgRunStart, Cla1ProgLoadStart, Cla1ProgLoadSize;
    extern uint32_t Cla1ConstRunStart, Cla1ConstLoadStart, Cla1ConstLoadSize;

      memcpy((uint32_t *)&Cla1ProgRunStart, (uint32_t *)&Cla1ProgLoadStart,
          (uint32_t)&Cla1ProgLoadSize );
      memcpy((uint32_t *)&Cla1ConstRunStart, (uint32_t *)&Cla1ConstLoadStart,
          (uint32_t)&Cla1ConstLoadSize );

     undefined          first referenced
      symbol                in file      
     ---------          ----------------
     _Cla1ProgLoadSize  ./mbd/mbd_cla.obj
     _Cla1ProgLoadStart ./mbd/mbd_cla.obj
     _Cla1ProgRunStart  ./mbd/mbd_cla.obj
     
    error #10234-D: unresolved symbols remain
    error #10010: errors encountered during linking;

    -----------------------------------------------------------

    If i comment out the program labels,  it builds.

    because at this moment there are no cla constants at this time 

    //extern uint32_t Cla1ProgRunStart, Cla1ProgLoadStart, Cla1ProgLoadSize;
    //memcpy((uint32_t *)&Cla1ProgRunStart, (uint32_t *)&Cla1ProgLoadStart,
    //      (uint32_t)&Cla1ProgLoadSize );

    we are using ccs8  and ccs9

    Please advise again.

  • The names should match what is in the linker file.  i.e. are you using Cla1funcs... or ClaProg...  

    This is what was in the original post?

      RAMLS_CLA_PROG      : origin = 0x00A800, length = 0x000800
      /* Control Law Accelerator (CLA) program code section */
      Cla1Prog        : LOAD = FLASH_CODE,
                        RUN = RAMLS_CLA_PROG,
                        LOAD_START(_Cla1funcsLoadStart),
                        LOAD_END(_Cla1funcsLoadEnd),
                        RUN_START(_Cla1funcsRunStart),
                        LOAD_SIZE(_Cla1funcsLoadSize),
                        PAGE = 0, ALIGN(4)

  • Hi Lori

    Great, it builds now,  no errors.

    I need to confirm on the hardware which is the next step, the hardware setup i have access to  is  a shared resource,  so hopefully i can confirm this this week.

    Thanks

    Marlo

  • Great, Thank you for letting me know. 

    Cheers

    Lori

  • We have the program code loaded,  the CLA task does not seem to run. 

    evidence is the cla-2-cpu ram does not change nor any internal cla ram changes.

    the algorithm is a simple counter.   it suppose to run from timer0,  it is happening at 21,000 times per second.

    How to i approach debugging this,

    are there cla error registers that might tell me things?

  • In CLA debug,   the CLA program counter always sits at address 0x00B000,  and increments from there.  

  • I some how got the CLA executing (simplified the program to minimum)

    This thread is complete.