upgrading to gdb-7.1
[fw/cortex-toolchain] / summon-arm-toolchain
index ba688e50e05542644891fb2a8efffc7c219a45ff..15181b667272b87919d1aecef1942f817473992c 100755 (executable)
@@ -1,19 +1,25 @@
 #!/bin/bash
 # Written by Uwe Hermann <uwe@hermann-uwe.de>, released as public domain.
-# Modified by Piot Esden-Tempski <piotr@esden.net>, released as public domain.
+# Modified by Piotr Esden-Tempski <piotr@esden.net>, released as public domain.
 
-TARGET=arm-none-eabi                    # Or: TARGET=arm-none-eabi
-PREFIX=${HOME}/arm-none-eabi             # Install location of your final toolchain
-PARALLEL=""                             # Or: PARALLEL="-j 5" for 4 CPU's
-DARWIN_OPT_PATH=/opt/local               # Path in which MacPorts or Fink is installed
+TARGET=arm-none-eabi                   # Or: TARGET=arm-none-eabi
+PREFIX=${HOME}/arm-none-eabi           # Install location of your final toolchain
+PARALLEL=""                            # Or: PARALLEL="-j 5" for 4 CPU's
+DARWIN_OPT_PATH=/opt/local             # Path in which MacPorts or Fink is installed
 
 BINUTILS=binutils-2.19.1
-GCC=gcc-4.4.0
+GCC=gcc-4.4.2
 NEWLIB=newlib-1.17.0
-GDB=gdb-6.8
+GDB=gdb-7.1
 LIBCMSIS=v1.10-2
 LIBSTM32=v3.0.0-1
 LIBSTM32USB=v3.0.1-1
+LIBOPENSTM32=master
+LIBSTM32_EN=1
+LIBOPENSTM32_EN=0
+
+SUMMON_DIR=$(pwd)
+SOURCES=${SUMMON_DIR}/sources
 
 export PATH="${PREFIX}/bin:${PATH}"
 
@@ -21,44 +27,42 @@ case "$(uname)" in
        Linux)
        echo "Found Linux OS."
        GCCFLAGS=
+       GDBFLAGS=
+       BINUTILFLAGS=
        ;;
        Darwin)
        echo "Found Darwin OS."
        GCCFLAGS="--with-gmp=${DARWIN_OPT_PATH} \
                  --with-mpfr=${DARWIN_OPT_PATH} \
                  -with-libiconv-prefix=${DARWIN_OPT_PATH}"
+        GDBFLAGS="--disable-werror"
+       BINUTILFLAGS="--disable-werror"
        ;;
        *)
-       echo "Found Unknown OS. Aborting!"
+       echo "Found unknown OS. Aborting!"
        exit 1
        ;;
 esac
 
-if [ ! -e sources ]; then
-    mkdir sources
+if [ ! -e ${SOURCES} ]; then
+    mkdir ${SOURCES}
 fi
 
-cd sources
-if [ ! -e ${BINUTILS}.tar.bz2 ]; then
-       echo "Downloading binutils sources..."
-       wget -c http://ftp.gnu.org/gnu/binutils/${BINUTILS}.tar.bz2
-fi
+cd ${SOURCES}
 
-if [ ! -e ${GCC}.tar.bz2 ]; then
-       echo "Downloading gcc sources..."
-       wget -c ftp://ftp.gnu.org/gnu/gcc/${GCC}/${GCC}.tar.bz2
-fi
+echo "Downloading binutils sources..."
+wget -c http://ftp.gnu.org/gnu/binutils/${BINUTILS}.tar.bz2
 
-if [ ! -e ${NEWLIB}.tar.gz ]; then
-       echo "Downloading newlib sources..."
-       wget -c ftp://sources.redhat.com/pub/newlib/${NEWLIB}.tar.gz
-fi
+echo "Downloading gcc sources..."
+wget -c ftp://ftp.gnu.org/gnu/gcc/${GCC}/${GCC}.tar.bz2
 
