Memory Model
6-6
Next, link with a linker command file that contains the following entries:
MEMORY
{
PAGE 0 : PROG : ...
PAGE 1 : DATA : ...
}
SECTIONS
{
...
.const : load = PROG PAGE 1, run = DATA PAGE 1
{
/* GET RUN ADDRESS */
__const_run = .;
/* MARK LOAD ADDRESS */
*(.c_mark)
/* ALLOCATE .const */
*(.const)
/* COMPUTE LENGTH */
__const_length = .− __const_run;
}
...
}
Your linker command file can substitute the name PROG with the name of a
memory area on page 0, and DATA with the name of a memory area on page 1.
The rest of the command file must use the names as above. The code in
boot.asm that is enabled when you change CONST_COPY to 1 depends on
the linker command file using these names in this manner. To change any of
the names, you must edit boot.asm and change the names in the same way.
6.1.4 Dynamic Memory Allocation
Dynamic memory allocation is not a standard part of the C language. The run-
time-support library supplied with the TMS320C2x/C2xx/C5x compiler con-
tains several functions (such as malloc, calloc, and realloc) that allow you to
allocate memory dynamically for variables at run time.
Memory is allocated from a global pool, or heap, that is defined in the .sysmem
section. You can set the size of the .sysmem section by using the
−
heap
size
option with the linker command. The linker also creates a global symbol,
__SYSMEM_SIZE, and assigns it a value equal to the size of the heap in
bytes. The default size is 0x400 bytes. For more information on the
−
heap
Linker Options,
Summary of Contents for TMS320C2x
Page 8: ...viii...
Page 69: ...2 47 C Compiler Description...
Page 159: ...6 36...
Page 226: ...8 6...