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.
Section Type | Section Name | Description |
---|---|---|
input | .init | Contains the startup code that is executed immediately after device reset. It is positioned first so that its address may be readily available. |
input | .user_init | Contains a call table for user initialization functions. |
input | .handle | Used for function pointers and is loaded first at low addresses. keep is required to prevent -gcc-sections from deleting this code. |
input | .isr | Used for interrupt service functions. Again, keep is used to preserve the code. |
library | .libc
| 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.