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.

CCS not recognizing GCC predefined macros

Other Parts Discussed in Thread: MSP430F449

I'm not able to get CCS to recognize the GNU v4.9.1 predefined macros. Any ideas?

Sample code:
#include <msp430.h>
#ifdef __msp430    
//this one is recognized
#endif
#ifdef __MSP430F449__
//this one is not recognized
#endif
#ifdef __GNUC__
//this one is not recognized
#endif

My system

CCS Version: 6.0.1.201406261800 
Build id: N201406261800

Windows 7 (64bit)

GNU v4.9.1 compiler

  • Charles Savoie said:
    I'm not able to get CCS to recognize the GNU v4.9.1 predefined macros. Any ideas?

    From experimenting found that when a new CCS 6 project was created using either the ARM GNU compiler or MSP430 GNU compiler that the CCS symbol indexer wasn't automatically detecting the GNU compiler predefined macros.

    To make CCS detect the GNU compiler predefined macros I found that it was necessary to:

    - Open the CCS project Properties

    - Select "Show advanced settings"

    - Select the "Providers" tab on C/C++ General -> Preprocessor Include Paths

    - Tick the "CDT GCC Built-in Compiler Settings" provider and un-tick "Use global provider shared between projects"

    This causes CCS to run a command to obtain the GNU compiler specs which lists the predefined macros, and now the CCS symbol indexer recognises the predefined macros.

  • Chester,

    Thank you so much for your help. Your answer did get CCS to recognize the GCC predefined symbols, although I am still having trouble with CCS recognizing the mcu symbol.

    Compiler flags:

     -mmcu=msp430f449 -I"c:/ti/ccsv6/ccs_base/msp430/include_gcc" -I"c:/ti/ccsv6/tools/compiler/gcc_msp430_4.9.14r1_10/msp430-elf/include" -g -gstrict-dwarf -Wall

    Code:

    #ifdef __MSP430F449__
    //do stuff
    #endif

    CSS does not recognize.

    Any Ideas?

    Thank you,

    Charlie

  • Charles Savoie said:
    Your answer did get CCS to recognize the GCC predefined symbols, although I am still having trouble with CCS recognizing the mcu symbol.

    With the default command to get the predefined symbols, GCC isn't told the type of MCU and so doesn't generate the predefined symbol for the MCU.

    As a work-around I found it was possible to edit the command used to get the compiler specs to define the MCU by adding  -mmcu=${DEVICE} to the command, i.e. the complete command is:

    ${COMMAND} -mmcu=${DEVICE} -E -P -v -dD "${INPUTS}"

    With this I was able to get CCS to recognize both the __GNUC__ and __MSP430F449__ predefined symbols.

  • Chester,

    For some strange reason, adding  -mmcu=${DEVICE} to my command string does not work.

    Here's a snapshot of my settings. 

    And here are the results.

    09:41:34 **** Running scanner discovery: CDT GCC Built-in Compiler Settings ****
    g++ -mmcu=MSP430F449 -E -P -v -dD C:/Users/CSavoie/workspace_v6_0/.metadata/.plugins/org.eclipse.cdt.managedbuilder.core/spec.C
    Using built-in specs.
    COLLECT_GCC=g++
    g++: error: unrecognized command line option '-mmcu=MSP430F449'
    Target: mingw32
    Configured with: ../gcc-4.8.1/configure --prefix=/mingw --host=mingw32 --build=mingw32 --without-pic --enable-shared --enable-static --with-gnu-ld --enable-lto --enable-libssp --disable-multilib --enable-languages=c,c++,fortran,objc,obj-c++,ada --disable-sjlj-exceptions --with-dwarf2 --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-runtime-libs --with-gmp=/usr/src/pkg/gmp-5.1.2-1-mingw32-src/bld --with-mpc=/usr/src/pkg/mpc-1.0.1-1-mingw32-src/bld --with-mpfr= --with-system-zlib --with-gnu-as --enable-decimal-float=yes --enable-libgomp --enable-threads --with-libiconv-prefix=/mingw32 --with-libintl-prefix=/mingw --disable-bootstrap LDFLAGS=-s CFLAGS=-D_USE_32BIT_TIME_T
    Thread model: win32
    gcc version 4.8.1 (GCC)

    09:41:34 Build Finished (took 132ms)

    I've tried every combination under the sun. I appreciate your help.

    Thanks,

    Charlie

  • Chester,

    I just rebooted CCS, started a new project with the settings you suggested, and voila! It worked.

    Thank you so much!

    Now I can get on to the next thing that will frustrate me :-)