#!/bin/bash
prefix=/your/path
build_params=" --target=msp430 --program-prefix='msp430-' --prefix=$prefix"
# --with-mpfr-include=/usr/local/include
# --with-mpfr-lib=/usr/local/lib \
# --with-gmp-include=/usr/local/include \
# --with-gmp-lib=/usr/local/lib \
# --with-mpc-include=/usr/local/include \
# --with-mpc-lib=/usr/local/lib
# Exit if script fails
set -e
#Create a temporary build directory
mkdir -p msp430-build
#copy all the downloaded files into here
cd msp430-build
function download {
if [ ! -f ` basename $1` ]; then
wget $1
fi
}
files="http://sourceforge.net/projects/mspgcc/files/mspgcc/mspgcc-20111224.tar.bz2
http://sourceforge.net/projects/mspgcc/files/msp430mcu/msp430mcu-20111224.tar.bz2
http://sourceforge.net/projects/mspgcc/files/msp430-libc/msp430-libc-20111224.tar.bz2
http://ftpmirror.gnu.org/binutils/binutils-2.21.1a.tar.bz2
http://ftpmirror.gnu.org/gcc/gcc-4.6.1/gcc-core-4.6.1.tar.bz2
http://ftpmirror.gnu.org/gdb/gdb-7.2a.tar.bz2
http://sourceforge.net/projects/mspdebug/files/mspdebug-0.18.tar.gz"
# download files from sites
for file in $files; do
download $file
done
# extract all the following files into the msp430-build directory
if [ ! -f .unpacked ]; then
for file in $files; do
name=`basename $file`
if [ "${name#*.}" == "gz" ]; then
tar xzf $name
elif [ "${name#*.}" == "bz2" ]; then
tar xjf $name
fi
done
touch .unpacked
fi
if [ ! -f .patch ]; then
# 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 20111224
patch -p1<../mspgcc-20111224/msp430-binutils-2.21.1a-20111205.patch
# Now update the Released 20111224 to bring it to date
#patch -p1<../mmsp430-binutils-2.21.1a-20111205.patch
# Return to the build directory
cd ..
# patch GCC to bring it up to Release 20111224
cd gcc-4.6.1
patch -p1<../mspgcc-20111224/msp430-gcc-4.6.1-20111224.patch
# Return to the build directory
cd ..
# Patch GDB to bring it to release 20111224
cd gdb-7.2
patch -p1<../mspgcc-20111224/msp430-gdb-7.2a-20111205.patch
# Return to the build directory
cd ..
touch .patch
fi;
#Create a sub-set of Build Directories
#rm -rf binutils-2.21.1-msp430
#mkdir -p binutils-2.21.1-msp430
#rm -rf gcc-4.6.1-msp430
#mkdir -p gcc-4.6.1-msp430
#rm -rf gdb-7.2-msp430
#mkdir -p gdb-7.2-msp430
# Configure Binutils
cd binutils-2.21.1-msp430
if [ ! -f .install_done ]; then
# We need to build binutils for the msp430
# The --with-xx-include and --with-xx-lib are just to tell
where the prerequisite
# libraries are stored if you had to manually install them,
tweak them to your install path.
# If your distro already had one of them installed remove them
from below.
../binutils-2.21.1/configure $build_params
make
# Do the install as root (e.g., sudo)
make install
touch .install_done
fi
# 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
# The next line is optional if for some reason your GCC cannot find the
installed prerequisite libraries. Uncomment it if you need.
# export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
cd ../gcc-4.6.1-msp430
if [ ! -f .install_done ]; then
../gcc-4.6.1/configure --enable-languages=c $build_params
make
# Do the install as root (e.g., sudo)
make install
#Configure GDB
touch .install_done
fi
cd ../gdb-7.2-msp430
if [ ! -f .install_done ]; then
../gdb-7.2/configure $build_params
make
# Do the install as root (e.g., sudo)
make install
#Install the mspgcc-mcu files
touch .install_done
fi
cd ../msp430mcu-20111224
if [ ! -f .install_done ]; then
MSP430MCU_ROOT=`pwd` ./scripts/install.sh $prefix
touch .install_done
fi
# Install the mspgcc-libc
cd ../msp430-libc-20111224
if [ ! -f .install_done ]; then
cd src
make
# Do the install as root (e.g., sudo)
PATH=$PATH make PREFIX=$prefix install
cd ..
touch .install_done
fi
# Now let's build the debugger
cd ../mspdebug-0.18
if [ ! -f .install_done ]; then
make
# Do the install as root (e.g., sudo)
make PREFIX=$prefix install
touch .install_done
fi;
cd ../..
# ALL DONE
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users