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 PRU Assembly Language Tools User's Guide.

There are two basic types of sections:

The assembler creates the default sections .text, .bss, and .data. You can instruct the compiler to create additional sections by using the CODE_SECTION and DATA_SECTION pragmas (see Section 5.9.3 and Section 5.9.5).

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 6-1. You can place these output sections anywhere in the address space as needed to meet system requirements.

Table 6-1 Summary of Sections and Memory Placement

Section Type of Memory Section Type of Memory
.args ROM or RAM .init_array ROM or RAM
.bss RAM .rodata ROM or RAM
.cinit ROM or RAM .rofardata ROM or RAM
.data RAM .stack RAM
.farbss RAM .sysmem RAM
.fardata ROM or RAM .text ROM or RAM

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 PRU Assembly Language Tools User's Guide.