-if [ ! -e ${GDB}.tar.bz2 ]; then
-       echo "Downloading gdb sources..."
-       wget -c ftp://ftp.gnu.org/gnu/gdb/${GDB}.tar.bz2
-fi
+echo "Downloading newlib sources..."
+wget -c ftp://sources.redhat.com/pub/newlib/${NEWLIB}.tar.gz
+
+echo "Downloading gdb sources..."
+wget -c ftp://ftp.gnu.org/gnu/gdb/${GDB}.tar.bz2
 
+if [ ${LIBSTM32_EN} != 0 ]; then
 if [ ! -e libcmsis-${LIBCMSIS}.tar.bz2 ]; then
        echo "Cloning libcmsis sources..."
        git clone git://git.open-bldc.org/libcmsis.git
@@ -88,8 +92,21 @@ if [ ! -e libstm32usb-${LIBSTM32USB}.tar.bz2 ]; then
         cd ..
         rm -rf libstm32usb
 fi
+fi
 
-cd ..
+if [ ${LIBOPENSTM32_EN} != 0 ]; then
+if [ ! -e libopenstm32-${LIBOPENSTM32}.tar.bz2 ]; then
+       echo "Cloning libopenstm32 sources..."
+       git clone git://libopenstm32.git.sourceforge.net/gitroot/libopenstm32/libopenstm32
+        cd libopenstm32
+        git archive --format=tar --prefix=libopenstm32-${LIBOPENSTM32}/ ${LIBOPENSTM32} | \
+            bzip2 --stdout > ../libopenstm32-${LIBOPENSTM32}.tar.bz2
+        cd ..
+        rm -rf libopenstm32
+fi
+fi
+
+cd ${SUMMON_DIR}
 
 if [ ! -e build ]; then
     mkdir build
@@ -99,7 +116,7 @@ if [ ! -e .${BINUTILS}.build ]; then
     echo "******************************************************************"
     echo "* Unpacking ${BINUTILS}"
     echo "******************************************************************"
-    tar xfvj sources/${BINUTILS}.tar.bz2
+    tar xfvj ${SOURCES}/${BINUTILS}.tar.bz2
     cd build
     echo "******************************************************************"
     echo "* Configuring ${BINUTILS}"
@@ -110,7 +127,8 @@ if [ ! -e .${BINUTILS}.build ]; then
                            --enable-multilib \
                            --with-gnu-as \
                            --with-gnu-ld \
-                           --disable-nls || exit
+                           --disable-nls \
+                          ${BINUTILFLAGS} || exit
     echo "******************************************************************"
     echo "* Building ${BINUTILS}"
     echo "******************************************************************"
@@ -131,7 +149,7 @@ if [ ! -e .${GCC}-boot.build ]; then
     echo "******************************************************************"
     echo "* Unpacking ${GCC}-boot"
     echo "******************************************************************"
-    tar xfvj sources/${GCC}.tar.bz2
+    tar xfvj ${SOURCES}/${GCC}.tar.bz2
     cd build
     echo "******************************************************************"
     echo "* Configuring ${GCC}-boot"
@@ -168,7 +186,7 @@ if [ ! -e .${NEWLIB}.build ]; then
     echo "******************************************************************"
     echo "* Unpacking ${NEWLIB}"
     echo "******************************************************************"
-    tar xfvz sources/${NEWLIB}.tar.gz
+    tar xfvz ${SOURCES}/${NEWLIB}.tar.gz
     cd build
     echo "******************************************************************"
     echo "* Configuring ${NEWLIB}"
@@ -202,7 +220,7 @@ if [ ! -e .${GCC}.build ]; then
     echo "******************************************************************"
     echo "* Unpacking ${GCC}"
     echo "******************************************************************"
-    tar xfvj sources/${GCC}.tar.bz2
+    tar xfvj ${SOURCES}/${GCC}.tar.bz2
     cd build
     echo "******************************************************************"
     echo "* Configuring ${GCC}"
@@ -217,7 +235,7 @@ if [ ! -e .${GCC}.build ]; then
                       --with-gnu-as \
                       --with-gnu-ld \
                      --disable-nls \
-                     ${GCCFLAGS} || exit
+                    ${GCCFLAGS} || exit
     echo "******************************************************************"
     echo "* Building ${GCC}"
     echo "******************************************************************"
