Build mips-elf-gcc4.4.1 cross compiler for MIPS

Source: Internet
Author: User
Tags gmp

Because ECOs needs MIPS-elf-GCC to compile the kernel, the GCC compiler of the latest gcc4.4.1 version is compiled today. The steps are as follows:

 

First, you must export the following variables before compiling:

Export target = MIPS-elf

Export prefix =/usr/local/$ Target

Export Path = $ path: $ prefix/bin

Echo $ Target

Echo $ prefix

Echo $ path

==============================

Compiling environment: fc9

The GCC version is as follows:

Use built-in specs.

Goals: i386-redhat-linux

Configuration :.. /configure -- prefix =/usr -- Mandir =/usr/share/man -- infodir =/usr/share/info -- With-bugurl = http://bugzilla.redhat.com/bugzilla -- enable-Bootstrap -- enable-shared -- enable-threads = POSIX -- enable-checking = release -- With-system-zlib -- enable-_ cxa_atexit -- disable-libunwind-exceptions -- enable-versions ages = C, c ++, objc, obj-C ++, Java, Fortran, ADA -- enable-Java-AWT = GTK -- disable-DSSI -- enable-plugin -- With-Java-home =/usr/lib/JVM/java-1.5.0-gcj-1.5.0.0/JRE -- enable-libgcj-Multifile -- enable-Java-maintainer-mode -- With-ECJ-jar =/usr/share/Java/eclipse-ecj.jar -- disable-libjava-multilib -- With-CPU = generic -- Build = i386-redhat-linux

Thread model: POSIX

GCC version 4.3.0 20080428 (Red Hat 4.3.0-8) (GCC)

======================================

Install binutils-2.19.1,

# Tar xjfv binutils-2.19.1.tar.bz2

# Mkdir build-binutils

# Cd build-binutils

# ../Binutils-2.19.1/configure -- target = $ target -- prefix = $ prefix

# Make all

# Make install

======================================

Install libgmp:

Note:

This library is used for high-precision operations.

If your system has a GMP library above 4.1, you do not need to install it.

 

Library used for computing:

Gmp-4.3.1,

# Mkdir build-GMP

# Cd build-GMP

# ../Gmp-4.3.1/configure -- prefix =/usr -- enable-shared

========================================================== ===

Install libmp FR,

Note:

This library is used for high-precision operations.

If your system's mpfr library is above 2.3.2, you do not need to install it.

 

 

# Mkdir build-mpfr

# Cd build-mpfr

# ../Mpfr-2.4.1/configure -- prefix =/usr -- enable-shared -- disable-static

========================================================== ===

Install GCC:

# Tar jxvf gcc-4.4.1.tar.bz2

# Mkdir build-gcc

# Cd build-gcc

# ../Gcc-4.4.1/configure -- target = $ target -- prefix = $ prefix -- without-headers -- With-newlib -- With-GNU-as -- With-GNU-LD

# Make all-GCC (Note: Here is make all-GCC)

# Make install-GCC (Note: Here is make install-GCC)

 

Note:

If you use the make install command for installation, the following error may be prompted (you won't use make install-GCC ):

Make [2]: Entering directory '/home/gcc-4.4.1/build-gcc/MIPS-elf/libstdc ++-V3'

Make [2]: *** the target "Install" can be created without rules ". Stop.

Make [2]: Leaving directory '/home/gcc-4.4.1/build-gcc/MIPS-elf/libstdc ++-V3'

Make [1]: *** [install-target-libstdc ++-V3] Error 2

Make [1]: Leaving directory '/home/gcc-4.4.1/build-GCC'

Make: *** [install] Error 2

 

Ignore it for the moment.

==============================================

Compile newlib-1.17.0,

# Tar jxvf newlib-1.17.0.tar.bz2

# Mkdir build-newlib

# Cd build-newlib

# ../Newlib-1.17.0/configure -- target = $ target -- prefix = $ prefix

# Make all

# Make install

========================================================

Recompile GCC,

Gcc-4.4.1

 

# Cd build-gcc

#.. /Gcc-4.4.1/configure -- target = $ target -- prefix = $ prefix -- With-newlib -- With-GNU-as -- With-GNU-LD -- disable-shared -- disable-libssp

# Make all (unlike the previous compilation, here is make all)

# Make install

 

With the support of newlib compiled just now, there will be no more errors.

==========================================

Install gdb-6.8

# Tar zxvf gdb-6.8.tar.gz

# Mkdir build-GDB

# Cd build-GDB

# ../Gdb-6.8/configure -- target = $ target -- prefix = $ prefix -- enable-sim-stdio

# Make all

# Make install

 

Done!

**************************************** *****

MIPs-elf-GCC is used to develop MIPS hardware programs. It cannot use dynamic libraries. Another interesting tool is MIPS-elf-run.

It is a MIPS simulator (simulator) in a PC. It can simulate and run the MIPs ELF Program.

 

The test is as follows:

mips-elf-gcc -Tidt.ld -mips4 -EL hello.c -o hello

mips-elf-run hello

The printed information is displayed.

 

The compile option-T specifies a default entry for the program. Otherwise, a warning is reported.

-El is used to generate an LSB program, that is, the small-end mode.

 

 

 

 

 

 

Keywords: Cross-compiler, MIPS-elf-gcc

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.