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.

Compiler/TMS320F28379D: global variables in assembler-code

Part Number: TMS320F28379D

Tool/software: TI C/C++ Compiler

Hello together,

in my project i'm working with c-and assembler-code.

In one of my assembler-code-files i want to directly use a global c-variable. Is this somehow possible?

I'm using CCS v6.2.0.00050 and compiler version TI v18.1.3.LTS.

kind regards Ralf

  • Ralf,

    It is possible to reference a global variable extern'ed in a C header file using the .cdecls assembly directive. For example:

    C header file "example.h":

    extern volatile float OscVal;

    Assembly file:

    .cdecls C,WARN,NOLIST,"example.h"

    Assembly code:

    MOVW DP, #_OscVal
    MOV32 R1H, @_OscVal

    "OscVal" becomes a .global from the point of view of the assembly code, so you need to ensure it is treated as the same type in both files. For more information, see the C28x Assembly Language Tools Guide (spru513q).

    Regards,

    Richard
  • Thanks for the fast response and hint to the Assembly Tools Guide.

    Regards Ralf