Search

Technical Discussion Group Forum

This forum is provided for user discussion. While Beacon EmbeddedWorks support staff and engineers participate, Beacon EmbeddedWorks does not guarantee the accuracy of all information within in the Technical Discussion Group (TDG).

The "Articles" forums provide brief Articles written by Beacon EmbeddedWorks engineers that address the most frequently asked technical questions.

To receive email notifications when updates are posted for a Beacon EmbeddedWorks product download, please subscribe to the TDG Forum of interest.

TDG Forum

PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 29 Feb 2008 02:42 AM by  DrOctavius
how to build the latest GNU toolchain with VFP support
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages
tombrus
New Member
New Member
Posts:


--
28 Feb 2008 03:03 PM
    Hi,



    I needed the GNU toolchain with VFP support because the supplied toolchain does not have floating point support compiled into it. I started with the remarks and the script in thread http://tdg.logicpd.com/viewtopic.php?t=1271. I refined and corrected the script a little. I thought I donate it back to the group.



    Below you will find a shell script that builds the complete toolchain from scratch. Just put the script in an empty directory on its own an run it. It will start downloading the various tar files, unpack them and build and install the GNU tools. Everything will be build and installed in the directory where the script is located. The first few lines of the script contain some tunable variables. I changed the used versions of the GNU packages from what is mentioned in the 1271 post to the latest (at this moment). When new versions are published you can easily adapt the numbers and run the script again. To get the version mentioned in post 1271 you can replace the versions in the script by this:
    BINUTILS_VER=2.17

    GCC_VER=4.2.1

    GDB_VER=6.6

    NEWLIB_VER=1.15.0

    INSIGHT_VER=6.7.1 # warning: will not compile correctly with the above versions
    FYI: I only tested it on Ubuntu Gutsy. On my machine the whole process takes about 20 minutes. The directory will take about 1.6 G of disk space at the end. When done, check the log/*.err files for errors (they contain lots of warnings for me, I guess that does not hurt.



    Have fun.



    Tom Brus
    BASE=$(cd "$(dirname `echo $0`)";pwd)

    BUILD_DIR=$BASE/build

    INSTALL_DIR=$BASE/install

    LOG_DIR=$BASE/log

    CPU=arm1136jf-s



    BINUTILS_VER=2.18

    GCC_VER=4.2.3

    GDB_VER=6.7.1

    NEWLIB_VER=1.16.0

    INSIGHT_VER=6.7.1



    cd $BASE

    echo ==== "$(date '+%k:%M:%S')" ==== Clearing old stuff

    rm -rf $BUILD_DIR

    rm -rf $INSTALL_DIR

    rm -rf $LOG_DIR

    rm -rf binutils-*

    rm -rf gcc-*

    rm -rf gdb-*

    rm -rf newlib-*

    rm -rf insight-*



    echo ==== hit ^C within one second to stop with a clean dir...

    sleep 1



    mkdir -p $LOG_DIR



    echo ==== "$(date '+%k:%M:%S')" ==== Downloading archives

    wget -a $LOG_DIR/wget.log ftp://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS_VER.tar.bz2

    wget -a $LOG_DIR/wget.log ftp://ftp.gnu.org/gnu/gcc/gcc-$GCC_VER/gcc-$GCC_VER.tar.bz2

    wget -a $LOG_DIR/wget.log ftp://ftp.gnu.org/gnu/gdb/gdb-$GDB_VER.tar.bz2

    wget -a $LOG_DIR/wget.log ftp://sources.redhat.com/pub/newlib/newlib-$NEWLIB_VER.tar.gz

    wget -a $LOG_DIR/wget.log ftp://sourceware.org/pub/insight/releases/insight-$INSIGHT_VER.tar.bz2



    echo ==== "$(date '+%k:%M:%S')" ==== Extracting archives

    tar xf binutils-$BINUTILS_VER.tar.*

    tar xf gcc-$GCC_VER.tar.*

    tar xf gdb-$GDB_VER.tar.*

    tar xf newlib-$NEWLIB_VER.tar.*

    tar xf insight-$INSIGHT_VER.tar.*



    mkdir -p $INSTALL_DIR

    mkdir -p $BUILD_DIR/binutils

    mkdir -p $BUILD_DIR/gcc

    mkdir -p $BUILD_DIR/newlib

    mkdir -p $BUILD_DIR/gdb

    mkdir -p $BUILD_DIR/insight



    echo ==== "$(date '+%k:%M:%S')" ==== binutils $BINUTILS_VER

    cd $BUILD_DIR/binutils

    $BASE/binutils-$BINUTILS_VER/configure --target=arm-elf --prefix=$INSTALL_DIR \

    > $LOG_DIR/binutils-config.log 2> $LOG_DIR/binutils-config.err

    make all \

    > $LOG_DIR/binutils-make.log 2> $LOG_DIR/binutils-make.err

    make install \

    > $LOG_DIR/binutils-install.log 2> $LOG_DIR/binutils-install.err



    echo ==== "$(date '+%k:%M:%S')" ==== gcc $GCC_VER - boot

    cd $BUILD_DIR/gcc

    $BASE/gcc-$GCC_VER/configure \

    --target=arm-elf \

    --prefix=$INSTALL_DIR \

    --disable-multilib \

    --with-mode=arm \

    --with-fpu=vfp \

    --with-float=softfp \

    --with-cpu=$CPU \

    --with-gnu-as \

    --with-gnu-ld \

    --disable-shared \

    --with-newlib \

    --disable-libssp \

    --without-headers \

    --enable-languages=c,c++ \

    --with-headers=$BASE/newlib-$NEWLIB_VER/newlib/libc/include \

    > $LOG_DIR/gcc-boot-config.log 2> $LOG_DIR/gcc-boot-config.err

    make all-gcc \

    > $LOG_DIR/gcc-boot-make.log 2> $LOG_DIR/gcc-boot-make.err

    make install-gcc \

    > $LOG_DIR/gcc-boot-install.log 2> $LOG_DIR/gcc-boot-install.err



    # newlib wants arm-elf-cc but there is only arm-elf-gcc, so we make a link

    cd $INSTALL_DIR/bin

    ln -s arm-elf-gcc arm-elf-cc

    PATH__=$PATH

    PATH=$PATH:$INSTALL_DIR/bin export PATH



    echo ==== "$(date '+%k:%M:%S')" ==== newlib $NEWLIB_VER

    cd $BUILD_DIR/newlib

    $BASE/newlib-$NEWLIB_VER/configure \

    --disable-multilib \

    --target=arm-elf \

    --prefix=$INSTALL_DIR \

    > $LOG_DIR/newlib-config.log 2> $LOG_DIR/newlib-config.err

    make CC_FOR_BUILD=gcc CFLAGS_FOR_TARGET=-mcpu=$CPU GCC_FOR_TARGET=$INSTALL_DIR/bin/arm-elf-gcc all \

    > $LOG_DIR/newlib-make.log 2> $LOG_DIR/newlib-make.err

    make install \

    > $LOG_DIR/newlib-install.log 2> $LOG_DIR/newlib-install.err



    PATH=$PATH__ export PATH



    echo ==== "$(date '+%k:%M:%S')" ==== gcc $GCC_VER - rest

    cd $BUILD_DIR/gcc

    make all \

    > $LOG_DIR/gcc-rest-make.log 2> $LOG_DIR/gcc-rest-make.err

    make install \

    > $LOG_DIR/gcc-rest-install.log 2> $LOG_DIR/gcc-rest-install.err



    echo ==== "$(date '+%k:%M:%S')" ==== gdb $GDB_VER

    cd $BUILD_DIR/gdb

    $BASE/gdb-$GDB_VER/configure \

    --target=arm-elf \

    --prefix=$INSTALL_DIR \

    > $LOG_DIR/gdb-config.log 2> $LOG_DIR/gdb-config.err

    make all \

    > $LOG_DIR/gdb-make.log 2> $LOG_DIR/gdb-make.err

    make install \

    > $LOG_DIR/gdb-install.log 2> $LOG_DIR/gdb-install.err



    echo ==== "$(date '+%k:%M:%S')" ==== insight $INSIGHT_VER

    cd $BUILD_DIR/insight

    $BASE/insight-$INSIGHT_VER/configure \

    --target=arm-elf \

    --prefix=$INSTALL_DIR \

    --with-fpu=vfp \

    --with-float=softfp \

    --with-gnu-as \

    --with-gnu-ld \

    --disable-multilib \

    > $LOG_DIR/insight-config.log 2> $LOG_DIR/insight-config.err

    make all \

    > $LOG_DIR/insight-make.log 2> $LOG_DIR/insight-make.err

    make install \

    > $LOG_DIR/insight-install.log 2> $LOG_DIR/insight-install.err



    echo ==== "$(date '+%k:%M:%S')" ==== DONE

    DrOctavius
    New Member
    New Member
    Posts:


    --
    29 Feb 2008 02:42 AM
    Thanks for sharing the Script
    You are not authorized to post a reply.