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/TMS320F28377D: accessing C structure members in c28x assembly_

Part Number: TMS320F28377D
Other Parts Discussed in Thread: CONTROLSUITE

Tool/software: TI C/C++ Compiler

Hello,

There was a related question "accessing C structure members in c28x assembly" which gave an example how to do this. I copied the example code 

but I still get an error E0009 "Missing struct/union member or tag" in the assembler file. The .cdecls directive seems to work partly though, because I have

other variable and array definitions in the same linked header file, and they come ok in the assembler file, only the union and structure references do not work.

Maybe there are some properties settings in the compiler that need to be switched on? I also use a rather old compiler version, v.6.4.12.

Please help,

Jouko

  • Jouko Viitanen said:
    Maybe there are some properties settings in the compiler that need to be switched on?

    No.  The .cdecls directive alone should do it.

    Is there any way you could provide a cutdown example of the problem?  Remember to include the compiler version and all the build options.

    Thanks and regards,

    -George

  • Hi,

    Here are the dummy code snippets:

    // in the C program I have defined the struct, and for comparison one float variable as follows:

    struct MY_STRUCT{
        int M1;
        int M2;
        float M3;
    };
    struct MY_STRUCT MyStruct;
    float test9;
    // they work in the C program.
    //
    // Then the header file "F28x_Project.h" contains the following declarations:
    extern struct MY_STRUCT MyStruct;
    extern float test9;
    //
    // And then the  asm-program tries to access first the struct member and then the test9 variable identically,
    // The former gives the message "E0009 Missing struct/union member or tag", but the latter does not give any error message. 
    //
     .cdecls C, LIST
    %{
     #include"F28x_Project.h"
    %}
           .def _HG
           .sect ".TI.ramfunc"
           .global  __HG
    _HG:
      MOVL @_MyStruct.M3,ACC
      MOVL @_test9,ACC
    ; etc
    ;etc
    The CCS version is 9.1.0
    The compiler version and build options can be seen here:
    Building file: "../HG.asm"
    Invoking: C2000 Compiler
    "C:/ti/ccs910/ccs/tools/compiler/ti-cgt-c2000_6.4.12/bin/cl2000" -v28 -ml -mt --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --cla_support=cla1 -Ooff --opt_for_speed=5 --fp_reassoc=on --fp_mode=relaxed --include_path="C:/ti/ccs910/ccs/tools/compiler/ti-cgt-c2000_6.4.12/include" --include_path="C:/ti/ccs910/ccs/tools/compiler/ti-cgt-c2000_6.4.12/lib" --include_path="D:/controlSUITE/device_support/F2837xD/v200/F2837xD_common/include/FlashAPI" --include_path="D:/controlSUITE/device_support/F2837xD/v200/F2837xD_headers/include" --include_path="D:/controlSUITE/device_support/F2837xD/v200/F2837xD_common/include" --include_path="D:/controlSUITE/device_support/F2837xD/v200/F2837xD_headers" --advice:performance=all --symdebug:none --define=CPU1 --define=_FLASH --diag_warning=225 --display_error_number -k --preproc_with_compile --preproc_dependency="HG.d_raw"  "../HG.asm"
    4 Assembly Errors, No Assembly Warnings
     
    >> Compilation failure
    subdir_rules.mk:23: recipe for target 'HG.obj' failed
    "../HG.asm", ERROR!   at line 40: [E0009] Missing struct/union member or tag
       MOVL @MyStruct.M3,ACC
    Cheers,
    Jouko
  • One of the header files included inside the .cdecls lines must contain this full definition of MY_STRUCT ...

    Jouko Viitanen said:
    struct MY_STRUCT{
        int M1;
        int M2;
        float M3;
    };

    That is the only way the assembler knows about members of the structure such as M3.

    Thanks and regards,

    -George

  • Hi,

    Yes, I tried also with the full definition in the header file, but still got the same error message.

    Jouko

  • Jouko Viitanen said:
    I tried also with the full definition in the header file, but still got the same error message.

    Unfortunately, I cannot reproduce this behavior.  I'd appreciate if you would submit a test case which I can build that demonstrates this problem.  Maybe it makes sense to submit a CCS project.  Keep in mind it only has to build far enough to demonstrate this problem.  It does not have to link or run.  Package up the project as described in the article Sharing Projects.  Then attach the zip file to the next post.

    Thanks and regards,

    -George

  • Ok, I may try to check this later, but I was quite busy to go on with this project, and this was not a big problem in this case:

    I am using an union on the C program side to allow loading of an array with interleaved different data types to the 

    assembler program. When the reference is done using just a pointer, it is passed through with the .cdecls directive without any error 

    message (and the assembler obviously does not care what types of data is loaded to the registers). 

    Probably this is just a problem with the old compiler version.

    Thanks anyway,

    Jouko