TMS34010 C Compiler - Al Kossow's Bitsavers
TMS34010 C Compiler - Al Kossow's Bitsavers
TMS34010 C Compiler - Al Kossow's Bitsavers
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Runtime Environment - Memory Model<br />
5.1 Memory Model<br />
5.1.1 Sections<br />
<strong>TMS34010</strong> C treats memory as a single linear block that is partitioned into<br />
subblocks of code and data. Each block of memory generated by a C program<br />
will be placed into a contiguous block in the appropriate memory space.<br />
Note that the linker, not the compiler, defines the memory map and allocates<br />
code and data into target memory. The compiler assumes nothing about the<br />
types of memory that are available, about any locations that are not available<br />
(holes), or about any locations that are reserved for I/O or control purposes.<br />
The compiler produces relocatable code, which allows the linker to allocate<br />
code and data into the appropriate memory spaces. Each block of code and<br />
data could be allocated individually into memory, but this is not a general<br />
practice (an exception to this is memory-mapped I/O, although physical memory<br />
locations can be accessed with C pointer types).<br />
The compiler produces three relocatable blocks of code and data; these blocks,<br />
called sections, can be allocated into memory in a variety of ways, to conform<br />
to a variety of system configurations. For more information about sections,<br />
please read Section 3 (Introduction to Common Object File Format) of the<br />
<strong>TMS34010</strong> Assembly Language Tools User's Guide.<br />
There are two basic types of sections:<br />
• Initialized sections contain data or executable code.<br />
• Uninitialized sections reserve space in memory (usually RAM). A<br />
program can use this space at run time for creating and storing variables.<br />
The C compiler creates two initialized sections, .text and .cinit; it creates one<br />
uninitialized section, .bss.<br />
• The .text section is an initialized section that contains all the executable<br />
code as well as string literals and floating-point constants.<br />
• The .cinit section is an initialized section that contains tables for initializing<br />
variab,les and constants.<br />
• The .bss section is an uninitialized section; in a C program, it serves<br />
three purposes:<br />
It reserves space for global and static variables. At boot time, the<br />
C boot routines copies data out of the .cinit section (which may<br />
be in ROM) and uses it for initializing variables in .bss.<br />
It reserves space for the system stack and the program stack.<br />
It reserves space for use by the dynamic memory functions (malloc,<br />
calloc, and realloc).<br />
Note that the assembler creates an additional section called .data; the C environment<br />
does not use this section. The linker takes the individual sections<br />
from different modules and combines sections with the same name to create<br />
four output sections. The complete program is made up of the compiler's<br />
three output sections plus the assembler's .data section. You can place these<br />
output sections anywhere in the address space, as needed, to meet system<br />
5-2