10.3.4.2 Output Section .text

Section .text collects executable code from library and interrupt functions.

/*
** User Code and Library Code
*/
.text :
{
       *(.init);
       *(.user_init);
       KEEP(*(.handle));
       KEEP(*(.isr));
       *(.libc) *(.libm) *(.libdsp); /* keep together in this order */
       *(.lib*);
} >program

Several different input sections are collected into one output section. This was done to ensure the order in which the input sections are loaded.

Table 10-1. Section Types and Names
Section TypeSection NameDescription
input.initContains the startup code that is executed immediately after device reset. It is positioned first so that its address may be readily available.
input.user_initContains a call table for user initialization functions.
input.handleUsed for function pointers and is loaded first at low addresses. keep is required to prevent -gcc-sections from deleting this code.
input.isrUsed for interrupt service functions. Again, keep is used to preserve the code.
library.libc

.libm

.libdsp

These sections must be grouped together to ensure locality of reference.
library.lib*Collects other libraries, such as the peripheral libraries (which are allocated in section .libperi).

Input section .text is not explicitly mapped here, so that the linker may distribute executable code efficiently around other structures in memory, especially PSV sections which have specific address requirements.