User`s guide
ELF Linker and Command Language
Linker Command File Syntax
295Targeting MC56F83xx/DSP5685x Controllers
Listing 10.16 Sample Function Selection Using OBJECT Keyword
SECTIONS {
.program_section :
{
OBJECT (Fpad, main.c)
OBJECT (Ffoot, main.c)
* (.text)
} > ROOT
}
NOTE If an object is written once using the OBJECT function selection
keyword, the same object will not be written again if you use the '*'
file selection keyword.
ROM to RAM Copying
In embedded programming, it is common to copy a portion of a program resident in
ROM into RAM at runtime. For example, program variables cannot be accessed until
they are copied to RAM.
To indicate data or code that is meant to be copied from ROM to RAM, the data or
code is assigned two addresses. One address is its resident location in ROM (where it
is downloaded). The other is its intended location in RAM (where it is later copied in
C code).
Use the MEMORY segment to specify the intended RAM location, and the
AT(address) parameter to specify the resident ROM address.
For example, you have a program and you want to copy all your initialized data into
RAM at runtime. Listing 10.17
shows the LCF you use to set up for writing data to
ROM.
Listing 10.17 LCF to Setup for ROM to RAM Copy
MEMORY {
.text (RWX) : ORIGIN = 0x8000, LENGTH = 0x0 # code (p:)
.data (RW) : ORIGIN = 0x3000, LENGTH = 0x0 # data (x:)-> RAM
}
SECTIONS{