Created
August 30, 2012 23:15
-
-
Save madmo/3544544 to your computer and use it in GitHub Desktop.
OSX msp430 toolchain install script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Based on the script found here: http://xpg.dk/projects/msp430/msp430-gcc-uniarch-build-script/ | |
# brew install gmp mpfr libmpc | |
set -e | |
function gitUpdate() | |
{ | |
SRC_ROOT=$1 | |
DIR=$2 | |
URL=$3 | |
if [ -e "$DIR" ]; then | |
cd $DIR | |
echo "Updating $DIR..." | |
git pull | |
else | |
cd $SRC_ROOT | |
git clone "$URL" "$DIR" | |
fi | |
} | |
# Prepare the root area | |
export MSP430_ROOT=${PWD} | |
mkdir -p ${MSP430_ROOT} | |
SRC_ROOT="${MSP430_ROOT}" | |
BINUTILS_DIR="${SRC_ROOT}/binutils" | |
GCC_DIR="${SRC_ROOT}/gcc" | |
MSP430_LIBC_DIR="${SRC_ROOT}/msp430-libc" | |
MSP430_MCU_DIR="${SRC_ROOT}/msp430mcu" | |
MSPGCC_DIR="${SRC_ROOT}/mspgcc" | |
echo "Checkout root is $SRC_ROOT" | |
gitUpdate "$SRC_ROOT" "$BINUTILS_DIR" "git://mspgcc.git.sourceforge.net/gitroot/mspgcc/binutils" | |
gitUpdate "$SRC_ROOT" "$GCC_DIR" "git://mspgcc.git.sourceforge.net/gitroot/mspgcc/gcc" | |
gitUpdate "$SRC_ROOT" "$MSP430_LIBC_DIR" "git://mspgcc.git.sourceforge.net/gitroot/mspgcc/msp430-libc" | |
gitUpdate "$SRC_ROOT" "$MSP430_MCU_DIR" "git://mspgcc.git.sourceforge.net/gitroot/mspgcc/msp430mcu" | |
gitUpdate "$SRC_ROOT" "$MSPGCC_DIR" "git://mspgcc.git.sourceforge.net/gitroot/mspgcc/mspgcc" | |
INSTALL_DIR="${MSP430_ROOT}/install" | |
BUILD_ROOT="${MSP430_ROOT}/BUILD" | |
mkdir -p $INSTALL_DIR | |
mkdir -p $BUILD_ROOT/binutils/dev | |
cd $BUILD_ROOT/binutils/dev | |
$BINUTILS_DIR/configure --target=msp430 --prefix=${INSTALL_DIR} | |
make | |
make check-gas RUNTESTFLAGS=msp430.exp | |
make install | |
export PATH="${INSTALL_DIR}/bin:${PATH}" | |
mkdir -p ${BUILD_ROOT}/gcc/dev | |
cd ${BUILD_ROOT}/gcc/dev | |
${GCC_DIR}/configure --target=msp430 --enable-languages=c,c++ --prefix=${INSTALL_DIR} | |
make | |
make check-gcc RUNTESTFLAGS=msp430.exp | |
make install | |
cd ${MSP430_LIBC_DIR}/src | |
rm -rf Build | |
make PREFIX=${INSTALL_DIR} | |
make PREFIX=${INSTALL_DIR} install | |
cd ${MSP430_MCU_DIR} | |
sh scripts/install.sh ${INSTALL_DIR} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment