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.

TMS320F28388D: How to choose between a #pragma directive and the equivalent GCC-style attribute?

Part Number: TMS320F28388D

Tool/software:

Hi everyone,

The TMS320C28x compiler has many features that can be used either via a #pragma directive or via function and variable attributes.

For example:

  • __attribute__((always_inline)) is equivalent to #pragma FUNC_ALWAYS_INLINE
  • __attribute__((interrupt)) is equivalent to #pragma INTERRUPT
  • etc.

I need to write a coding standard for a new project and I'd like to include a rule that defines which of the the two approaches must be adopted.

I am pretty certain that I read somewhere in an official document from Texas Instruments that the attribute approach is considered to be superior and more "modern" than the pragma approach, but I can't seem to find this source anymore. Can someone from Texas Instruments confirm or correct this assumption? Is one of the two approaches more likely to be deprecated at some point in the future?

Kind Regards,

Pierre

  • Pierre

    Sorry for the delayed response on this thread. 

    Which compiler version are you using?

    I would recommend to use the "attribute" option instead of "#pragma" .  There are several pragma directives that are not supported in ticlang compiler.

    Best regards

    Siddharth 

  • Siddharth,

    I am using C2000 Code Generation Tools v22.6.10.LTS.

    Is there a specific reason behind the choice not to support all pragma directives in new compilers such as ticlang? Is it more like a general trend that the "attribute" option is considered to be better regardless of the platform?

    Best Regards,
    Pierre