Compiler
Operation
-
Linking
a C
Program
(the
floating-point
support
library). This program uses several routines
from
an
archive library called
rnatr
ix
.lib,
so
it
is
also named
as
linker
input. Note that
only
the library members that resolve undefined refer-
ences are linked in.
To
link
the program using this command file, simply enter:
gsplnk
link.cmd
This example uses the default memory allocation described in Section 9
of
the
TMS34010
Assembly Language Tools User's Guide. If you
want
to specify
different
MEMORY
and SECTIONS definitions, refer to that user's guide.
3.5.3
Autoinitialization
(ROM
and
RAM
Models)
The C compiler produces tables
of
data for autoinitializing global variables.
(Section 5.8.2.1, page
5-25,
discusses the format
of
these tables.) These ta-
bles
are
in a named section called
.cinit.
The initialization tables
can
be used
in either
of
two
ways:
•
ROM
Model
(-c
linker
option)
Global variables are initialized at run time. The .cinit section
is
loaded
into
memory along
with
all the other sections. The linker defines a spe-
cial symbol called
cinit
that
points
to
the beginning
of
the tables in
memory. When the program begins running, the C
boot
routine copies
data from the tables into the specified variables in the .bss section. This
allows initialization data
to
be stored in ROM and then copied
to
RAM
each time the program
is
started.
For more information
about
the ROM model,
see
Section 5.8.2.2 on
page
5-26.
•
RAM
Model
(-cr
linker
option)
Global variables
are
initialized at
load
time. A loader copies the initial-
ization routine into the variables in the .bss section; thus, no runtime
initialization
is
performed at
boot
time. This enhances performance
by
reducing
boot
time and saving memory used by the initialization tables.
For more information
about
the
RAM
model,
see
Section 5.8.2.3 on page
5-27.
3.5.4
The
-c
and
-cr
Linker
Options
The
following
list outlines
what
happens
when
you invoke the linker
with
the
-c
or
-cr
option.
• The symbol
-c-intOO
is
defined
as
the program entry point; it identifies
the beginning
of
the C
boot
routine in
boot.
obj.
When you use
-c
or
-cr,
-c-intOO
is
automatically referenced; this ensures that
boot.
obj
is
automatically linked in from the runtime-support library
rts.
lib.
• The
.cinit
output
section
is
padded
with
a termination record
so
that the
boot
routine
(ROM
model) or the loader
(RAM
model) can identify the
end
of
the initialization tables.
3-15