Specifications

320 www.xilinx.com Embedded System Tools Guide (EDK 6.2i)
1-800-255-7778 UG111 (v1.4) January 30, 2004
Chapter 22: Address Management
R
x Ensure that boot.o is the first file to be linked (Check the STARTUP(boot.o) in the
following script which achieves this)
x Ensure that the .vectors section is aligned on a 64k boundary. In order to ensure this,
make .vectors as the first section defintion in the linker script. The memory where
.vectors will be assigned to should start on a 64k boundary. Include this section
definition only when your program uses interrupts/exceptions. See the example
script given below to see how this is done.
x Each (physical) region of memory must use a separate program header. Two
discontinuous regions of memory cannot share a program header
x Put all uninitialized sections (.bss, .sbss, .sbss2, stack, heap) at the end of a memory
region. If this is impossible (eg., .sdata, .sbss and .sdata2, .sbss2 in same physical
memory), start a new program header for the first initialized section after
uninitialized sections.
x ANSI C requires that all uninitialized memory be initialized to startup (Not required
for stack and heap). The standard crt0.s that we provide assumes a single .bss section
that is initialized to zero. If there are multiple .bss sections, this crt will not work. You
should write your own crt that initializes all the bss sections.
For more details on the linker scripts, refer to the GNU loader documentation in the binutil
online manual (
http://www.gnu.org/manual).
Here is a sample linker script.
/*
* Define default stack and heap sizes
*/
STACKSIZE = 1k;
_HEAP_SIZE = DEFINED(_HEAP_SIZE) ? _HEAP_SIZE : 4k;
/*
* Define boot.o to be the first file for linking.
* This statement is mandatory.
*/
STARTUP(boot.o)
/* Specify the default entry point to the program */
ENTRY(_boot)
/*
* Define the Memory layout, specifying the start address
* and size of the different memory locations
*/
MEMORY
{
bram : ORIGIN = 0xffff8000, LENGTH = 0x7fff
boot : ORIGIN = 0xfffffffc, LENGTH = 4
}
/*
* Define the sections and where they are mapped in memory
* Here .boot sections goes into boot memory. Other sections
* are mapped to bram memory.