Cross Compiler

Seems that the instructions to build the GCC cross-compiler that were previously on our wiki were lost when we turned it off. So, just to keep things documented, here are the instructions that successfully compile binutils, newlib and gcc for our platform.

Setup some environment variables and un-tar the archives.

$ export TARGET=microblaze
$ export PREFIX=$HOME/mb
$ export PATH=$PREFIX/bin:$PATH
$ mkdir $HOME/buildbin/ $HOME/buildgcc/
$ tar -C $HOME -zxf binutils.tar.gz
$ tar -C $HOME -zxf newlib.tar.gz
$ tar -C $HOME -zxf gcc.tar.gz

Install some necessary tools.

$ sudo apt-get install bison flex

Build binutils first.

$ cd $HOME/buildbin/
$ $HOME/binutils/configure --target=$TARGET --prefix=$PREFIX --program-prefix=mb- --with-gnu-as --with-gnu-ld --disable-nls --with-newlib
$ make install

Install necessary libraries.

$ sudo apt-get install libmpfr-dev libgmp-dev libmpc-dev

Build gcc with newlib at one go.

$ cd $HOME/buildgcc/
$ ln -s ../newlib/libgloss
$ ln -s ../newlib/newlib
$ $HOME/gcc/configure --target=$TARGET --prefix=$PREFIX --program-prefix=mb- --with-gnu-as --with-gnu-ld --disable-nls --with-newlib --enable-languages=c,c++ --disable-shared --disable-threads --disable-libssp --with-headers=$PWD/newlib/libc/include/
$ make install

Voila!

You may also like...

Leave a Reply