TMS34010
C
Run-Time
Environment
5.7.1
System
Stack
The system stack
is
pointed
to
by
the
SP
register and
grows
toward
low
me-
mory. This stack
is
used by
function
calls
to
save the context
of
the calling
function, including any registers used by the called function. This stack
is
supported directly
by
the TMS3401 0 instruction set, and register
SP
is dedi-
cated
to
stack management. The system stack
is
manipulated
by
C primarily
through
the use
of
four commands:
•
MMTM
Save Registers
•
MMFM
Restore Registers
•
CALLA
(or
CALL) Call a Function
•
RETS
(or RETI) Return from a Function (or Interrupt)
It
is
also used
by
interrupts
to
save the status
of
the interrupted function.
5.7.2
Program
Stack
The program stack
is
used
for
frame generation; i.e.,
to
pass arguments
to
functions and allocate local (temporary) variables for the called functions. The
program stack
is
controlled entirely in software, using
A14
to
point
to
the
current
"top
of
stack", and
grows
toward
high memory. Thus,
A14
is a
dedi-
cated register
in
the C environment, and
it
must be carefully manipulated
to
avoid system crashes.
5.7.3
Initialization
of
Global
Variables
Before execution
of
your
program, any global variables declared
to
be pre-
initialized
must
be initialized
by
the
boot
program. This is
done
through
the
use
of
initialization tables placed in the .data section
of
the
program object
module.
Any
module generated
by
the compiler may produce these tables,
and the linker appends them
into
one table.
Note:
Because the .data section
is
used
by
the codegen
to
contain initialization
tables only,
you
are
not
allowed to place any other data in this section.
Doing so causes corruption in the
initialization table format, causing
un-
predictable results.
Global
and static variables that are
not
autoinitialized are
not
guaranteed
to
be initialized
to
O.
5-13