Installing the MIPS Environment over Cygwin on Windows Installing the MIPS Environment over Cygwin on Windows (Soohyun Cho, Dept. of Computer Science, TAMU Updated by Seung-Jin Sul, Jan 26 2006) 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 gxemul 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 ftp.kernel.org/pub/linux/devel/binutils/. I tried two version of binutils, 2.15 and 2.16, on my Cygwins on both Window XP and they worked fine. You can find information on gcc and links to download it from gcc.gnu.org. I tried gcc-4.0.2 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 gxemul, perform the following steps: Download the gxemul sources from gavare.se/gxemul/download.html You can uncompress it by typing tar -zxvf gxemul-0.3.7.tar.gz In the newly created directory, type ./configure And then, type make You may copy gxemul.exe to the directory /usr/local/bin because the latter is readily in the PATH environment. To test your cross compiler and gxemul installation try compiling and running the hello_mips.c code explained in the documentation of gxemul, here. The hello_mips.c code is located in the doc directory in the gxemul directory. In order to execute the test program , we therefore type: $ ./gxemul -q -E testmips hello_mips If it works you have succeeded to install cross compiler and gxemul 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! Seung-Jin Sul