User`s guide

ELF Linker and Command Language
Linker Command File Syntax
290
Targeting MC56F83xx/DSP5685x Controllers
Listing 10.5 Sample SECTIONS Segment
SECTIONS {
.section_name : #the section name is for your reference
{ #the section name must begin with a '.'
filename.c (.text) #put the .text section from filename.c
filename2.c (.text) #then the .text section from filename2.c
filename.c (.data)
filename2.c (.data)
filename.c (.bss)
filename2.c (.bss)
. = ALIGN (0x10); #align next section on 16-byte boundary.
} > segment_1 #this means "map these contents to segment_1"
.next_section_name:
{
more content descriptions
} > segment_x # end of .next_section_name definition
} # end of the sections block
Linker Command File Syntax
This section explains some practical ways in which to use the commands of the linker
command file to perform common tasks.
Alignment
To align data on a specific byte-boundary, use the ALIGN and ALIGNALL
commands to bump the location counter to the preferred boundary. For example, the
following fragment uses ALIGN to bump the location counter to the next 16-byte
boundary. An example is given in Listing 10.6
.
Listing 10.6 Sample ALIGN Command Usage
file.c (.text)
. = ALIGN (0x10);
file.c (.data) # aligned on a 16-byte boundary.
You can also align data on a specific byte-boundary with ALIGNALL, as shown in
Listing 10.7
.