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.

C2000/TMS320F28375D: declaring extern array in C to assembler?

Part Number: TMS320F28375D

Tool/software: TI C/C++ Compiler

small question:

If I have:

file1.c

float myVar[2] = {1.0, 2.0};

file2.c

extern float myVar[2];

file3.asm

.global _myVar

The above works for a single float var,

Q:  how do I pass an array of floats to assembler defined in a C file?

Q:  how do I address the array of floats in assembler?

MOV32    DP, #_myVar

MOV32    R?H, @_myVar

this is what would be done for the single var, how would I acces the 2nd array element?

Do I just do
MOVL    XAR#, #_myVar

MOV32   R?H, *XAR#+[0]

MOV32   R?H, *XAR#+[2]

  • A1: what do you mean "pass?" If you declare an array in C with external linkage, it's accessible to the whole program. Just using .global makes it visible to the assembly code. If you mean something more than that, I'm not sure what you mean.

    A2: Yes, or you could use MOV32 R?H, @(_myvar + 2)