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

Subversion Repositories mips32r1

[/] [mips32r1/] [trunk/] [Software/] [toolchain/] [Toolchain_Instructions] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ayersg
Instructions for Creating a MIPS Compiler Toolchain
2
---------------------------------------------------
3
 
4
These are instructions for creating a MIPS cross-compiler toolchain based on
5
GCC 4.7.1, Binutils 2.21, and Newlib 1.20.0.
6
 
7
 
8
Required Files
9
--------------
10
 
11
  - binutils-2.21.tar.bz2   (http://ftp.gnu.org/gnu/binutils/)
12
  - gcc-4.7.1.tar.bz2       (http://gcc.gnu.org/mirrors.html)
13
  - mpfr-3.0.1.tar.bz2      (http://www.mpfr.org/mpfr-3.0.1/)
14
  - mpc-0.9.tar.gz          (http://www.multiprecision.org/)
15
  - gmp-5.0.5.tar.bz2       (http://gmplib.org/)
16
  - newlib-1.20.0.tar.gz    (ftp://sources.redhat.com/pub/newlib/index.html)
17
 
18
 
19
Procedure
20
---------
21
 
22
The following assumes you are using Bash or Bash-like shell. This procedure
23
has been tested in Linux environments as well as Windows under Cygwin. If you
24
are using Cygwin, you must be running on a 32-bit Windows OS or VM.
25
Limitations with WoW in 64-bit Windows prevents enough stack/heap space from
26
being allocated. Once the toolchain is compiled it may be used under 64-bit
27
Windows.
28
 
29
 
30
1. Set environment variables:
31
    export TARGET=mips-elf
32
    export PREFIX=[some directory]/gnu_mips/crosstools
33
    export PATH=$PATH:$PREFIX/bin
34
 
35
1.5. If you're on 32-bit Windows using Cygwin:
36
    export CFLAGS="-Wl,--heap,200000000,--stack,8000000"
37
 
38
2. Unpack everything:
39
    bzip2 -dc binutils-2.21.tar.bz2 | tar xf -
40
    bzip2 -dc gcc-4.7.1.tar.bz2 | tar xf -
41
    bzip2 -dc mpfr-3.0.1.tar.bz2 | tar xf -
42
    bzip2 -dc gmp-5.0.5.tar.bz2 | tar xf -
43
    gzip -dc mpc-0.9.tar.gz | tar xf -
44
    gzip -dc newlib-1.20.0.tar.gz | tar xf -
45
 
46
3. Move (or symlink) GCC dependency packages
47
    mv gmp-5.0.5 gcc-4.7.1/gmp
48
    mv mpc-0.9 gcc-4.7.1/mpc
49
    mv mpfr-3.0.1 gcc-4.7.1/mpfr
50
    mv newlib-1.20.0/newlib gcc-4.7.1/newlib
51
    mv newlib-1.20.0/libgloss gcc-4.7.1/libgloss
52
 
53
4. Build binutils:
54
    mkdir binutils-build && cd binutils-build
55
    ../binutils-2.21/configure --prefix=$PREFIX --target=$TARGET --disable-nls
56
    make
57
    make install
58
    cd ..
59
 
60
5. Build gcc:
61
    mkdir gcc-build && cd gcc-build
62
    ../gcc-4.7.1/configure --prefix=$PREFIX --target=$TARGET --with-newlib \
63
    --without-headers --with-gnu-ld --with-gnu-as --disable-libssp \
64
    --disable-nls --enable-c99 --enable-long-long --enable-languages=c
65
    make
66
    make install
67
    cd ..
68
 
69
At this point you have a complete toolchain located at $PREFIX.

powered by: WebSVN 2.1.0

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