# Difference between gcc and gcc-msp430

What is the difference between using gcc versus using gcc-msp430? When I run man gcc, there are msp430 options that I can set using -mmcu=. However, whenever I run gcc to compile a code for the msp430, I get the following error:

\$ gcc -Os -Wall -g -mmcu=msp430g2553 -c main.c
gcc: error: unrecognized command line option ‘-mmcu=msp430g2553’
make: *** [Makefile:11: main.o] Error 1


What is wrong here? I'm on Fedora Linux if that makes a difference.

• @old_timer gcc is not a single target compiler. I've used it for years to compile for ARM targets. Where are you getting this notion? – Elliot Alderson Aug 11 '18 at 22:43
• @ElliotAlderson gcc can be compiled for a list of targets but it only supports one instruction set per build of gcc. So a gcc compiled to build x86 code will not build msp430 nor arm, etc. A gcc compiled to build arm code will not build x86, msp430, mips, etc – old_timer Aug 11 '18 at 22:46
• So gcc supports one ISA at a time. Single target. – old_timer Aug 11 '18 at 22:47
• You didn't misunderstand. You can use gcc to compile for msp430, but only if gcc itself is compiled with support for msp430. If you've installed gcc under linux then you probably got the native compiler, where gcc itself is compiled for an x86 architecture and produces code for an x86 architecture. For many years I used gcc, running on x86, to compile code for embedded ARM targets. – Elliot Alderson Aug 11 '18 at 22:50
• @old_timer OK, I understand what you are saying. Any given build of gcc is single target, but gcc as a compiler collection can support many targets. – Elliot Alderson Aug 11 '18 at 22:51

gcc (alone) is your local machine compiler that generates code for x86 and x86-64 (ie. the target is your computer, unless you are running on non-x86). gcc-msp430 is the cross compiler that runs on your computer, but generates machine code for MSP430.
Generally one GCC installation supports a single target (ie. family of CPUs having the same or very close ISA), like x86, ARM or AVR. For example the MSP430 flavor will support arguments like msp430g2553, while ARM flavor will support cortex-m3. A compiler triplet is used to fully identify the compiler.