2.3. Customizing the Start File

The start file contains code to initialize the CPU and any standard peripheral devices, followed by a call to the Coral 66 main program. The default start file makes assumptions about your hardware that are relevant for the simulator but which may not be appropriate for your target computer. It is therefore likely that you will wish to customize the start file.

In cases where existing application software is being ported to the XGC Compiler, the necessary start file code will already exist, but possibly in the wrong form. To clarify what we require in a start file, here is a brief list of what it includes. For more details, see the start file itself. The source is installed in /opt/m68k-c66-1.7/m68k-coff/src/libc/art0.S. You should copy this file to a working directory and edit it as necessary.

The start file contains the following:

Usually the exception vector table will be located at address zero, and the label start will be at zero. But note that some members of the Motorola M68000 family include a Vector Base Register that allows the CPU to switch to an interrupt vector table at some other address, once the program is running.

The command to compile the updated start file along with a Coral 66 file is shown in the following example. The command line option -nostartfiles tells the compiler to omit the default start file.

Example 2-1. Compiling with a Custom Start File


$ m68k-coff-gcc -nostartfiles art0.S hello.cor -o hello

You may of course compile the custom start file separately then mention its object code file on the command line instead.