Linker Script Language (LSL)
With the keyword
blocksize
, the size of the output section will adapt to the size of its content. For example: group flash_area (run_addr = 0x10000)
{
section "flash_code" (blocksize=4k, attributes=rx,
fill=0)
{
select "*.flash";
}
}
If the content of the section is 1 mau, the size will be 4 kB, if the content is 11 kB, the section will be
12 kB, etc. If you use
size
in combination with
blocksize
, the
size
value is used as default (minimal) size for this section. If it is omitted, the default size will be of
blocksize
. It is not allowed to omit both
size
and
blocksize
from the section definition.
The linker creates two labels to mark the begin and end of the section,
_lc_ub_name
for the begin of the section and
_lc_ue_name
for the end of the output section.
Copy table
• The keyword
copytable
tells the linker to select a section that is used as copy table. The content of the copy table is created by the linker. It contains the start address and length of all sections that should be initialized by the startup code.
The linker creates two labels to mark the begin and end of the section,
_lc_ub_table
for the begin of the section and
_lc_ue_table
for the end of the copy table. The linker generates a copy table when a reference to either of the section labels exists in one of the input object files.
14.8.4. Creating Symbols
You can tell the linker to create symbols before locating by putting assignments in the section layout definition. Symbol names are represented by double-quoted strings. Any string is allowed, but object files may not support all characters for symbol names. You can use two different assignment operators. With the simple assignment operator '=', the symbol is created unconditionally. With the ':=' operator, the symbol is only created if it already exists as an undefined reference in an object file.
The expression that represents the value to assign to the symbol may contain references to other symbols.
If such a referred symbol is a special section symbol, creation of the symbol in the left hand side of the assignment will cause creation of the special section.
section_layout
{
"_lc_cp" := "_lc_ub_table";
// when the symbol _lc_cp occurs as an undefined reference
// in an object file, the linker generates a copy table
}
785