Controlling the Linking Process
4-11
Linking C Code
4.5.3 Specifying Where to Allocate Sections in Memory
The compiler produces relocatable blocks of code and data. These blocks,
called
sections
, are allocated in memory in a variety of ways to conform to a
variety of system configurations.
The compiler creates two basic kinds of sections: initialized and uninitialized.
Table 4
Table 4
−
2. Sections Created by the Compiler
(a) Initialized sections
Name
Contents
.cinit
Tables for explicitly initialized global and static variables
.const
String literals, and global and static const variables that are explicitly
initialized
.switch
Jump tables for large switch statements
.text
Executable code and floating-point constants
(b) Uninitialized sections
Name
Contents
.bss
Global and static variables
.stack
Software stack
.sysmem
Dynamic memory area for malloc functions (heap)
When you link your program, you must specify where to allocate the sections
in memory. In general, initialized sections are linked into ROM or RAM; unini-
tialized sections are linked into RAM. Though the .const section can be placed
in ROM because it is never written to, it must be configured as data memory
because of how it is accessed (see subsection 6.1.3,
Allocating .const to Pro-
gram Memory
, on page 6-5, for details). See section 6.1.1,
Sections
, on page
6-3, for a complete description of how the compiler uses these sections. The
linker provides MEMORY and SECTIONS directives for allocating sections.
Summary of Contents for TMS320C2x
Page 8: ...viii...
Page 69: ...2 47 C Compiler Description...
Page 159: ...6 36...
Page 226: ...8 6...