The compiler produces relocatable blocks of code
and data called sections, which are allocated in memory in a variety of ways
to conform to a various system configurations. For information about sections and
allocating them, see the introductory object file information in Chapter 307. For details about C7000
section names, see the C7000 Embedded Application Binary Interface (EABI)
Reference Guide (SPRUIG4).
There are two basic types of
sections:
- Initialized sections
contain data or executable code. Initialized sections are usually read-only;
exceptions are noted below. The C/C++ compiler creates the following initialized
sections:
- The .args section contains the
command argument for a host-based loader. See the --arg_size
option.
- The .binit section
contains boot time copy tables. For details on BINIT, see Section 12.8.4.2.
- The .cinit section is created only
if you are using the --rom_model option. It contains tables for
explicitly initialized global and static variables.
- The .got section contains the
global offset table. This section is writable.
- The .init_array section contains
the table for calling global constructors.
- The .ovly section contains copy tables for unions
in which different sections have the same run address.
- The .data section reserves space
for non-const, initialized global and static variables. This section is
writable.
- The .c7xabi.exidx section contains
the index table for exception handling. The .c7xabi.extab section
contains stack unwinding instructions for exception handling. See the
--exceptions option for details.
- The .name.load
section contains the compressed image of section name.See
Section 12.8 for information on copy tables.
- The .const section contains string
literals, floating-point constants, and data defined with the C/C++
qualifier const (provided the constant is not also defined as
volatile or one of the exceptions described in Section 5.5.2). String literals are placed in the .const:.string subsection to
enable greater link-time placement control.
- The .text section contains all the executable code and
compiler-generated constants. This section is usually read-only.
- The .TI.crctab
section contains CRC checking tables.
- Uninitialized sections
reserve space in memory (usually RAM). A program can use this space at run time
to create and store variables. The compiler creates the following uninitialized
sections:
- The .bss section
reserves space for uninitialized global and static variables. These
variables are allocated by the assembler.
- The .common
section reserves space for uninitialized global and static
variables. These variables are allocated by the linker. Unused
uninitialized variables are usually created as common symbols (unless
you specify --common=off), so that they can be excluded from the
resulting application.
- The .stack section
reserves memory for the system stack.
- The .sysmem
section reserves space for dynamic memory allocation. This space
is used by dynamic memory allocation routines, such as malloc(),
calloc(), realloc(), or new(). If a C/C++ program does not use these
functions, the compiler does not create the .sysmem section.
Note:
Use Only Code in Program MemoryWith the exception of code
sections, the initialized and uninitialized sections cannot be allocated into
internal program memory.
The
assembler creates the default sections .text, , and .data. You can instruct the compiler to create additional
sections by using the CODE_SECTION and DATA_SECTION pragmas (see Section 5.8.5 and Section 5.8.8).