Contents|Index|Previous

The C Run-Time Environment (crt0)

To link and run C or C++ programs, you need to define a small module (usually written in assembler as ‘crt0.s’) that makes sure the hardware is initialized for C conventions before calling main.

There are some examples of ‘crt0.s’ code (along with examples of system call stub code) available in the source code for GNUPro Toolkit.

Look in the following path.

installdir/progressive-97r1a/src/newlib/libc/sys

installdir refers to your installation directory, by default ‘/usr/cygnus’.

For example, look in ‘.../sys/h8300hms’ for Hitachi H8/300 bare boards, or in ‘.../sys/sparclite’ for the Fujitsu SPARClite board.

More examples are in the following directory.

installdir/progressive-97r1a/src/newlib/stub

To write your own crt0.s, you need the following information about your target.

At a minimum, your crt0.s must do the following processes.

A more complete ‘crt0.s’ might also do the following processes.