]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - doc/html/user-guide/modifying-the-memory-layout.html
RedBoot TX53 Release 2012-02-15
[karo-tx-redboot.git] / doc / html / user-guide / modifying-the-memory-layout.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 >Modifying the Memory Layout</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 User Guide"
20 HREF="ecos-user-guide.html"><LINK
21 REL="UP"
22 TITLE="Manual Configuration"
23 HREF="manual-configuration.html"><LINK
24 REL="PREVIOUS"
25 TITLE="Editing the Sources"
26 HREF="editing-the-sources.html"><LINK
27 REL="NEXT"
28 TITLE="Managing the Package Repository"
29 HREF="managing-package-repository.html"></HEAD
30 ><BODY
31 CLASS="SECT1"
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 User Guide</TH
50 ></TR
51 ><TR
52 ><TD
53 WIDTH="10%"
54 ALIGN="left"
55 VALIGN="bottom"
56 ><A
57 HREF="editing-the-sources.html"
58 ACCESSKEY="P"
59 >Prev</A
60 ></TD
61 ><TD
62 WIDTH="80%"
63 ALIGN="center"
64 VALIGN="bottom"
65 >Chapter 28. Manual Configuration</TD
66 ><TD
67 WIDTH="10%"
68 ALIGN="right"
69 VALIGN="bottom"
70 ><A
71 HREF="managing-package-repository.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="SECT1"
82 ><H1
83 CLASS="SECT1"
84 ><A
85 NAME="MODIFYING-THE-MEMORY-LAYOUT">Modifying the Memory Layout</H1
86 ><P
87 >Each <SPAN
88 CLASS="PRODUCTNAME"
89 >eCos</SPAN
90 > platform package is supplied with linker script
91 fragments which describe the location of memory regions on the evaluation
92 board and the location of memory sections within these regions.
93 The correct linker script fragment is selected and included in the
94 <SPAN
95 CLASS="PRODUCTNAME"
96 >eCos</SPAN
97 > linker script <TT
98 CLASS="FILENAME"
99 >target.ld</TT
100 > when
101 <SPAN
102 CLASS="PRODUCTNAME"
103 >eCos</SPAN
104 > is built.</P
105 ><P
106 >It is not necessary to modify the default memory
107 layouts in order to start development with <SPAN
108 CLASS="PRODUCTNAME"
109 >eCos</SPAN
110 >. However, it will
111 be necessary to edit a linker script fragment when the memory map
112 of the evaluation board is changed. For example, if additional memory
113 is added, the linker must be notified that the new memory is available
114 for use. As a minimum, this would involve modifying the length of
115 the corresponding memory region. Where the available memory is non-contiguous,
116 it may be necessary to declare a new memory region and reassign
117 certain linker output sections to the new region.</P
118 ><P
119 >Linker script fragments and memory layout header files should
120 be edited within the <SPAN
121 CLASS="PRODUCTNAME"
122 >eCos</SPAN
123 > install tree. They are
124 located at <TT
125 CLASS="FILENAME"
126 >include/pkgconf/mlt_*.*</TT
127 >.
128 Where multiple start-up types are in use, it will be necessary to
129 edit multiple linker script fragments and header files. The information
130 provided in the header file and the corresponding linker script
131 fragment must always match. A typical linker script fragment is
132 shown below:</P
133 ><DIV
134 CLASS="EXAMPLE"
135 ><A
136 NAME="AEN2992"><P
137 ><B
138 >Example 28-1. <SPAN
139 CLASS="PRODUCTNAME"
140 >eCos</SPAN
141 > linker script fragment</B
142 ></P
143 ><TABLE
144 BORDER="5"
145 BGCOLOR="#E0E0F0"
146 WIDTH="70%"
147 ><TR
148 ><TD
149 ><PRE
150 CLASS="PROGRAMLISTING"
151 >MEMORY
152 {
153  rom : ORIGIN = 0x40000000, LENGTH = 0x80000
154  ram : ORIGIN = 0x48000000, LENGTH = 0x200000
155 }
156
157 SECTIONS
158 {
159  SECTIONS_BEGIN
160  SECTION_rom_vectors (rom, 0x40000000, LMA_EQ_VMA)
161  SECTION_text (rom, ALIGN (0x1), LMA_EQ_VMA)
162  SECTION_fini (rom, ALIGN (0x1), LMA_EQ_VMA)
163  SECTION_rodata (rom, ALIGN (0x1), LMA_EQ_VMA)
164  SECTION_rodata1 (rom, ALIGN (0x1), LMA_EQ_VMA)
165  SECTION_fixup (rom, ALIGN (0x1), LMA_EQ_VMA)
166  SECTION_gcc_except_table (rom, ALIGN (0x1), LMA_EQ_VMA)
167  SECTION_data (ram, 0x48000000, FOLLOWING (.gcc_except_table))
168  SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA)
169  SECTIONS_END
170 }</PRE
171 ></TD
172 ></TR
173 ></TABLE
174 ></DIV
175 ><P
176 >The file consists of two blocks, the <TT
177 CLASS="LITERAL"
178 >MEMORY</TT
179 > block
180 contains lines describing the address (<TT
181 CLASS="LITERAL"
182 >ORIGIN</TT
183 >)
184 and the size (<TT
185 CLASS="LITERAL"
186 >LENGTH</TT
187 >) of each memory
188 region. The <TT
189 CLASS="LITERAL"
190 >MEMORY</TT
191 > block is followed
192 by the <TT
193 CLASS="LITERAL"
194 >SECTIONS</TT
195 > block which contains
196 lines describing each of the linker output sections. Each section
197 is represented by a macro call. The arguments of these macros are
198 ordered as follows: </P
199 ><P
200 ></P
201 ><OL
202 TYPE="1"
203 ><LI
204 ><P
205 >The memory region in which the section will finally
206               reside.</P
207 ></LI
208 ><LI
209 ><P
210 >The final address (
211 <TT
212 CLASS="LITERAL"
213 >VMA</TT
214 >
215 ) of the section. This is expressed using one of the following forms:</P
216 ><P
217 ></P
218 ><DIV
219 CLASS="VARIABLELIST"
220 ><DL
221 ><DT
222 ><SPAN
223 CLASS="emphasis"
224 ><I
225 CLASS="EMPHASIS"
226 >n</I
227 ></SPAN
228 ></DT
229 ><DD
230 ><P
231 >at the absolute address specified by the
232                     unsigned integer <SPAN
233 CLASS="emphasis"
234 ><I
235 CLASS="EMPHASIS"
236 >n</I
237 ></SPAN
238 ></P
239 ></DD
240 ><DT
241 >ALIGN (<SPAN
242 CLASS="emphasis"
243 ><I
244 CLASS="EMPHASIS"
245 >n</I
246 ></SPAN
247 >)</DT
248 ><DD
249 ><P
250 >following the final location of the previous section
251                     with alignment to the next <SPAN
252 CLASS="emphasis"
253 ><I
254 CLASS="EMPHASIS"
255 >n</I
256 ></SPAN
257 >-byte
258                     boundary</P
259 ></DD
260 ></DL
261 ></DIV
262 ></LI
263 ><LI
264 ><P
265 >The initial address (<TT
266 CLASS="LITERAL"
267 >LMA</TT
268 >)
269               of the section. This is expressed using one of the
270               following forms:</P
271 ><P
272 ></P
273 ><DIV
274 CLASS="VARIABLELIST"
275 ><DL
276 ><DT
277 >LMA_EQ_VMA</DT
278 ><DD
279 ><P
280 >the <TT
281 CLASS="LITERAL"
282 >LMA</TT
283 >
284                     equals the <TT
285 CLASS="LITERAL"
286 >VMA</TT
287 > (no relocation)</P
288 ></DD
289 ><DT
290 >AT (<SPAN
291 CLASS="emphasis"
292 ><I
293 CLASS="EMPHASIS"
294 >n</I
295 ></SPAN
296 >)</DT
297 ><DD
298 ><P
299 >at the absolute address specified by the
300                     unsigned integer <SPAN
301 CLASS="emphasis"
302 ><I
303 CLASS="EMPHASIS"
304 >n</I
305 ></SPAN
306 ></P
307 ></DD
308 ><DT
309 >FOLLOWING (.<SPAN
310 CLASS="emphasis"
311 ><I
312 CLASS="EMPHASIS"
313 >name</I
314 ></SPAN
315 >)</DT
316 ><DD
317 ><P
318 >following the initial location of section
319                     <SPAN
320 CLASS="emphasis"
321 ><I
322 CLASS="EMPHASIS"
323 >name</I
324 ></SPAN
325 ></P
326 ></DD
327 ></DL
328 ></DIV
329 ></LI
330 ></OL
331 ><P
332 >In order to maintain compatibility with linker script
333           fragments and header files exported by the
334           <SPAN
335 CLASS="PRODUCTNAME"
336 >eCos</SPAN
337 > <SPAN
338 CLASS="APPLICATION"
339 >Configuration Tool</SPAN
340 >, the use
341           of other expressions within these files is not
342           recommended.</P
343 ><P
344 >Note that the names of the linker output sections will vary
345 between target architectures. A description of these sections can
346 be found in the specific <SPAN
347 CLASS="PRODUCTNAME"
348 >GCC</SPAN
349 > documentation for
350 your architecture.</P
351 ></DIV
352 ><DIV
353 CLASS="NAVFOOTER"
354 ><HR
355 ALIGN="LEFT"
356 WIDTH="100%"><TABLE
357 SUMMARY="Footer navigation table"
358 WIDTH="100%"
359 BORDER="0"
360 CELLPADDING="0"
361 CELLSPACING="0"
362 ><TR
363 ><TD
364 WIDTH="33%"
365 ALIGN="left"
366 VALIGN="top"
367 ><A
368 HREF="editing-the-sources.html"
369 ACCESSKEY="P"
370 >Prev</A
371 ></TD
372 ><TD
373 WIDTH="34%"
374 ALIGN="center"
375 VALIGN="top"
376 ><A
377 HREF="ecos-user-guide.html"
378 ACCESSKEY="H"
379 >Home</A
380 ></TD
381 ><TD
382 WIDTH="33%"
383 ALIGN="right"
384 VALIGN="top"
385 ><A
386 HREF="managing-package-repository.html"
387 ACCESSKEY="N"
388 >Next</A
389 ></TD
390 ></TR
391 ><TR
392 ><TD
393 WIDTH="33%"
394 ALIGN="left"
395 VALIGN="top"
396 >Editing the Sources</TD
397 ><TD
398 WIDTH="34%"
399 ALIGN="center"
400 VALIGN="top"
401 ><A
402 HREF="manual-configuration.html"
403 ACCESSKEY="U"
404 >Up</A
405 ></TD
406 ><TD
407 WIDTH="33%"
408 ALIGN="right"
409 VALIGN="top"
410 >Managing the Package Repository</TD
411 ></TR
412 ></TABLE
413 ></DIV
414 ></BODY
415 ></HTML
416 >