]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - doc/html/ref/hal-linker-scripts.html
RedBoot TX53 Release 2012-02-15
[karo-tx-redboot.git] / doc / html / ref / hal-linker-scripts.html
1 <!-- Copyright (C) 2003 Red Hat, Inc.                                -->
2 <!-- This material may be distributed only subject to the terms      -->
3 <!-- and conditions set forth in the Open Publication License, v1.0  -->
4 <!-- or later (the latest version is presently available at          -->
5 <!-- http://www.opencontent.org/openpub/).                           -->
6 <!-- Distribution of the work or derivative of the work in any       -->
7 <!-- standard (paper) book form is prohibited unless prior           -->
8 <!-- permission is obtained from the copyright holder.               -->
9 <HTML
10 ><HEAD
11 ><TITLE
12 >Linker Scripts</TITLE
13 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
14 <META
15 NAME="GENERATOR"
16 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
17 "><LINK
18 REL="HOME"
19 TITLE="eCos Reference Manual"
20 HREF="ecos-ref.html"><LINK
21 REL="UP"
22 TITLE="HAL Interfaces"
23 HREF="hal-interfaces.html"><LINK
24 REL="PREVIOUS"
25 TITLE="Cache Control"
26 HREF="hal-cache-control.html"><LINK
27 REL="NEXT"
28 TITLE="Diagnostic Support"
29 HREF="hal-diagnostic-support.html"></HEAD
30 ><BODY
31 CLASS="SECTION"
32 BGCOLOR="#FFFFFF"
33 TEXT="#000000"
34 LINK="#0000FF"
35 VLINK="#840084"
36 ALINK="#0000FF"
37 ><DIV
38 CLASS="NAVHEADER"
39 ><TABLE
40 SUMMARY="Header navigation table"
41 WIDTH="100%"
42 BORDER="0"
43 CELLPADDING="0"
44 CELLSPACING="0"
45 ><TR
46 ><TH
47 COLSPAN="3"
48 ALIGN="center"
49 >eCos Reference Manual</TH
50 ></TR
51 ><TR
52 ><TD
53 WIDTH="10%"
54 ALIGN="left"
55 VALIGN="bottom"
56 ><A
57 HREF="hal-cache-control.html"
58 ACCESSKEY="P"
59 >Prev</A
60 ></TD
61 ><TD
62 WIDTH="80%"
63 ALIGN="center"
64 VALIGN="bottom"
65 >Chapter 9. HAL Interfaces</TD
66 ><TD
67 WIDTH="10%"
68 ALIGN="right"
69 VALIGN="bottom"
70 ><A
71 HREF="hal-diagnostic-support.html"
72 ACCESSKEY="N"
73 >Next</A
74 ></TD
75 ></TR
76 ></TABLE
77 ><HR
78 ALIGN="LEFT"
79 WIDTH="100%"></DIV
80 ><DIV
81 CLASS="SECTION"
82 ><H1
83 CLASS="SECTION"
84 ><A
85 NAME="HAL-LINKER-SCRIPTS">Linker Scripts</H1
86 ><P
87 >When an eCos application is linked it must be done under the control
88 of a linker script. This script defines the memory areas, addresses
89 and sized, into which the code and data are to be put, and allocates
90 the various sections generated by the compiler to these.</P
91 ><P
92 >The linker script actually used is in
93 <TT
94 CLASS="FILENAME"
95 >lib/target.ld</TT
96 > in the install directory. This is
97 actually manufactured out of two other files: a base linker script and
98 an <TT
99 CLASS="LITERAL"
100 >.ldi</TT
101 > file that was generated by the memory
102 layout tool.</P
103 ><P
104 >The base linker script is usually supplied either by the architecture
105 HAL or the variant HAL. It consists of a set of linker script
106 fragments, in the form of C preprocessor macros, that define the major
107 output sections to be generated by the link operation. The
108 <TT
109 CLASS="LITERAL"
110 >.ldi</TT
111 > file, which is <TT
112 CLASS="LITERAL"
113 >#include'ed</TT
114 >
115 by the base linker script, uses these macro definitions to assign the
116 output sections to the required memory areas and link addresses.</P
117 ><P
118 >The <TT
119 CLASS="LITERAL"
120 >.ldi</TT
121 > file is supplied by the platform HAL, and
122 contains knowledge of the memory layout of the target platform. These
123 files generally conform to a standard naming convention, each file
124 being of the form:</P
125 ><P
126 ><TT
127 CLASS="FILENAME"
128 >pkgconf/mlt_&lt;architecture&gt;_&lt;variant&gt;_&lt;platform&gt;_&lt;startup&gt;.ldi</TT
129 ></P
130 ><P
131 >where <TT
132 CLASS="LITERAL"
133 >&lt;architecture&gt;</TT
134 >,
135 <TT
136 CLASS="LITERAL"
137 >&lt;variant&gt;</TT
138 > and
139 <TT
140 CLASS="LITERAL"
141 >&lt;platform&gt;</TT
142 > are the respective HAL package
143 names and <TT
144 CLASS="LITERAL"
145 >&lt;startup&gt;</TT
146 > is the startup type which
147 is usually one of <TT
148 CLASS="LITERAL"
149 >ROM</TT
150 >, <TT
151 CLASS="LITERAL"
152 >RAM</TT
153 > or
154 <TT
155 CLASS="LITERAL"
156 >ROMRAM</TT
157 >.</P
158 ><P
159 >In addition to the <TT
160 CLASS="LITERAL"
161 >.ldi</TT
162 > file, there is also a
163 congruously name <TT
164 CLASS="LITERAL"
165 >.h</TT
166 > file. This may be used by the
167 application to access information defined in the
168 <TT
169 CLASS="LITERAL"
170 >.ldi</TT
171 > file. Specifically it contains the memory
172 layout defined there, together with any additional section names
173 defined by the user. Examples of the latter are heap areas or PCI bus
174 memory access windows.</P
175 ><P
176 >The <TT
177 CLASS="LITERAL"
178 >.ldi</TT
179 > is manufactured by the <SPAN
180 CLASS="APPLICATION"
181 >Memory
182 Layout Tool</SPAN
183 > (MLT). The <SPAN
184 CLASS="APPLICATION"
185 >MLT</SPAN
186 > saves the memory
187 configuration into a file named</P
188 ><P
189 ><TT
190 CLASS="FILENAME"
191 >include/pkgconf/mlt_&lt;architecture&gt;_&lt;variant&gt;_&lt;platform&gt;_&lt;startup&gt;.mlt</TT
192 ></P
193 ><P
194 >in the platform HAL. This file is used by the
195 <SPAN
196 CLASS="APPLICATION"
197 >MLT</SPAN
198 > to manufacture both the
199 <TT
200 CLASS="LITERAL"
201 >.ldi</TT
202 > and <TT
203 CLASS="LITERAL"
204 >.h</TT
205 > files. Users should
206 beware that direct edits the either of these files may be overwritten
207 if the <SPAN
208 CLASS="APPLICATION"
209 >MLT</SPAN
210 > is run and regenerates them from the
211 <TT
212 CLASS="LITERAL"
213 >.mlt</TT
214 > file.</P
215 ><P
216 >The names of the <TT
217 CLASS="LITERAL"
218 >.ldi</TT
219 > and <TT
220 CLASS="LITERAL"
221 >.h</TT
222 >
223 files are defined by macro definitions in
224 <TT
225 CLASS="FILENAME"
226 >pkgconf/system.h</TT
227 >. These are
228 <TT
229 CLASS="LITERAL"
230 >CYGHWR_MEMORY_LAYOUT_LDI</TT
231 > and
232 <TT
233 CLASS="LITERAL"
234 >CYGHWR_MEMORY_LAYOUT_H</TT
235 > respectively. While there
236 will be little need for the application to refer to the
237 <TT
238 CLASS="LITERAL"
239 >.ldi</TT
240 > file directly, it may include the
241 <TT
242 CLASS="LITERAL"
243 >.h</TT
244 > file as follows:</P
245 ><TABLE
246 BORDER="5"
247 BGCOLOR="#E0E0F0"
248 WIDTH="70%"
249 ><TR
250 ><TD
251 ><PRE
252 CLASS="PROGRAMLISTING"
253 >#include CYGHWR_MEMORY_LAYOUT_H</PRE
254 ></TD
255 ></TR
256 ></TABLE
257 ></DIV
258 ><DIV
259 CLASS="NAVFOOTER"
260 ><HR
261 ALIGN="LEFT"
262 WIDTH="100%"><TABLE
263 SUMMARY="Footer navigation table"
264 WIDTH="100%"
265 BORDER="0"
266 CELLPADDING="0"
267 CELLSPACING="0"
268 ><TR
269 ><TD
270 WIDTH="33%"
271 ALIGN="left"
272 VALIGN="top"
273 ><A
274 HREF="hal-cache-control.html"
275 ACCESSKEY="P"
276 >Prev</A
277 ></TD
278 ><TD
279 WIDTH="34%"
280 ALIGN="center"
281 VALIGN="top"
282 ><A
283 HREF="ecos-ref.html"
284 ACCESSKEY="H"
285 >Home</A
286 ></TD
287 ><TD
288 WIDTH="33%"
289 ALIGN="right"
290 VALIGN="top"
291 ><A
292 HREF="hal-diagnostic-support.html"
293 ACCESSKEY="N"
294 >Next</A
295 ></TD
296 ></TR
297 ><TR
298 ><TD
299 WIDTH="33%"
300 ALIGN="left"
301 VALIGN="top"
302 >Cache Control</TD
303 ><TD
304 WIDTH="34%"
305 ALIGN="center"
306 VALIGN="top"
307 ><A
308 HREF="hal-interfaces.html"
309 ACCESSKEY="U"
310 >Up</A
311 ></TD
312 ><TD
313 WIDTH="33%"
314 ALIGN="right"
315 VALIGN="top"
316 >Diagnostic Support</TD
317 ></TR
318 ></TABLE
319 ></DIV
320 ></BODY
321 ></HTML
322 >