Installing the MIPS Environment over Cygwin on Windows
(Soohyun Cho, Dept. of Computer Science, TAMU)
To install Cygwin, do the following steps:
- You can find the latest Cygwin setup program at
www.cygwin.com.
- Download setup.exe from the site then run it. After it is
connected to one of the mirror sites, you will be asked to select
packages to install.
- You can install everything if your hard disk has enough
space. Just sticking with the default selection of packages will
be OK in most cases. However, to build and run our cross
compiler on Cygwin you should include flex (a fast lexical
analyzer generator) package in Devel Category (I recommend to
install all packages in Devel Category) and file (determines
file type using 'magic' numbers) package in Utils Category.
To install the cross compiler for our mips64emulator you need to build
your own binutils and gcc instead of the ones provided by
Cygwin. (Remember, the ones provided by Cygwin generate code for
the PC, not for the MIPS.)
- You may download source codes of binutils and gcc by
including source codes of them when you select packages in
Cygwin setup.
- You can also find information of binutils and source codes
from www.gnu.org/software/binutils/.
- I tried two version of binutils, 2.13 and 2.15, on my Cygwins
on both Window XP and Window 2000 and they worked fine.
- You can find information on gcc and links to download it at
gcc.gnu.org.
- I tried 3.4.3 and it compiles fine on Cygwin.
- To build the cross compiler, follow (roughly) the sequence shown in the class handouts.
- Before start to build them, make temporary directories for
building binutils and gcc (e.g., build-binutils and build-gcc) in
order to keep the source directory clean. (You will appreciate
this if something goes wrong, and you have to restart.)
- If you follow the steps in the handouts, you will get the
execution files located in /usr/cross/bin directory. They include
mips64-unknown-elf-gcc.exe, mip64-unknown-elf-ld.exe, etc.
- Before you use these executables, you need to add them to
your PATH by just typing export
PATH=$PATH:/usr/cross/bin or adding the path in your shell
resource file ~/.bashrc (in the case of Bourne shell)
and type source .bashrc at your home directory, or you
can add the following commands in ~/.bashrc file and
type source .bashrc:
export PREFIX=/usr/cross
export TARGET=mips64-unknown-elf
export PATH=$PATH:$PREFIX/bin
To install mips64emul, perform the following steps:
- Download the mips64emul sources from gavare.se./mips64emul.
- You can uncompress it by typing tar -zxvf mips64emul-0.2.4.1.tar.gz.
- In the newly created directory, type make.
- You may copy mips64emul.exe to the directory /usr/local/bin
because the latter is readily in the PATH environment.
To test your cross compiler and mips64emulator installation try compiling
and running the hello.c code explained in the documentation of
mips64emul,
here. The
hello.c code is located in the doc directory in
the mips64emul directory.
Note that the documentation has a bug, at least until recently:
In order to run a program you need to include the -a
option. This is needed to tell the emulator what machine we want
to emulate ("barebone" in our case). In order to execute the test
program , we therefore type:
$ ./mips64emul -q -a hello
If it works you have succeeded to install cross compiler and mips64emulator on your Cygwin.
Note: To run MP1 source codes on Cygwin you have to
modify the given makefile a little because prefix of our cross
compiler was different from that used in the example. (You may
avoid this by making TARGET=mips64-elf when you build the cross
compiler.) Modify the makefile to include the lines below and comment-out
the original codes using "#":
C++ = mips64-unknown-elf-g++
LD = mips64-unknown-elf-ldd
AS = mips64-unknown-elf-gcc.
We are sure that you will have much fun with the machine
problems. Let us know if there is any problem!
Soohyun Cho