Contents|Index|Previous|Next
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’) to ensure that the hardware initializes for C conventions before calling main.

There are some examples available in the sources of GNUPro Toolkit for ‘crt0.s’ code (along with examples of system calls with sub-routines).
Look in the following path.

installdir/gnupro-99r1/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/gnupro-98r2/src/newlib/stub
To write your own crt0.s module, you need the following information about your target. At a minimum, your crt0.s module must do the following processes. A more complete ‘crt0.s’ module might also do the following processes.
Top|Contents|Index|Previous|Next