This is intended to show just an example of how to build, and may not necessarily apply to all systems. The links below and subject to change and as newer versions become available, this will become outdated. This worked on a CentOS 6 i686 machine.
- Install Prerequisites
- Download Binutils sources and untar
- Download GCC sources and untar
- Download GDB sources and untar
- Download the Release patches
- Now patch the Binutils, GCC and GDB to bring them to a known released state with MSP430 support. (released = original + patches)
- For a more up-to-date mspgcc, download and patch the Released version. (up-to-date = released + more patches)
- Make and install Binutils first - This is a prerequisite for gcc
- Make and install mspgcc - This is a prerequisite for the libraries
- Run a script to install the msp430 processor list (mspgcc-mcu).
- Make and install the libc (which requires the mcu, mspgcc and binutils)
Download the following files.
- MSPGCC Release Files - These include the patch files necessary to update the mainstream GNU files
- Long Term Support - Updates since the Release
- Files to support the various MSP430 families
- minimal libc - Library to build code against
- Binutils - Make sure the version number matches the version number listed in the mspgcc release file. (ie. binutils-2.21a.1.tar.bz2)
- GCC - Make sure the version number matches the version number listed in the mspgcc Release Files. (ie. gcc-4.6.3.tar.bz2)
- GDB - Make sure the version number matches the version number listed in the mspgcc Release Files. (ie. gdb-7.2.tar.bz2)
- mspdebug - Make sure the version supports the processor you need (ie mspdebug-0.19.tar.gz)
wget http://sourceforge.net/projects/mspgcc/files/mspgcc/mspgcc-20120406.tar.bz2 wget http://sourceforge.net/projects/mspgcc/files/msp430mcu/msp430mcu-20120406.tar.bz2 wget http://sourceforge.net/projects/mspgcc/files/msp430-libc/msp430-libc-20120224.tar.bz2 wget http://ftpmirror.gnu.org/binutils/binutils-2.21.1a.tar.bz2 wget http://ftpmirror.gnu.org/gcc/gcc-4.6.3/gcc-core-4.6.3.tar.bz2 wget http://ftpmirror.gnu.org/gdb/gdb-7.2a.tar.bz2 wget http://sourceforge.net/projects/mspdebug/files/mspdebug-0.19.tar.gz wget http://sourceforge.net/projects/mspgcc/files/Patches/LTS/20120406/msp430-gcc-4.6.3-20120406-sf3540953.patch wget http://sourceforge.net/projects/mspgcc/files/Patches/LTS/20120406/msp430-gcc-4.6.3-20120406-sf3559978.patch
The following is just an example, newer revisions may have different file names or dates.
#Create a temporary build directory mkdir msp430-build #copy all the downloaded files into here cd msp430-build # extract all the following files into the msp430-build directory tar xvfj binutils-2.21.1a.tar.bz2 tar xvfj gcc-core-4.6.3.tar.bz2 tar xvfj gdb-7.2a.tar.bz2 tar xvfj mspgcc-20120406.tar.bz2 tar xvfj msp430mcu-20120406.tar.bz2 tar xvfj msp430-libc-20120224.tar.bz2 # Make sure any additional patch files (from LTS) are located here as well # The next line is optional for the debugger and is not officially part of the mspgcc project. tar xvfz mspdebug-0.19.tar.gz
Prerequisites for GCC 4.6.3
If you don't have the necessary prerequisits already installed, GCC can do it for you. This builds the dependancies directly into GCC. It is preferred so that build environments don't have dependancy issues.
cd gcc-4.6.3 ./contrib/download_prerequisites
Patch Binutiuls, GCC, and GDB
Binutils, GCC and GDB do not have the latest MSP430 support. So we patch the files to bring them up to date. The following is just an example, newer revisions may have different file names or dates.
# patch binutils (using the files provided in the Release Files, and repeat for any additional patches or LTS files) cd binutils-2.21.1 # Patch binutils to bring it to Release 20120406 (still at 20120406) patch -p1<../mspgcc-20120406/msp430-binutils-2.21.1a-20120406.patch # Return to the build directory cd .. # patch GCC to bring it up to Release 20120406 cd gcc-4.6.3 patch -p1<../mspgcc-20120406/msp430-gcc-4.6.3-20120406.patch # update with LTS files patch -p1<../msp430-gcc-4.6.3-20120406-sf3540953.patch patch -p1<../msp430-gcc-4.6.3-20120406-sf3559978.patch # Return to the build directory cd .. # Patch GDB to bring it to release 20120406 cd gdb-7.2 patch -p1<../mspgcc-20120406/msp430-gdb-7.2a-20120406.patch # Return to the build directory cd ..
Sample script to install mspgcc & mspdebug
This will place a directory called "msp430" into /usr/local and the standard tools like GCC, and the binutils will have "msp430" in prepended (ie msp430-gcc)
WARNING: This does not work in certain circumstances because sudo does not inherit the environment of the invoker. See https://sourceforge.net/tracker/?func=detail&atid=432701&aid=3473593&group_id=42303.
#Create a sub-set of Build Directories mkdir binutils-2.21.1-msp430 mkdir gcc-4.6.3-msp430 mkdir gdb-7.2-msp430
# Configure Binutils cd binutils-2.21.1-msp430 # We need to build binutils for the msp430 ../binutils-2.21.1/configure --target=msp430 --program-prefix="msp430-" make # Do the install as root (e.g., sudo) sudo make install
# I have seen issues where the msp430-ranlib doesn't get detected correctly causing build issues later. # if that happens uncomment the following: # cd /usr/bin # sudo ln -s /usr/local/bin/msp430-ranlib
#Configure GCC cd ../gcc-4.6.3-msp430 ../gcc-4.6.3/configure --target=msp430 --enable-languages=c --program-prefix="msp430-" make # Do the install as root (e.g., sudo) sudo make install
#Configure GDB cd ../gdb-7.2-msp430 ../gdb-7.2/configure --target=msp430 --program-prefix="msp430-" make # Do the install as root (e.g., sudo) sudo make install
#Install the mspgcc-mcu files cd ../msp430mcu-20120406 sudo MSP430MCU_ROOT=`pwd` ./scripts/install.sh /usr/local/
# Install the mspgcc-libc cd ../msp430-libc-20120224 # If you need to disable features, run configure here with any of the following flags to enable/disable features. # --disable-printf-int64 : Remove 64-bit integer support to printf formats # --disable-printf-int32 : Remove 32-bit integer support from printf formats # --enable-ieee754-errors : Use IEEE 754 error checking in libfp functions cd src make # Do the install as root (e.g., sudo) sudo PATH=$PATH make PREFIX=/usr/local install cd ..
# Now let's build the debugger cd mspdebug-0.19 make # Do the install as root (e.g., sudo) sudo make install cd ../.. # ALL DONE