ARM Cross Compiler
Cross Compile Chain for ARM system TS-7390
Some hints were taken from: http://www.ethernut.de/en/documents/cross-toolchain-osx.html However, this does not work right for the TS arm platforms. These instructions worked for me with a TS-7390 board.
These instructions worked on both Mac OS X 10.5 and Red Hat Linux 5.3
Get the sources
Sources obtained from:
curl -O ftp://gcc.gnu.org/pub/binutils/releases/binutils-2.18.tar.bz2 curl -O ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.2.2/gcc-core-4.2.2.tar.bz2 curl -O ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.2.2/gcc-g++-4.2.2.tar.bz2 curl -O ftp://sourceware.org/pub/gdb/releases/gdb-6.7.1.tar.bz2
GNU Build instructions at: http://gcc.gnu.org/install/build.html
Untar in the ~/crosscompile/ directory or some other location of choice.
Prepare the sysroot
Presumably you want to compile code on your host system for some target system. If this target system runs Linux, you'd want to be able to access all the libraries and header files from the target system on your host system. Otherwise, why bother with a cross compiler.
On the target system, create a includes.tgz from /usr/includes and libs.tgz from /usr/libs and liblibs.tgz from /lib:
tar czvf /tmp/includes.tgz /usr/include tar czvf /tmp/libs.tgz /usr/lib /lib
On the host, expand these in the new sysroot for the target.
mkdir /usr/local/arm-linux-gnu/ cd /usr/local/arm-linux-gnu/ tar xzvf ~/include.tgz tar xzvf ~/libs.tgz
You should now have a copy of the relevant libraries in your /usr/local/arm-linux-gnu directory.
FIRST MAKE THE BINUTILS
On the host, go to binutils directory (where you untarred the binutils tar file, then cd into binutils-2-18), create a build-arm-linux subdirectory (mkdir build-arm-linux), and run:
cd build-arm-linux ../configure --target=arm-linux-gnu --prefix=/usr/local/arm-linux-gnu --with-sysroot=/usr/local/arm-linux-gnu --with-local-prefix=/usr/local/arm-linux-gnu/arm-linux-gnu --disable-nls --with-gcc --with-gnu-as --with-gnu-ld
(Note for Mac: Check that makeinfo points to makeinfo or /usr/bin/makeinfo and not the Tex version!)
Compile and install:
make make install
Compile GCC
On the host, go to gcc-4.2.2 directory (where you untarred gcc-4.2.2, then cd into gcc-4.2.2 directory) and configure with:
mkdir build-arm-linux cd build-arm-linux ../configure --target=arm-linux-gnu --prefix=/usr/local/arm-linux-gnu --with-sysroot=/usr/local/arm-linux-gnu --with-local-prefix=/usr/local/arm-linux-gnu/arm-linux-gnu --disable-nls --enable-threads=posix --enable-symvers=gnu --enable-__cxa_atexit --enable-languages=c,c++ --enable-shared --enable-c99 --enable-long-long
(Some of the options were taken from the crosstool chain configuration provided by embeddedarm.com, they can also be found on the compiler of the target system, ask it with "gcc -v")
Compile and install:
make make install
The compiler and everything needed should now be installed in /usr/local/arm-linux-gnu/bin. Add this to your path and run these versions as "arm-linux-gnu-gcc" etc.