HowTo Install Cross Compiler For MIPS
HowTo Install Cross Compiler For MIPS
1. Installing cygwin
Go to http://cygwin.com/, download and run cygwin‟s setup.exe. Choose the option to install
from the internet.
Then continue the setup with the default settings, until reaching the Select Packages window. In
this window, you have to make sure you are installing gcc (the C compiler) and make. To do
this, expand Devel and make sure the following packages are selected:
- gcc-core: C compiler
- make: The GNU version of the „make‟ utility
Finish the setup making sure to create an icon on the Desktop.
Commands in Cygwin
Cygwin behaves as most Unix systems. Tasks such as copying or deleting files are
achieved with commands. This is a list, for future reference, of basic commands that can
be used in Cygwin.
- pwd prints the current directory
- cd <subfolder> moves to the subfolder with that name
- cd .. moves up one folder
- ls displays the content of the current folder
- cp <targetfile> <targetdirectory> copies the target file into the
target directory
- mkdir <directorypath> creates a new directory
- tar <targetfile> uncompresses the target file
- make executes the Makefile in the current path
2. Downloads
Download all the files in http://courses.csail.mit.edu/6.095/current/software/
Locate all files in cygwin‟s home directory. The download should contain these files:
Makefile
binutils-2.16.1.tar.gz
gcc-core-3.4.6.tar.gz
newlib-1.9.0.tar.gz
lib.tgz
ttermp23.zip
test_and_calibration.rar
3. Compiling cross compiler for mips CPU
Run cygwin and write these commands. Do not hesitate to call a TA if you see an error message.
binutils ( version 2.16.1 )
$ mkdir /usr/local/src
$ cd /usr/local/src
$ tar xvfz ~/binutils-2.16.1.tar.gz
$ mkdir binutils_robin
$ cd binutils_robin
$ ../binutils-2.16.1/configure --target=mipsel-robin-elf --
prefix=/usr/local
$ make
$ make install
gcc ( version 3.4.6 )
$ cd /usr/local/src
$ tar xvfz ~/gcc-core-3.4.6.tar.gz
$ mkdir gcc_robin
$ cd gcc_robin
$ ../gcc-3.4.6/configure --target=mipsel-robin-elf --
prefix=/usr/local --with-newlib --enable-languages=c --
disable-threads --disable-shared
$ make
$ make install
newlib ( version 1.9.0 )
$ cd /usr/local/src
$ tar xvfz ~/newlib-1.9.0.tar.gz
$ mkdir newlib_robin
$ cd newlib_robin
$ ../newlib-1.9.0/configure --target=mipsel-robin-elf --
prefix=/usr/local
$ make
$ make install
4. Revising specs
Open the file /usr/local/lib/gcc/mipsel-robin-elf/3.4.6/specs with a text editor. Find the labels
called *lib and *startfile and replace their values with the following. Save the file with this
content.
*lib:
-lsemb -lc -lnullmon -lc
*startfile:
crt0%O%s crti%O%s crtbegin%O%s
5. Installing semb1200a-rom.ld
$ cd ~
$ cp semb1200a-rom.ld /usr/local/mipsel-robin-elf/lib/.
6. Installing lib, header files, and so on
$ cd ~
$ tar xfvz lib.tgz
$ cp –r lib/semb1200a /usr/local/mipsel-robin-elf/include/.
$ cp lib/libsemb.a /usr/local/mipsel-robin-elf/lib/.
$ cp lib/crt0.o /usr/local/mipsel-robin-elf/lib/.