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.

CCS/TMS320F28377S: ASM function

Part Number: TMS320F28377S

Tool/software: Code Composer Studio

I defined two global arrays in C program, Uint16 x[80] and Uint32 y[80]. C language program calls assembly language program to calculate x[i]+y[i]+y[0], and returns long integers. C prototype of the function is Uint32 LayPos(Uint16 i).Here is the assembly language program for the function:

_LayPos:

    MOV  @AR0,  AL

    MOVW   DP,   #_x

    MOVL   XAR4,    @_x

    MOVU  ACC,  *+XAR4[AR0]

    MOVW   DP,   #_y

    MOVL     XAR5,    @_y

    ADDUL  ACC,  *+XAR5[AR0]

     ADDUL  ACC,  *+XAR5[0]

    LRETR

The above procedures can not achieve the desired results. Where is the mistake? Is it an addressing mode error?

How to view the assembly language code of C function in CCS 6.1.0?

  • Sorry, I see now what you are asking. When you want to load a variable address directly into an XAR you don't need the DP. You'll only need that if you are using direct addressing with a later instruction. Providing x and y are in the low 22-bits of data space you can do it with one MOVL instruction. Your code would look like this:

    _LayPos:

    MOV @AR0, AL

    MOVL XAR4, #_x

    MOVU ACC, *+XAR4[AR0]

    MOVL XAR5, #_y

    ADDUL ACC, *+XAR5[AR0]

    ADDUL ACC, *+XAR5[0]

    LRETR

    This is working on my machine.

    In CCS v6, in the debug perspective, you should be able to open a disassembly window from the pull-down menus: "View -> Disassembly". You will see the C and dis-assembly inter-leaved as you step through the code. Also, you can set the "-k" compiler option in project properties so the generated assembly files are not deleted after build.

    Regards,

    Richard