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 assembly Code

Hi, I have few questions on how to write the assembly code in cla.

1. How to define initialized data?

My example:

.sect "Cla0Data"

_CLASineTable:

        .float 0.0

        .float 0.1

        ...

_CLASineTableEnd:

Am I right?  As they are in Ram, Does it work every time 28035 power up?

2. How to get the value in the CLASineTable?

I want to do the this: ResultA = 1000.0 * CLASineTable[Count];

But I do not know how to get the value of CLASineTable[Count] using the cla assembly ?

 

Thanks a lot.

 

 

  • Hi,

    Which controller are you using? In general, I guess you might've already read this doc:

    http://www.ti.com/lit/ug/spruge6b/spruge6b.pdf

    Regards,

    Gautam

  • I am using F28035.

    I have read that doc, but I can not find out the answer from it.

  • Hi Edwin,

    Edwin69632 said:
    Am I right?  As they are in Ram, Does it work every time 28035 power up?

    No you would have to place in flash and then copy over to RAM. Since this is the f28035, the CLA can have mastership over RAMLS0 and RAMLS1. You will need to define the section in the linker command as follows:

    Cla0Data : LOAD = FLASHB,
    RUN = RAMLS0,
    LOAD_START(_Cla0DataLoadStart),
    LOAD_END(_Cla0DataLoadEnd),
    RUN_START(_Cla0DataRunStart),
    LOAD_SIZE(_Cla0DataLoadSize),
    PAGE = 1

    In main.c you will need to declare these variables as extern and memcpy the section before giving ownership of RAMLS0 to the CLA so :

    extern uint32_t Cla0DataLoadStart, Cla0DataLoadEnd, Cla0DataRunStart, Cla0DataLoadSize;

    memcpy((uint32_t *)&Cla0DataRunStart ,(uint32_t *)&Cla0DataLoadStart, (uint32_t)&Cla0DataLoadSize);

    You dont strictly need the End Variable but we usually leave it in there.

    Edwin69632 said:
    But I do not know how to get the value of CLASineTable[Count] using the cla assembly ?

    In the .asm file add the line .global _CLASineTable

    Edwin69632 said:

    I want to do the this: ResultA = 1000.0 * CLASineTable[Count];

    Im assuming you are using this line in a .cla file. Add the following declaration to the header file:

    float CLASineTable[TABLE_SIZE]

  • Thanks, Vishal_Coelho.

    About the question 2, I am using the ccs 3.3 .

    So I do not use a.cla file. I want to know how to get the value of CLASineTable[Count] in cla assembly.

    I did that like this:

    MMOVZ16      MR0, @_CLASineTableCount
    MMOV16       MAR0, MR0, #_CLASineTable
    MMOVF32       MR1, *MAR0

    but It did not work.

     

  • The CLA uses an unprotected pipeline, you need to put in 3 MNOPs in between the MMOV16 MAR0,... and the MMOVF32 MR1 instructions