Each eCos platform package is supplied with linker script
fragments which describe the location of memory regions on the evaluation
board and the location of memory sections within these regions.
The correct linker script fragment is selected and included in the
eCos linker script target.ld when
eCos is built.
It is not necessary to modify the default memory
layouts in order to start development with eCos. However, it will
be necessary to edit a linker script fragment when the memory map
of the evaluation board is changed. For example, if additional memory
is added, the linker must be notified that the new memory is available
for use. As a minimum, this would involve modifying the length of
the corresponding memory region. Where the available memory is non-contiguous,
it may be necessary to declare a new memory region and reassign
certain linker output sections to the new region.
Linker script fragments and memory layout header files should
be edited within the eCos install tree. They are
located at include/pkgconf/mlt_*.*.
Where multiple start-up types are in use, it will be necessary to
edit multiple linker script fragments and header files. The information
provided in the header file and the corresponding linker script
fragment must always match. A typical linker script fragment is
shown below:
The file consists of two blocks, the MEMORY block
contains lines describing the address (ORIGIN)
and the size (LENGTH) of each memory
region. The MEMORY block is followed
by the SECTIONS block which contains
lines describing each of the linker output sections. Each section
is represented by a macro call. The arguments of these macros are
ordered as follows:
The memory region in which the section will finally
reside.
The final address (
VMA
) of the section. This is expressed using one of the following forms:
n
at the absolute address specified by the
unsigned integer n
ALIGN (n)
following the final location of the previous section
with alignment to the next n-byte
boundary
The initial address (LMA)
of the section. This is expressed using one of the
following forms:
LMA_EQ_VMA
the LMA
equals the VMA (no relocation)
AT (n)
at the absolute address specified by the
unsigned integer n
FOLLOWING (.name)
following the initial location of section
name
In order to maintain compatibility with linker script
fragments and header files exported by the
eCosConfiguration Tool, the use
of other expressions within these files is not
recommended.
Note that the names of the linker output sections will vary
between target architectures. A description of these sections can
be found in the specific GCC documentation for
your architecture.