@@ -238,7 +256,7 @@ if [ ! -e .${GDB}.build ]; then
     echo "******************************************************************"
     echo "* Unpacking ${GDB}"
     echo "******************************************************************"
-    tar xfvj sources/${GDB}.tar.bz2
+    tar xfvj ${SOURCES}/${GDB}.tar.bz2
     cd build
     echo "******************************************************************"
     echo "* Configuring ${GDB}"
@@ -246,7 +264,8 @@ if [ ! -e .${GDB}.build ]; then
     ../${GDB}/configure --target=${TARGET} \
                       --prefix=${PREFIX} \
                       --enable-interwork \
-                      --enable-multilib || exit
+                      --enable-multilib \
+                     ${GDBFLAGS} || exit
     echo "******************************************************************"
     echo "* Building ${GDB}"
     echo "******************************************************************"
@@ -263,11 +282,12 @@ if [ ! -e .${GDB}.build ]; then
     rm -rf build/* ${GDB}
 fi
 
+if [ ${LIBSTM32_EN} != 0 ]; then
 if [ ! -e .libcmsis-${LIBCMSIS}.build ]; then
     echo "******************************************************************"
     echo "* Unpacking libcmsis-${LIBCMSIS}"
     echo "******************************************************************"
-    tar xfvj sources/libcmsis-${LIBCMSIS}.tar.bz2
+    tar xfvj ${SOURCES}/libcmsis-${LIBCMSIS}.tar.bz2
     cd libcmsis-${LIBCMSIS}
     echo "******************************************************************"
     echo "* Building libcmsis-${LIBCMSIS}"
@@ -289,7 +309,7 @@ if [ ! -e .libstm32-${LIBSTM32}.build ]; then
     echo "******************************************************************"
     echo "* Unpacking libstm32-${LIBSTM32}"
     echo "******************************************************************"
-    tar xfvj sources/libstm32-${LIBSTM32}.tar.bz2
+    tar xfvj ${SOURCES}/libstm32-${LIBSTM32}.tar.bz2
     cd libstm32-${LIBSTM32}
     echo "******************************************************************"
     echo "* Building libstm32-${LIBSTM32}"
@@ -311,7 +331,7 @@ if [ ! -e .libstm32usb-${LIBSTM32USB}.build ]; then
     echo "******************************************************************"
     echo "* Unpacking libstm32usb-${LIBSTM32USB}"
     echo "******************************************************************"
-    tar xfvj sources/libstm32usb-${LIBSTM32USB}.tar.bz2
+    tar xfvj ${SOURCES}/libstm32usb-${LIBSTM32USB}.tar.bz2
     cd libstm32usb-${LIBSTM32USB}
     echo "******************************************************************"
     echo "* Building libstm32usb-${LIBSTM32USB}"
@@ -328,3 +348,26 @@ if [ ! -e .libstm32usb-${LIBSTM32USB}.build ]; then
     touch .libstm32usb-${LIBSTM32USB}.build
     rm -rf libstm32usb-${LIBSTM32USB}
 fi
+fi
+
+if [ $LIBOPENSTM32_EN != 0 ]; then
+    echo "******************************************************************"
+    echo "* Unpacking libopenstm32-${LIBOPENSTM32}"
+    echo "******************************************************************"
+    tar xfvj ${SOURCES}/libopenstm32-${LIBOPENSTM32}.tar.bz2
+    cd libopenstm32-${LIBOPENSTM32}
+    echo "******************************************************************"
+    echo "* Building libopenstm32-${LIBOPENSTM32}"
+    echo "******************************************************************"
+    make PREFIX=${TARGET} DESTDIR=${PREFIX} || exit
+    echo "******************************************************************"
+    echo "* Installing libopenstm32-${LIBOPENSTM32}"
+    echo "******************************************************************"
+    make PREFIX=${TARGET} DESTDIR=${PREFIX} install || exit
+    cd ..
+    echo "******************************************************************"
+    echo "* Cleaning up libopenstm32-${LIBOPENSTM32}"
+    echo "******************************************************************"
+    touch .libopenstm32-${LIBOPENSTM32}.build
+    rm -rf libopenstm32-${LIBOPENSTM32}
+fi