Run-Time Initialization

C/C++ programs require initialization of the run-time environment before execution of the program itself may begin. This initialization is performed by a bootstrap routine. This routine is responsible for creating the stack, initializing global variables, and calling the main() function. The bootstrap routine should be the entry point for the program, and it typically should be the RESET interrupt handler. The bootstrap routine is responsible for the following tasks:

  1. Set up the stack by initializing SP
  2. Set up the data page pointer DP (for architectures that have one)
  3. Set configuration registers
  4. Process the .cinit table to autoinitialize global variables (when using the --rom_model option)
  5. Process the .pinit table to construct global C++ objects.
  6. Call the main() function with appropriate arguments
  7. Call exit() when main() returns

When you compile a C/C++ program and use --rom_model or --ram_model, the linker automatically looks for a bootstrap routine named _c_int00. The run-time support library provides a sample _c_int00 in boot.c.obj, which performs the required tasks. If you use the run-time support's bootstrap routine, you should set _c_int00 as the entry point.

NOTE

The _c_int00 Symbol

If you use the --ram_model or --rom_model link option, _c_int00 is automatically defined as the entry point for the program. Otherwise, an entry point is not automatically selected and you will receive a linker warning.