Sections

The compiler produces relocatable blocks of code and data called sections. The sections are allocated into memory in a variety of ways to conform to a variety of system configurations. For more information about sections and allocating them, see the introductory object file information in the TMS320C28x Assembly Language Tools User's Guide.

There are two basic types of sections:

The assembler creates the default sections .text, .ebss or .bss (depending on the ABI), and .data. You can instruct the compiler to create additional sections by using the CODE_SECTION and DATA_SECTION pragmas (see Section 6.10.5 and Section 6.10.7).

The linker takes the individual sections from different object files and combines sections that have the same name. The resulting output sections and the appropriate placement in memory for each section are listed in Table 7-1. You can place these output sections anywhere in the address space as needed to meet system requirements.

The linker also creates some additional sections not referenced by the compiler. For example, the .common section contains common-block symbols allocated by the linker.

For EABI, it is encouraged that you use a unified memory scheme that places all sections on page 0. However, the default linker command file specifies page 0 or 1 for sections as indicated in the following table. In general, uninitialized and constant value sections are placed on page 1 by the linker command file; all other sections are generally placed on page 0.

Table 7-1 Summary of Sections and Memory Placement

Section Type of Memory Default Page
.binit expected to be in FLASH/ROM 1
.bss (EABI only) must be in RAM 1
.ebss (COFF only) must be in RAM 1
.c28xabi.exidx (EABI only) expected to be in FLASH/ROM 1
.c28xabi.extab (EABI only) expected to be in FLASH/ROM 1
.cinit (1) expected to be in FLASH/ROM 0
.const (EABI only) expected to be in FLASH/ROM 1
.econst (COFF only) expected to be in FLASH/ROM 1
.data (used mainly by EABI) must be in RAM 0
.init_array (EABI only) expected to be in FLASH/ROM 0
.pinit (COFF only) expected to be in FLASH/ROM 0
.ppdata must be in RAM 1
.stack must be in RAM 1
.switch depends on the --unified_memory option setting 0, 1
.sysmem (EABI only) must be in RAM 1
.esysmem (COFF only) must be in RAM 1
.text expected to be in FLASH/ROM 0
The .cinit section is created by the compiler for COFF and by the linker for EABI.

You can use the SECTIONS directive in the linker command file to customize the section-allocation process. For more information about allocating sections into memory, see the linker description chapter in the TMS320C28x Assembly Language Tools User's Guide.