Building a cross compiler for Buenos (ECOFF)

To compile Buenos (and generally to build binaries for the YAMS simulator), a C cross compiler and cross assembler are needed. These are provided by the GNU binutils and GCC packages. Binutils is needed mainly for the GNU assembler and linker, but the others can be quite useful too.

These instructions are tested on binutils 2.13 and GCC 2.95.3. GCC version 3.x has a bug when building a MIPS cross compiler (Internal compiler error when building libgcc), so use it only if you do not need libgcc. 2.95.3 needs a little patching so it won't require target OS (does not exist!) header files. The patches are frame.c-patch and libgcc2.c-patch, they are the same ones as mentioned in this discussion:

To make things easier, we provide a prepatched version of GCC, which is GCC 2.95.3 with the patches mentioned above applied: gcc-2.95.3-mipsecoffcrossfix.tar.gz

Download the packages to a suitable empty directory and do the following steps to install them.

First extract the packages:

gunzip -c binutils-2.13.tar.gz | tar xf -
gunzip -c gcc-2.95.3-mipsecoffcrossfix.tar.gz | tar xf -

Then make a separate directory for building the binutils and build and install them:

mkdir build-binutils
cd build-binutils
../binutils-2.13/configure --target=mips-ecoff --prefix=$PREFIX -v
make all

make install

You might want to run make -k install instead if e.g. making the info documentation fails. The $PREFIX is of course the directory where you want to install the binutils, e.g. $HOME/cross-gcc.

Then make a separate directory for building GCC and build and install it:

mkdir build-gcc
cd build-gcc
../gcc-2.95.3-mipsecoffcrossfix/configure --with-gnu-ld --with-gnu-as --without-nls --enable-languages=c --disable-multilib --target=mips-ecoff --prefix=$PREFIX -v
make all

make install

Again, you might want to use make -k install instead. The install prefix should be the same as for binutils.

Now that binutils and GCC have been installed, all you need is to add $PREFIX/bin to your PATH, and you're ready to compile Buenos.