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/TMDSCNCD28388D: name convention C/C++ and assembler

Part Number: TMDSCNCD28388D


Tool/software: TI C/C++ Compiler

Hello All

So

Accordingly

TMS320C28x Optimizing C/C++ Compiler
v18.1.0.LTS
User's Guide

Section 6.11 Object File Symbol Naming Conventions (Linknames) 

For COFF, the compiler places an underscore at the beginning of the linknames of C identifiers, so you
can safely use identifiers that do not begin with an underscore in your assembly code

Dispite this description  F2837xD_cla.h contains struct CLA_REGS

which contains  Uint16                                   _MPC;                         // CLA Program Counter
    Uint16                                   rsvd4;                        // Reserved
    Uint16                                   _MAR0;                        // CLA Auxiliary Register 0
    Uint16                                   _MAR1;                        // CLA Auxiliary Register 1
    Uint16                                   rsvd5[2];                     // Reserved
    union   _MSTF_REG                        _MSTF;                        // CLA Floating-Point Status Register
    union   MR_REG                           _MR0;                         // CLA Floating-Point Result Register 0
    Uint16                                   rsvd6[2];                     // Reserved
    union   MR_REG                           _MR1;                         // CLA Floating-Point Result Register 1
    Uint16                                   rsvd7[2];                     // Reserved
    union   MR_REG                           _MR2;                         // CLA Floating-Point Result Register 2
    Uint16                                   rsvd8[2];                     // Reserved
    union   MR_REG                           _MR3; 

Whithout  lead underscore  the compilation with assembler code which uses the same registers is not posible .

The question is - How to let know to compiler developers to check and fix this feature :-)

Best regards

Andrii

  • Hi,

    I think these names are not compiler specific, the register name itself starts with an underscore.

    Thanks

    Vasudha

  • Hi Vasudha

    I understand, it is nesseccary to explain more detailed this problem.

    I repeat

    For COFF, the compiler places an underscore at the beginning of the linknames of C identifiers, so you
    can safely use identifiers that do not begin with an underscore in your assembly code.

    Without this convention, the C/C++  identifiers can collide with assembly keywords (for instance, register
    names)

    So in normal situation where above mentioned rule is  fulfilled,  the construction

      .cdecls C
       %{
            Uint16   MAR0;     

       %}

    MMOVI16    MAR0,#New_Filtered_DataA2 

    does not leds to compile error because compiller adds leading underscore to C identifier

    I am sorry but leading underscores in the start example are added to change the names because the convention is not fulfilled

    and if delete leading underscore, the compilation is not posible- it leads to error.

    For CLA  , the convention of EABI as well is not fulfilled - the C/C++ identifiers as well collite with Name of registers.

    Best regards

    Andrii Shevchuk

        

  • I am sorry but leading underscores in the start example are added to change the names because the convention is not fulfilled

    and if delete leading underscore, the compilation is not posible- it leads to error. If compile it with assembler code which use the same registers.

  • Hi,

    Andrii Shevchuk said:
    I am sorry but leading underscores in the start example are added to change the names because the convention is not fulfilled

    I don't think the error is due to the compiler not follwing the convention of adding an underscore. Compiler does add the _ before the register name and in this case it would be __MAR0 in assembly since the register name itself is _MAR0. I think these are CPU side registers to read the CLA core registers.

    Thanks

    Vasudha