System Initialization
6-31
Run-Time Environment
6.8 System Initialization
Before you can run a C program, you must create the C run-time environment.
The C boot routine performs this task using a function called c_int0. The run-
time-support source library, rts.src, contains the source to this routine in a
module named boot.asm.
To begin running the system, the c_int0 function can be branched to or called,
but it is usually vectored to by reset hardware. You must link the c_int0 function
with the other object modules. This occurs automatically when you use the
−
c
or
−
cr linker option and include rts25.lib, rts2xx.lib, or rts50.lib as one of the
linker input files.
When C programs are linked, the linker sets the entry point value in the execut-
able output module to the symbol _c_int0. This does not, however, set the
hardware to automatically vector to c_int00 at reset (see the).
The c_int0 function performs the following tasks to initialize the environment:
1) It defines a section called .stack for the system stack and sets up the initial
stack pointers.
2) It initializes global variables by copying the data from the initialization
tables in the .cinit section to the storage allocated for the variables in the
.bss section. If you are initializing variables at load time (
−
cr option), a
loader performs this step before the program runs (it is not performed by
the boot routine). For more information, see section 6.8.2,
Automatic Init-
ialization of Variables
3) It calls the function main to run the C program.
You can replace or modify the boot routine to meet your system requirements.
However, the boot routine
must
perform the operations listed above to
correctly initialize the C environment.
Summary of Contents for TMS320C2x
Page 8: ...viii...
Page 69: ...2 47 C Compiler Description...
Page 159: ...6 36...
Page 226: ...8 6...