OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [doc/] [html/] [ref/] [hal-linker-scripts.html] - Rev 28

Go to most recent revision | Compare with Previous | Blame | View Log

<!-- Copyright (C) 2003 Red Hat, Inc.                                -->
<!-- This material may be distributed only subject to the terms      -->
<!-- and conditions set forth in the Open Publication License, v1.0  -->
<!-- or later (the latest version is presently available at          -->
<!-- http://www.opencontent.org/openpub/).                           -->
<!-- Distribution of the work or derivative of the work in any       -->
<!-- standard (paper) book form is prohibited unless prior           -->
<!-- permission is obtained from the copyright holder.               -->
<HTML
><HEAD
><TITLE
>Linker Scripts</TITLE
><meta name="MSSmartTagsPreventParsing" content="TRUE">
<META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="eCos Reference Manual"
HREF="ecos-ref.html"><LINK
REL="UP"
TITLE="HAL Interfaces"
HREF="hal-interfaces.html"><LINK
REL="PREVIOUS"
TITLE="Cache Control"
HREF="hal-cache-control.html"><LINK
REL="NEXT"
TITLE="Diagnostic Support"
HREF="hal-diagnostic-support.html"></HEAD
><BODY
CLASS="SECTION"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>eCos Reference Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="hal-cache-control.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 9. HAL Interfaces</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="hal-diagnostic-support.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECTION"
><H1
CLASS="SECTION"
><A
NAME="HAL-LINKER-SCRIPTS">Linker Scripts</H1
><P
>When an eCos application is linked it must be done under the control
of a linker script. This script defines the memory areas, addresses
and sized, into which the code and data are to be put, and allocates
the various sections generated by the compiler to these.</P
><P
>The linker script actually used is in
<TT
CLASS="FILENAME"
>lib/target.ld</TT
> in the install directory. This is
actually manufactured out of two other files: a base linker script and
an <TT
CLASS="LITERAL"
>.ldi</TT
> file that was generated by the memory
layout tool.</P
><P
>The base linker script is usually supplied either by the architecture
HAL or the variant HAL. It consists of a set of linker script
fragments, in the form of C preprocessor macros, that define the major
output sections to be generated by the link operation. The
<TT
CLASS="LITERAL"
>.ldi</TT
> file, which is <TT
CLASS="LITERAL"
>#include'ed</TT
>
by the base linker script, uses these macro definitions to assign the
output sections to the required memory areas and link addresses.</P
><P
>The <TT
CLASS="LITERAL"
>.ldi</TT
> file is supplied by the platform HAL, and
contains knowledge of the memory layout of the target platform. These
files generally conform to a standard naming convention, each file
being of the form:</P
><P
><TT
CLASS="FILENAME"
>pkgconf/mlt_&lt;architecture&gt;_&lt;variant&gt;_&lt;platform&gt;_&lt;startup&gt;.ldi</TT
></P
><P
>where <TT
CLASS="LITERAL"
>&lt;architecture&gt;</TT
>,
<TT
CLASS="LITERAL"
>&lt;variant&gt;</TT
> and
<TT
CLASS="LITERAL"
>&lt;platform&gt;</TT
> are the respective HAL package
names and <TT
CLASS="LITERAL"
>&lt;startup&gt;</TT
> is the startup type which
is usually one of <TT
CLASS="LITERAL"
>ROM</TT
>, <TT
CLASS="LITERAL"
>RAM</TT
> or
<TT
CLASS="LITERAL"
>ROMRAM</TT
>.</P
><P
>In addition to the <TT
CLASS="LITERAL"
>.ldi</TT
> file, there is also a
congruously name <TT
CLASS="LITERAL"
>.h</TT
> file. This may be used by the
application to access information defined in the
<TT
CLASS="LITERAL"
>.ldi</TT
> file. Specifically it contains the memory
layout defined there, together with any additional section names
defined by the user. Examples of the latter are heap areas or PCI bus
memory access windows.</P
><P
>The <TT
CLASS="LITERAL"
>.ldi</TT
> is manufactured by the <SPAN
CLASS="APPLICATION"
>Memory
Layout Tool</SPAN
> (MLT). The <SPAN
CLASS="APPLICATION"
>MLT</SPAN
> saves the memory
configuration into a file named</P
><P
><TT
CLASS="FILENAME"
>include/pkgconf/mlt_&lt;architecture&gt;_&lt;variant&gt;_&lt;platform&gt;_&lt;startup&gt;.mlt</TT
></P
><P
>in the platform HAL. This file is used by the
<SPAN
CLASS="APPLICATION"
>MLT</SPAN
> to manufacture both the
<TT
CLASS="LITERAL"
>.ldi</TT
> and <TT
CLASS="LITERAL"
>.h</TT
> files. Users should
beware that direct edits the either of these files may be overwritten
if the <SPAN
CLASS="APPLICATION"
>MLT</SPAN
> is run and regenerates them from the
<TT
CLASS="LITERAL"
>.mlt</TT
> file.</P
><P
>The names of the <TT
CLASS="LITERAL"
>.ldi</TT
> and <TT
CLASS="LITERAL"
>.h</TT
>
files are defined by macro definitions in
<TT
CLASS="FILENAME"
>pkgconf/system.h</TT
>. These are
<TT
CLASS="LITERAL"
>CYGHWR_MEMORY_LAYOUT_LDI</TT
> and
<TT
CLASS="LITERAL"
>CYGHWR_MEMORY_LAYOUT_H</TT
> respectively. While there
will be little need for the application to refer to the
<TT
CLASS="LITERAL"
>.ldi</TT
> file directly, it may include the
<TT
CLASS="LITERAL"
>.h</TT
> file as follows:</P
><TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>#include CYGHWR_MEMORY_LAYOUT_H</PRE
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="hal-cache-control.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ecos-ref.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="hal-diagnostic-support.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Cache Control</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="hal-interfaces.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Diagnostic Support</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.