Runtime
Environment
-
System
Initialization
When you use the
-c
or -cr linker option, the linker links together the .cinit
sections from
all the C modules and appends a null
word
to
the end
of
the
composite .cinit section. This terminating record appears
as
a record
with
a
size
field
of
0, marking the end
of
the initialization tables.
5.8.2.2
ROM
Autoinitialization
Model
The ROM model
is
the default method
of
autoinitialization;
to
use this model,
invoke the linker
with
the
-c
option.
In this method, global variables
are
initialized at run time. The .cinit section
is
loaded into memory (possibly
ROM)
along
with
all the other sections. The
linker defines a special symbol called
cinit
that points
to
the beginning
of
the initialization tables in memory. When the program begins running,
the
C
boot
routine copies data from the tables (pointed
to
by
cinit)
into the spe-
cified
variables in .bss. This allows initialization data
to
be storpn in ROM and
then copied
to
RAM each time the program
is
started.
Figure
5-6
illustrates the ROM model
of
autoinitialization.
Object File
Memory
Figure
5-6.
ROM
Model
of
Autoinitialization
5-25