Memory Model
6-5
Run-Time Environment
The C environment manipulates these registers automatically. If you write
assembly language routines that use the run-time stack, be sure to use these
registers correctly. For more information about using these registers, see sec-
tion 6.2,
Register Conventions
, on page 6-9. For more information about the
Function Calling Conventions
The linker sets the stack size, creates a global symbol, __STACK_SIZE, and
assigns it a value equal to the stack size in bytes. The default stack size is 1K
bytes. You can change the size of the stack at link time by using the
−
stack
option with the linker. For more information, see section 4.4,
Linker Options
,
At system initialization, SP is set to a designated address for the bottom of the
stack. This address is the first location in the .stack section. Since the position
of the stack depends on where the .stack section is allocated, the actual
address of the stack is determined at link time. If you allocate the stack as the
last section in memory (highest address), the stack has unlimited space for
growth (within the limits of system memory).
Note: Stack Overflow
The compiler provides no means to check for stack overflow during compila-
tion or at run time. A stack overflow will disrupt the run-time environment,
causing your program to fail. Be sure to allow enough space for the stack to
grow.
6.1.3 Allocating .const to Program Memory
If your system configuration does not support allocating an initialized section
such as .const to data memory, then you must allocate the .const section to
load in program memory and run in data memory. At boot time, copy the .const
section from program to data memory. The following sequence shows how you
can perform this task:
First, modify the boot routine using the following steps:
1) Extract boot.asm from the source library:
dspar −x rts.src boot.asm
2) Edit boot.asm and change the CONST_COPY flag to 1:
CONST_COPY .set 1
3) Assemble boot.asm:
dspa −v<target> boot.asm
4) Archive the boot routine into the object library:
dspar −r rts<target>.lib boot.obj
Summary of Contents for TMS320C2x
Page 8: ...viii...
Page 69: ...2 47 C Compiler Description...
Page 159: ...6 36...
Page 226: ...8 6...