NOTICE: The Processors Wiki will End-of-Life in December of 2020. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

Refer to Compiler Version in Your Source

From Texas Instruments Wiki
Jump to: navigation, search

Sometimes you need to refer to the version of the compiler from your source code. You can use the compiler predefined preprocessor macro __TI_COMPILER_VERSION__. Here is an example.

<syntaxhighlight lang='c'>

// ver_ex.c
// Examples of how to use __TI_COMPILER_VERSION__, the preprocessor
// symbol predefined by all TI compilers
int val = __TI_COMPILER_VERSION__;                   // as an int
#define EVAL_TO_STR(arg) #arg
#define MKSTR(arg) EVAL_TO_STR(arg)
char *cgt_version = MKSTR(__TI_COMPILER_VERSION__);  // as a string

</syntaxhighlight>

Note relatively old versions of TI compilers do not supply __TI_COMPILER_VERSION__. To see if your compiler supports it, preprocess the example with the option -ppc and examine the resulting .pp file. If __TI_COMPILER_VERSION__ is supported, it will look something like this.

C:\dir>cl6x -ppc ver_ex.c
C:\dir>type ver_ex.pp
// ver_ex.c
// Examples of how to use __TI_COMPILER_VERSION__, the preprocessor
// symbol predefined by all TI compilers
int val = 6001000;                   // as an int
char *cgt_version = "6001000";  // as a string
E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Refer to Compiler Version in Your Source here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Refer to Compiler Version in Your Source here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article Refer to Compiler Version in Your Source here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article Refer to Compiler Version in Your Source here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article Refer to Compiler Version in Your Source here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Refer to Compiler Version in Your Source here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Refer to Compiler Version in Your Source here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article Refer to Compiler Version in Your Source here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article Refer to Compiler Version in Your Source here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity