Download TMS320C55x Optimizing C/C++ Compiler
Transcript
Controlling the Linking Process www.ti.com 4.3.6 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-1 summarizes the initialized sections. Table 4-2 summarizes the uninitialized sections. Table 4-1. Initialized Sections Created by the Compiler Name Contents .cinit Tables for explicitly initialized global and static variables .const Global and static const variables that are explicitly initialized and contain string literals. String literals, other than those used in an array initializer, are placed in the .const:.string subsection to enable greater link-time placement control. .pinit Table of constructors to be called at startup .text Executable code and constants Table 4-2. Uninitialized Sections Created by the Compiler Name Contents .args Linker-created section used to pass arguments from the command line of the loader to the program .bss Global and static variables .stack Primary stack .sysmem Memory for malloc functions (heap) .sysstack Secondary system stack 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; uninitialized sections are linked into RAM. See Section 6.1.4 for a complete description of how the compiler uses these sections. The linker provides MEMORY and SECTIONS directives for allocating sections. For more information about allocating sections into memory, see the TMS320C55x Assembly Language Tools User's Guide. Allocating Sections NOTE: When allocating sections, keep in mind that the .stack and .sysstack sections must be on the same 64K-word data page. Also, only code sections and huge-model data sections are allowed to cross page boundaries. 78 Linking C/C++ Code Copyright © 2011, Texas Instruments Incorporated SPRU281G – December 2011 Submit Documentation Feedback