User`s guide
ELF Linker and Command Language
Linker Command File Syntax
296
Targeting MC56F83xx/DSP5685x Controllers
.main_application :
{
# .text sections
*(.text)
*(.rtlib.text)
*(.fp_engine.txt)
*(user.text)
} > .text
__ROM_Address = 0x2000
.data : AT(__ROM_Address) # ROM Address definition
{
# .data sections
F__Begin_Data = .; # Start location for RAM (0x3000)
*(.data) # Write data to the section (ROM)
*(fp_state.data);
*(rtlib.data);
F__End_Data = .; # Get end location for RAM
# .bss sections
* (rtlib.bss.lo)
* (.bss)
F__ROM_Address = __ROM_Address
} > .data
}
To make the runtime copy from ROM to RAM, you need to know where the data starts
in ROM (__ROM_Address) and the size of the block in ROM you want to copy to
RAM. In the following example (Listing 10.18
), copy all variables in the data section
from ROM to RAM in C code.
Listing 10.18 ROM to RAM Copy From C After Writing Data Flash
#include <stdio.h>
#include <string.h>
int GlobalFlash = 6;
// From linker command file
extern __Begin_Data, __ROMAddress, __End_Data;
void main( void )
{