Retro prof in the lab University of Washington Computer Science & Engineering
 CSE 378 Spring 2006
  CSE Home   About Us    Search    Contact Info 

Compiling C Programs for the MIPS Processor

To compile programs for your processor, you will be using a version of gcc that will take C code and compile it down to MIPS instructions, and some tools to turn those instructions into a .dump file that will contain all the required data for the processor to execute your program. In order to do this, follow the instructions below.

Useful files for compilation
compile.tar

Writing your program
For the most part, your program will be written like most other C programs. However, there are some differences of which you should be aware.
We do provide a single useful function. It does a simple delay loop, and can be used as a basis for better functions:

To access the various IO Devices on the board, you will use pointers to those locations in memory. These pointers should be declared as volatile chars or ints depending on the situation. We have included a header file (board.h) that defines some of the important addresses. The following are some of the basic pointers and methods of access that you will want to use for I/O purposes: You can access these pointers like normal C pointers in order to get and set data as necessary.

Compiling
The archive that you have downloaded contains a makefile to make compiling easier. You should replace the section . This makefile will allow you to run "make" in your code directory and will produce the .dump file that you will need in order to load your program onto the board. The code produced will initialize the stack pointer and other various registers in a way that will allow your program to run once it is on the board.

Loading the program onto your processor
Once you have created the .dump file, start up the CSE378 Bootloader software and load the newly created .dump file into it. At this point, you may want to use the soft reset on the board to prepare the board for recieving the file. Note that in order for this process to work, the board should be running off the BIOS and not a program that you have created.

Once the board is ready to recieve the program, set the COM port if necessary (which will probably not be the case on lab PCs), then click on the "Connect" button. You are now ready to send the program over to the board. Click on the "Write" button and the data will be sent over to the board, which will exit the BIOS and start executing your program. You should now be able to see the results of your program either on the screen or LEDs if you chose to use them.


CSE logo Computer Science & Engineering
University of Washington
Box 352350
Seattle, WA  98195-2350
(206) 543-1695 voice, (206) 543-2969 FAX
[comments to Shen]