|Getting Started with M68K Coral 66: Compilation System for the Motorola M68000 Family|
|Prev||Chapter 2. Advanced Techniques||Next|
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:
The program entry point (label
The exception vector table, which contains 256 exception vectors, each 4 bytes in size.
A handler for the reset exception.
A handler for each of any other exceptions that can be raised.
Code to initialize the stack pointer and frame pointer.
Code to initialize the data areas, either to zero, or from initial values stored in read-only memory.
Code to call the Coral 66 main program.
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
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.