Despite having followed the instructions from the thread "CCS not recognizing GCC predefined macros", I can not get CCS v6.1 on Linux to discover the predefined macros of Redhat GNU GCC v4.9.1.
For debugging I do the following
- In the global preferences at C/C++ -> Build -> Settings -> Tab: Discovery -> "CDT GCC Built-in Compiler Settings"
- tick the check-box "Allocate console in the Console View"
- OK
- In the project preferences at "Show advances settings" -> C/C++ General -> "Preprocessor Include..." -> Tab: Providers
- tick the check-box "CDT GCC Built-in Compiler Settings"
- OK
Now I get to see the following output in the console named "CDT GCC Built-in Compiler Settings, GNU C":
19:38:19 **** Running scanner discovery: CDT GCC Built-in Compiler Settings **** gcc -E -P -v -dD /home/USER/workspace_v6_1/.metadata/.plugins/org.eclipse.cdt.managedbuilder.core/spec.c Using built-in specs. COLLECT_GCC=gcc Target: x86_64-suse-linux Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,java,ada --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.8 --enable-ssp --disable-libssp --disable-plugin --with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' --disable-libgcj --disable-libmudflap --with-slibdir=/lib64 --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-runtime-libs --enable-linker-build-id --program-suffix=-4.8 --enable-linux-futex --without-system-libunwind --with-arch-32=i586 --with-tune=generic --build=x86_64-suse-linux Thread model: posix gcc version 4.8.1 20130909 [gcc-4_8-branch revision 202388] (SUSE Linux) COLLECT_GCC_OPTIONS='-E' '-P' '-v' '-dD' '-mtune=generic' '-march=x86-64' /usr/lib64/gcc/x86_64-suse-linux/4.8/cc1 -E -quiet -v -P /home/fl/workspace_v6_1/.metadata/.plugins/org.eclipse.cdt.managedbuilder.core/spec.c -mtune=generic -march=x86-64 -dD #include "..." search starts here: #include <...> search starts here: /usr/lib64/gcc/x86_64-suse-linux/4.8/include /usr/local/include #define __STDC__ 1 #define __STDC_HOSTED__ 1 #define __GNUC__ 4 #define __GNUC_MINOR__ 8 #define __GNUC_PATCHLEVEL__ 1 [...OUTPUT TRUNCATED...] #define __STDC_IEC_559__ 1 #define __STDC_IEC_559_COMPLEX__ 1 #define __STDC_ISO_10646__ 201103L #define __STDC_NO_THREADS__ 1 19:38:20 Build Finished (took 91ms)
Instead of calling the MSP430 GCC it calls the system-wide GCC, which is obviously wrong.
To no avail did I try to teach CCS to call the MSP430 GCC binaries instead.
In the global preferences at C/C++ -> Build -> Settings -> Tab: Discovery -> "CDT GCC Built-in Compiler Settings"
- "Command to get compiler specs:"
msp430-elf-${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}" - OK
This did not work because CCS does not update the path as it seems:
19:45:22 **** Running scanner discovery: CDT GCC Built-in Compiler Settings **** msp430-elf-gcc -E -P -v -dD /home/USER/workspace_v6_1/.metadata/.plugins/org.eclipse.cdt.managedbuilder.core/spec.c Cannot run program "msp430-elf-gcc": Unknown reason Error: Program "msp430-elf-gcc" not found in PATH PATH=[/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games] 19:45:22 Build Finished (took 14ms)
However calling the MSP430 GCC binary on the shell does work as expected:
USER@HOST:~> /home/USER/ti-ccs-v6.1/ccsv6/tools/compiler/gcc_msp430_4.9.14r1_167/bin/msp430-elf-gcc -E -P -v -dD /home/USER/workspace_v6_1/.metadata/.plugins/org.eclipse.cdt.managedbuilder.core/spec.c Using built-in specs. COLLECT_GCC=/home/USER/ti-ccs-v6.1/ccsv6/tools/compiler/gcc_msp430_4.9.14r1_167/bin/msp430-elf-gcc Target: msp430-elf Configured with: /opt/redhat/msp430-14r1-167/sources/tools/configure --host=i686-redhat-linux --build=i686-redhat-linux --target=msp430-elf --prefix=/opt/redhat/msp430-14r1-167/i686-redhat-linux --enable-languages=c,c++ Thread model: single gcc version 4.9.1 20140707 (prerelease (msp430-14r1-167)) (GNUPro 14r1) (Based on: GCC 4.8 GDB 7.7 Binutils 2.24 Newlib 2.1) (GCC) COLLECT_GCC_OPTIONS='-E' '-P' '-v' '-dD' /home/USER/ti-ccs-v6.1/ccsv6/tools/compiler/gcc_msp430_4.9.14r1_167/bin/../libexec/gcc/msp430-elf/4.9.1/cc1 -E -quiet -v -P -iprefix /home/USER/ti-ccs-v6.1/ccsv6/tools/compiler/gcc_msp430_4.9.14r1_167/bin/../lib/gcc/msp430-elf/4.9.1/ /home/USER/workspace_v6_1/.metadata/.plugins/org.eclipse.cdt.managedbuilder.core/spec.c -dD ignoring nonexistent directory "/home/USER/ti-ccs-v6.1/ccsv6/tools/compiler/gcc_msp430_4.9.14r1_167/bin/../lib/gcc/msp430-elf/4.9.1/../../../../msp430-elf/sys-include" ignoring duplicate directory "/home/USER/ti-ccs-v6.1/ccsv6/tools/compiler/gcc_msp430_4.9.14r1_167/bin/../lib/gcc/../../lib/gcc/msp430-elf/4.9.1/include" ignoring duplicate directory "/home/USER/ti-ccs-v6.1/ccsv6/tools/compiler/gcc_msp430_4.9.14r1_167/bin/../lib/gcc/../../lib/gcc/msp430-elf/4.9.1/include-fixed" ignoring nonexistent directory "/home/USER/ti-ccs-v6.1/ccsv6/tools/compiler/gcc_msp430_4.9.14r1_167/bin/../lib/gcc/../../lib/gcc/msp430-elf/4.9.1/../../../../msp430-elf/sys-include" ignoring duplicate directory "/home/USER/ti-ccs-v6.1/ccsv6/tools/compiler/gcc_msp430_4.9.14r1_167/bin/../lib/gcc/../../lib/gcc/msp430-elf/4.9.1/../../../../msp430-elf/include" #include "..." search starts here: #include <...> search starts here: /home/USER/ti-ccs-v6.1/ccsv6/tools/compiler/gcc_msp430_4.9.14r1_167/bin/../lib/gcc/msp430-elf/4.9.1/include /home/USER/ti-ccs-v6.1/ccsv6/tools/compiler/gcc_msp430_4.9.14r1_167/bin/../lib/gcc/msp430-elf/4.9.1/include-fixed /home/USER/ti-ccs-v6.1/ccsv6/tools/compiler/gcc_msp430_4.9.14r1_167/bin/../lib/gcc/msp430-elf/4.9.1/../../../../msp430-elf/include End of search list. #define __STDC__ 1 #define __STDC_HOSTED__ 1 #define __GNUC__ 4 #define __GNUC_MINOR__ 9 #define __GNUC_PATCHLEVEL__ 1 #define __VERSION__ "4.9.1 20140707 (prerelease (msp430-14r1-167)) (GNUPro 14r1) (Based on: GCC 4.8 GDB 7.7 Binutils 2.24 Newlib 2.1)" [...OUTPUT TRUNCATED...] #define __MSP430__ 1 #define __MSP430XGENERIC__ 1 #define __MSP430X__ 1 #define __ELF__ 1 COMPILER_PATH=/home/USER/ti-ccs-v6.1/ccsv6/tools/compiler/gcc_msp430_4.9.14r1_167/bin/../libexec/gcc/msp430-elf/4.9.1/:/home/USER/ti-ccs-v6.1/ccsv6/tools/compiler/gcc_msp430_4.9.14r1_167/bin/../libexec/gcc/:/home/USER/ti-ccs-v6.1/ccsv6/tools/compiler/gcc_msp430_4.9.14r1_167/bin/../lib/gcc/msp430-elf/4.9.1/../../../../msp430-elf/bin/ LIBRARY_PATH=/home/USER/ti-ccs-v6.1/ccsv6/tools/compiler/gcc_msp430_4.9.14r1_167/bin/../lib/gcc/msp430-elf/4.9.1/:/home/USER/ti-ccs-v6.1/ccsv6/tools/compiler/gcc_msp430_4.9.14r1_167/bin/../lib/gcc/:/home/USER/ti-ccs-v6.1/ccsv6/tools/compiler/gcc_msp430_4.9.14r1_167/bin/../lib/gcc/msp430-elf/4.9.1/../../../../msp430-elf/lib/ COLLECT_GCC_OPTIONS='-E' '-P' '-v' '-dD'
How can I fix this myself, or is it a CCS bug?