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: Question Regarding __asm() Statement

Part Number: TMS320F28377D

Tool/software: TI C/C++ Compiler

I have previously written assembly code for the C2000 utilizing the .cdecls statement to share structure definitions from header files. In my current project we want to write small sections of code in assembly using the __asm("   INST") statement so we can make the code as efficient as possible. The code/functions are too complicated to write the entire functions in assembly code. Is there a way to have the .cdecls statements generated when compiling a C file for specific header files so that the generated assembly code has the .cdecls statements? It would be very helpful to use structure elements in __asm() statments { i.e. __asm("   MOVL ACC, struct.var1")} but I have not found a way to do this.

Thank you,

Rolf Olsen

  • Rolf Olsen said:
    Is there a way to have the .cdecls statements generated when compiling a C file

    Unfortunately, that is not supported.

    An alternative I encourage you to consider ... Instead of __asm statements, use intrinsics.  They are a very similar to assembly instructions, but they operate on C variables.  Please search the C28x compiler manual for the section titled Using Intrinsics to Access Assembly Language Statements.

    Thanks and regards,

    -George

  • George,
    Thank you for your response. I am familiar with the intrinsic statements supported by the C2000 and I do use them when I can. Is the functionality that I asked about something that could be added in the future? It seem helpful to have the ability to address structure elements in __asm() statements. Unless I am overlooking something it seems like this could be accomplished by having a compiler mechanism to insert necessary .cdecl statements for the assembler.
  • Rolf Olsen said:
    Is the functionality that I asked about something that could be added in the future?

    Unfortunately, no.  The implementation of .cdecls, in the assembler, is actually quite complex.  It puts the .cdecls lines into a temporary file, then invokes the compiler on that temporary file, gets the results back in another temporary file, and so on.  I can't recall the exact reason this is not supported from within an __asm statement.  I think it is impractical, and maybe even impossible.

    Thanks and regards,

    -George