Tuesday, June 10, 2008

How to build eCos 2.x toolchain for ARM platform

In Fedora Core 8, Fedora Core 9

* binutils-2.15
* gcc-3.4.3
* newlib-1.12.0
* insight-6.6

1. Pre-Configuration
BASE_DIR=`pwd`
TARGET=arm-elf

2. Download source code
[ ]# wget -P $BASE_DIR/src http://www.gnuarm.com/binutils-2.15.tar.bz2
[ ]# wget -P $BASE_DIR/src http://www.gnuarm.com/gcc-3.4.3.tar.bz2
[ ]# wget -P $BASE_DIR/src http://www.gnuarm.com/newlib-1.12.0.tar.gz
[ ]# wget -P $BASE_DIR/src ftp://sourceware.org/pub/insight/releases/insight-6.6.tar.bz2

3. Pre-Build
[ ]# mkdir -p /opt/gnutools
[ ]# bunzip2 < $BASE_DIR/src/binutils-2.15.tar.bz2 | tar xvf -
[ ]# bunzip2 < $BASE_DIR/src/gcc-3.4.3.tar.bz2 | tar xvf -
[ ]# gunzip < $BASE_DIR/src/newlib-1.12.0.tar.gz | tar xvf -
[ ]# bunzip2 < $BASE_DIR/src/insight-6.6.tar.bz2 | tar xvf -
[ ]# cp -rf newlib-1.12.0/newlib gcc-3.4.3/
[ ]# cp -rf newlib-1.12.0/libgloss gcc-3.4.3/

4. Binutils
[ ]# mkdir -p /tmp/build/binutils
[ ]# cd /tmp/build/binutils
[ ]# $BASE_DIR/binutils-2.15/configure --target=$TARGET --prefix=/opt/gnutools \
-v 2>&1 | tee configure.out
[ ]# make -w all install 2>&1 | tee make.out

5. GCC
[ ]# PATH=/opt/gnutools/bin:$PATH ; export PATH
[ ]# mkdir -p /tmp/build/gcc
[ ]# cd /tmp/build/gcc
[ ]# $BASE_DIR/gcc-3.4.3/configure --target=$TARGET --prefix=/opt/gnutools \
--enable-languages=c,c++ --with-gnu-as --with-gnu-ld --with-newlib \
--with-gxx-include-dir=/opt/gnutools/$TARGET/include \
-v 2>&1 | tee configure.out
[ ]# make -w all install 2>&1 | tee make.out

6. GDB
[ ]# mkdir -p /tmp/build/gdb
[ ]# cd /tmp/build/gdb
[ ]# $BASE_DIR/insight-6.6/configure --target=$TARGET --prefix=/opt/gnutools \
-v 2>&1 | tee configure.out
[ ]# make -w all install 2>&1 | tee make.out

7. Post-Build
* Clean
[ ]# rm -rf /tmp/build/

* Change PATH environment variable (Edit /root/.bash_profile file)
PATH=$PATH:$HOME/bin
# Toolchain for ARM-eCos platform
PATH=/opt/gnutools/bin:$PATH
export PATH

* Effect the change

That's all. Here is the script file. Enjoy!
You can also download the complete source tarball (84MB).

No comments: