User`s guide
ELF Linker and Command Language
Linker Command File Syntax
297Targeting MC56F83xx/DSP5685x Controllers
unsigned short a = 0, b = 0, c = 0;
unsigned long dataLen = 0x0;
unsigned short __myArray[] = { 0xdead, 0xbeef, 0xcafe };
// Calculate the data length of the X: memory written to Flash
dataLen = (unsigned long)&__End_Data -
unsigned long)&__Begin_Data;
// Block move from ROM to RAM
memcpy( (unsigned long *)&__Begin_Data,
(const unsigned long *)&__ROMAddress,dataLen );
a = GlobalFlash;
return;
}
Stack and Heap
To reserve space for the stack and heap, arithmetic operations are performed to set the
values of the symbols used by the runtime.
The Linker Command File (LCF) performs all the necessary stack and heap
initialization. When Stationery is used to create a new project, the appropriate LCFs
are added to the new project.
See any Stationery-generated LCFs for examples of how stack and heap are initialized.
Writing Data Directly to Memory
You can write data directly to memory using the WRITEx command in the linker
command file. The WRITEB command writes a byte, the WRITEH command writes
two bytes, and the WRITEW command writes four bytes. You insert the data at the
section’s current address.
Listing 10.19 Embedding Data Directly Into Output
.example_data_section :
{
WRITEB 0x48; // 'H'
WRITEB 0x69; // 'i'