X-Git-Url: https://git.gag.com/?p=fw%2Fcortex-toolchain;a=blobdiff_plain;f=summon-arm-toolchain;h=6e2748f448e56a00d8803d8873121b7ec510b859;hp=bf2059d9f56e629f3e162d40609ce5161da30708;hb=5a82a4186134981c85f6f4d8b45d735cbb3a6997;hpb=5e32010188c26e643a7dff0f2405c88a045b9ade diff --git a/summon-arm-toolchain b/summon-arm-toolchain index bf2059d..6e2748f 100755 --- a/summon-arm-toolchain +++ b/summon-arm-toolchain @@ -2,15 +2,22 @@ # Written by Uwe Hermann , released as public domain. # Modified by Piotr Esden-Tempski , released as public domain. -TARGET=arm-elf # Or: TARGET=arm-none-eabi -PREFIX=${HOME}/arm-elf # Install location of your final toolchain -PARALLEL="" # Or: PARALLEL="-j 5" for 4 CPU's +# +# Requirements (example is for Debian, replace package names as needed): +# +# apt-get install flex bison libgmp3-dev libmpfr-dev libncurses5-dev \ +# libmpc-dev autoconf texinfo build-essential +# + +TARGET=arm-none-eabi # Or: TARGET=arm-elf +PREFIX=${HOME}/arm-none-eabi # Install location of your final toolchain +PARALLEL="" # Or: PARALLEL="-j 5" for 4 CPUs DARWIN_OPT_PATH=/opt/local # Path in which MacPorts or Fink is installed -BINUTILS=binutils-2.19.1 -GCC=gcc-4.4.0 -NEWLIB=newlib-1.17.0 -GDB=gdb-6.8 +BINUTILS=binutils-2.20 +GCC=gcc-4.5.1 +NEWLIB=newlib-1.18.0 +GDB=gdb-7.2 LIBCMSIS=v1.10-2 LIBSTM32=v3.0.0-1 LIBSTM32USB=v3.0.1-1 @@ -18,20 +25,35 @@ LIBOPENSTM32=master LIBSTM32_EN=0 LIBOPENSTM32_EN=0 +SUMMON_DIR=$(pwd) +SOURCES=${SUMMON_DIR}/sources +STAMPS=${SUMMON_DIR}/stamps + export PATH="${PREFIX}/bin:${PATH}" +GCCFLAGS= +GDBFLAGS= +BINUTILFLAGS= + +# Fetch a versioned file from a URL +function fetch { + if [ ! -e ${STAMPS}/$1.fetch ]; then + echo "Downloading $1 sources..." + wget -c --no-passive-ftp $2 + touch ${STAMPS}/$1.fetch + fi +} + case "$(uname)" in Linux) echo "Found Linux OS." - GCCFLAGS= - GDBFLAGS= ;; Darwin) echo "Found Darwin OS." GCCFLAGS="--with-gmp=${DARWIN_OPT_PATH} \ --with-mpfr=${DARWIN_OPT_PATH} \ + --with-mpc=${DARWIN_OPT_PATH} \ -with-libiconv-prefix=${DARWIN_OPT_PATH}" - GDBFLAGS="--disable-werror" ;; *) echo "Found unknown OS. Aborting!" @@ -39,30 +61,14 @@ case "$(uname)" in ;; esac -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 - -if [ ! -e ${GCC}.tar.bz2 ]; then - echo "Downloading gcc sources..." - wget -c ftp://ftp.gnu.org/gnu/gcc/${GCC}/${GCC}.tar.bz2 -fi +mkdir -p ${STAMPS} ${SOURCES} -if [ ! -e ${NEWLIB}.tar.gz ]; then - echo "Downloading newlib sources..." - wget -c ftp://sources.redhat.com/pub/newlib/${NEWLIB}.tar.gz -fi +cd ${SOURCES} -if [ ! -e ${GDB}.tar.bz2 ]; then - echo "Downloading gdb sources..." - wget -c ftp://ftp.gnu.org/gnu/gdb/${GDB}.tar.bz2 -fi +fetch ${BINUTILS} http://ftp.gnu.org/gnu/binutils/${BINUTILS}.tar.bz2 +fetch ${GCC} ${GCC_URL} +fetch ${NEWLIB} ftp://sources.redhat.com/pub/newlib/${NEWLIB}.tar.gz +fetch ${GDB} http://ftp.gnu.org/gnu/gdb/${GDB}.tar.bz2 if [ ${LIBSTM32_EN} != 0 ]; then if [ ! -e libcmsis-${LIBCMSIS}.tar.bz2 ]; then @@ -99,7 +105,7 @@ fi 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 + 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 @@ -108,17 +114,17 @@ if [ ! -e libopenstm32-${LIBOPENSTM32}.tar.bz2 ]; then fi fi -cd .. +cd ${SUMMON_DIR} if [ ! -e build ]; then mkdir build fi -if [ ! -e .${BINUTILS}.build ]; then +if [ ! -e ${STAMPS}/${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}" @@ -129,7 +135,9 @@ if [ ! -e .${BINUTILS}.build ]; then --enable-multilib \ --with-gnu-as \ --with-gnu-ld \ - --disable-nls || exit + --disable-nls \ + --disable-werror \ + ${BINUTILFLAGS} || exit echo "******************************************************************" echo "* Building ${BINUTILS}" echo "******************************************************************" @@ -142,15 +150,15 @@ if [ ! -e .${BINUTILS}.build ]; then echo "******************************************************************" echo "* Cleaning up ${BINUTILS}" echo "******************************************************************" - touch .${BINUTILS}.build + touch ${STAMPS}/${BINUTILS}.build rm -rf build/* ${BINUTILS} fi -if [ ! -e .${GCC}-boot.build ]; then +if [ ! -e ${STAMPS}/${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" @@ -166,6 +174,7 @@ if [ ! -e .${GCC}-boot.build ]; then --with-gnu-as \ --with-gnu-ld \ --disable-nls \ + --disable-werror \ ${GCCFLAGS} || exit echo "******************************************************************" echo "* Building ${GCC}-boot" @@ -179,15 +188,15 @@ if [ ! -e .${GCC}-boot.build ]; then echo "******************************************************************" echo "* Cleaning up ${GCC}-boot" echo "******************************************************************" - touch .${GCC}-boot.build + touch ${STAMPS}/${GCC}-boot.build rm -rf build/* ${GCC} fi -if [ ! -e .${NEWLIB}.build ]; then +if [ ! -e ${STAMPS}/${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}" @@ -199,6 +208,7 @@ if [ ! -e .${NEWLIB}.build ]; then --with-gnu-as \ --with-gnu-ld \ --disable-nls \ + --disable-werror \ --disable-newlib-supplied-syscalls || exit echo "******************************************************************" echo "* Building ${NEWLIB}" @@ -212,16 +222,16 @@ if [ ! -e .${NEWLIB}.build ]; then echo "******************************************************************" echo "* Cleaning up ${NEWLIB}" echo "******************************************************************" - touch .${NEWLIB}.build + touch ${STAMPS}/${NEWLIB}.build rm -rf build/* ${NEWLIB} fi # Yes, you need to build gcc again! -if [ ! -e .${GCC}.build ]; then +if [ ! -e ${STAMPS}/${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}" @@ -236,7 +246,8 @@ if [ ! -e .${GCC}.build ]; then --with-gnu-as \ --with-gnu-ld \ --disable-nls \ - ${GCCFLAGS} || exit + --disable-werror \ + ${GCCFLAGS} || exit echo "******************************************************************" echo "* Building ${GCC}" echo "******************************************************************" @@ -249,15 +260,15 @@ if [ ! -e .${GCC}.build ]; then echo "******************************************************************" echo "* Cleaning up ${GCC}" echo "******************************************************************" - touch .${GCC}.build + touch ${STAMPS}/${GCC}.build rm -rf build/* ${GCC} fi -if [ ! -e .${GDB}.build ]; then +if [ ! -e ${STAMPS}/${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}" @@ -266,6 +277,7 @@ if [ ! -e .${GDB}.build ]; then --prefix=${PREFIX} \ --enable-interwork \ --enable-multilib \ + --disable-werror \ ${GDBFLAGS} || exit echo "******************************************************************" echo "* Building ${GDB}" @@ -279,7 +291,7 @@ if [ ! -e .${GDB}.build ]; then echo "******************************************************************" echo "* Cleaning up ${GDB}" echo "******************************************************************" - touch .${GDB}.build + touch ${STAMPS}/${GDB}.build rm -rf build/* ${GDB} fi @@ -288,7 +300,7 @@ 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}" @@ -310,7 +322,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}" @@ -332,7 +344,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}" @@ -355,7 +367,7 @@ if [ $LIBOPENSTM32_EN != 0 ]; then echo "******************************************************************" echo "* Unpacking libopenstm32-${LIBOPENSTM32}" echo "******************************************************************" - tar xfvj sources/libopenstm32-${LIBOPENSTM32}.tar.bz2 + tar xfvj ${SOURCES}/libopenstm32-${LIBOPENSTM32}.tar.bz2 cd libopenstm32-${LIBOPENSTM32} echo "******************************************************************" echo "* Building libopenstm32-${LIBOPENSTM32}"