OpenCores
URL https://opencores.org/ocsvn/mips32r1/mips32r1/trunk

Subversion Repositories mips32r1

[/] [mips32r1/] [trunk/] [Software/] [toolchain/] [Toolchain_Instructions] - Rev 2

Compare with Previous | Blame | View Log

Instructions for Creating a MIPS Compiler Toolchain
---------------------------------------------------

These are instructions for creating a MIPS cross-compiler toolchain based on
GCC 4.7.1, Binutils 2.21, and Newlib 1.20.0.


Required Files
--------------

  - binutils-2.21.tar.bz2   (http://ftp.gnu.org/gnu/binutils/)
  - gcc-4.7.1.tar.bz2       (http://gcc.gnu.org/mirrors.html)
  - mpfr-3.0.1.tar.bz2      (http://www.mpfr.org/mpfr-3.0.1/)
  - mpc-0.9.tar.gz          (http://www.multiprecision.org/)
  - gmp-5.0.5.tar.bz2       (http://gmplib.org/)
  - newlib-1.20.0.tar.gz    (ftp://sources.redhat.com/pub/newlib/index.html)


Procedure
---------

The following assumes you are using Bash or Bash-like shell. This procedure
has been tested in Linux environments as well as Windows under Cygwin. If you
are using Cygwin, you must be running on a 32-bit Windows OS or VM.
Limitations with WoW in 64-bit Windows prevents enough stack/heap space from
being allocated. Once the toolchain is compiled it may be used under 64-bit
Windows.


1. Set environment variables:
    export TARGET=mips-elf
    export PREFIX=[some directory]/gnu_mips/crosstools
    export PATH=$PATH:$PREFIX/bin

1.5. If you're on 32-bit Windows using Cygwin:
    export CFLAGS="-Wl,--heap,200000000,--stack,8000000"

2. Unpack everything:
    bzip2 -dc binutils-2.21.tar.bz2 | tar xf -
    bzip2 -dc gcc-4.7.1.tar.bz2 | tar xf -
    bzip2 -dc mpfr-3.0.1.tar.bz2 | tar xf -
    bzip2 -dc gmp-5.0.5.tar.bz2 | tar xf -
    gzip -dc mpc-0.9.tar.gz | tar xf -
    gzip -dc newlib-1.20.0.tar.gz | tar xf -

3. Move (or symlink) GCC dependency packages
    mv gmp-5.0.5 gcc-4.7.1/gmp
    mv mpc-0.9 gcc-4.7.1/mpc
    mv mpfr-3.0.1 gcc-4.7.1/mpfr
    mv newlib-1.20.0/newlib gcc-4.7.1/newlib
    mv newlib-1.20.0/libgloss gcc-4.7.1/libgloss

4. Build binutils:
    mkdir binutils-build && cd binutils-build
    ../binutils-2.21/configure --prefix=$PREFIX --target=$TARGET --disable-nls
    make
    make install
    cd ..

5. Build gcc:
    mkdir gcc-build && cd gcc-build
    ../gcc-4.7.1/configure --prefix=$PREFIX --target=$TARGET --with-newlib \
    --without-headers --with-gnu-ld --with-gnu-as --disable-libssp \
    --disable-nls --enable-c99 --enable-long-long --enable-languages=c
    make
    make install
    cd ..

At this point you have a complete toolchain located at $PREFIX.

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.