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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [doc/] [html/] [user-guide/] [compiler-and-linker-options.html] - Blame information for rev 842

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

Line No. Rev Author Line
1 28 unneback
<!-- 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
>Compiler and Linker Options</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="eCos Programming Concepts and Techniques"
23
HREF="ecos-programming-concepts-and-techniques.html"><LINK
24
REL="PREVIOUS"
25
TITLE="Application Build Tree"
26
HREF="repository-app-build-tree.html"><LINK
27
REL="NEXT"
28
TITLE="Compiling a C++ Application"
29
HREF="compiling-cpp-app.html"></HEAD
30
><BODY
31
CLASS="CHAPTER"
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="repository-app-build-tree.html"
58
ACCESSKEY="P"
59
>Prev</A
60
></TD
61
><TD
62
WIDTH="80%"
63
ALIGN="center"
64
VALIGN="bottom"
65
></TD
66
><TD
67
WIDTH="10%"
68
ALIGN="right"
69
VALIGN="bottom"
70
><A
71
HREF="compiling-cpp-app.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="CHAPTER"
82
><H1
83
><A
84
NAME="COMPILER-AND-LINKER-OPTIONS">Chapter 26. Compiler and Linker Options</H1
85
><DIV
86
CLASS="TOC"
87
><DL
88
><DT
89
><B
90
>Table of Contents</B
91
></DT
92
><DT
93
><A
94
HREF="compiler-and-linker-options.html#COMPILING-C-APP"
95
>Compiling a C Application</A
96
></DT
97
><DT
98
><A
99
HREF="compiling-cpp-app.html"
100
>Compiling a C++ Application</A
101
></DT
102
></DL
103
></DIV
104
><P
105
><SPAN
106
CLASS="PRODUCTNAME"
107
>eCos</SPAN
108
> is built using
109
      the GNU C and C++ compilers. <SPAN
110
CLASS="PRODUCTNAME"
111
>eCos</SPAN
112
> relies on certain features of these
113
      tools such as constructor priority ordering and selective linking
114
      which are not part of other toolchains.
115
    </P
116
><P
117
>Some <SPAN
118
CLASS="APPLICATION"
119
>GCC</SPAN
120
> options are required for <SPAN
121
CLASS="PRODUCTNAME"
122
>eCos</SPAN
123
>,
124
and others can be useful. This chapter gives a brief description
125
of the required options as well as some recommended <SPAN
126
CLASS="PRODUCTNAME"
127
>eCos</SPAN
128
>-specific options.
129
All other <SPAN
130
CLASS="APPLICATION"
131
>GCC</SPAN
132
> options (described in the <SPAN
133
CLASS="APPLICATION"
134
>GCC</SPAN
135
> manuals)
136
are available. </P
137
><DIV
138
CLASS="SECT1"
139
><H1
140
CLASS="SECT1"
141
><A
142
NAME="COMPILING-C-APP">Compiling a C Application</H1
143
><P
144
>The following command lines demonstrate the
145
          <SPAN
146
CLASS="emphasis"
147
><I
148
CLASS="EMPHASIS"
149
>minimum</I
150
></SPAN
151
> set of options required to
152
          compile and link an <SPAN
153
CLASS="PRODUCTNAME"
154
>eCos</SPAN
155
> program written in C. </P
156
><DIV
157
CLASS="NOTE"
158
><BLOCKQUOTE
159
CLASS="NOTE"
160
><P
161
><B
162
>Note: </B
163
>Remember that when this manual shows
164
            <B
165
CLASS="COMMAND"
166
><TT
167
CLASS="REPLACEABLE"
168
><I
169
>TARGET-</I
170
></TT
171
>gcc</B
172
>
173
            you should use the full name of the cross compiler,
174
            e.g. <B
175
CLASS="COMMAND"
176
>i386-elf-gcc</B
177
>,
178
            <B
179
CLASS="COMMAND"
180
>arm-elf-gcc</B
181
>, or
182
            <B
183
CLASS="COMMAND"
184
>sh-elf-gcc</B
185
>. When compiling for the
186
            synthetic Linux target, use the native
187
            <B
188
CLASS="COMMAND"
189
>gcc</B
190
> which must have the features
191
            required by <SPAN
192
CLASS="PRODUCTNAME"
193
>eCos</SPAN
194
>.</P
195
></BLOCKQUOTE
196
></DIV
197
><TABLE
198
BORDER="5"
199
BGCOLOR="#E0E0F0"
200
WIDTH="70%"
201
><TR
202
><TD
203
><PRE
204
CLASS="SCREEN"
205
>$ <TT
206
CLASS="REPLACEABLE"
207
><I
208
>TARGET-</I
209
></TT
210
>gcc -c  -I<SPAN
211
CLASS="emphasis"
212
><I
213
CLASS="EMPHASIS"
214
>INSTALL_DIR</I
215
></SPAN
216
>/include file.c
217
$ <TT
218
CLASS="REPLACEABLE"
219
><I
220
>TARGET-</I
221
></TT
222
>gcc -o program file.o -L<SPAN
223
CLASS="emphasis"
224
><I
225
CLASS="EMPHASIS"
226
>INSTALL_DIR</I
227
></SPAN
228
>/lib -Ttarget.ld -nostdlib</PRE
229
></TD
230
></TR
231
></TABLE
232
><DIV
233
CLASS="NOTE"
234
><BLOCKQUOTE
235
CLASS="NOTE"
236
><P
237
><B
238
>Note: </B
239
>Certain targets may require extra options, for example
240
            the SPARClite architectures require the option
241
            <TT
242
CLASS="OPTION"
243
>-mcpu=sparclite</TT
244
>. Examine the
245
            <TT
246
CLASS="FILENAME"
247
><TT
248
CLASS="REPLACEABLE"
249
><I
250
>BASE_DIR</I
251
></TT
252
>/examples/Makefile</TT
253
>
254
            or the &#8220;Global compiler flags&#8221; option
255
            (CYGBLD_GLOBAL_CFLAGS) in your generated
256
            <SPAN
257
CLASS="PRODUCTNAME"
258
>eCos</SPAN
259
> configuration) to see if any extra options are
260
            required, and if so, what they are. </P
261
><P
262
>The following command lines use some other options
263
            which are recommended because they use the
264
        selective linking feature:</P
265
><TABLE
266
BORDER="5"
267
BGCOLOR="#E0E0F0"
268
WIDTH="70%"
269
><TR
270
><TD
271
><PRE
272
CLASS="SCREEN"
273
>$ <TT
274
CLASS="REPLACEABLE"
275
><I
276
>TARGET-</I
277
></TT
278
>gcc -c  -I<TT
279
CLASS="REPLACEABLE"
280
><I
281
>INSTALL_DIR</I
282
></TT
283
>/include -I. -ffunction-sections -fdata-sections -g -O2 file.c
284
$ <TT
285
CLASS="REPLACEABLE"
286
><I
287
>TARGET-</I
288
></TT
289
>gcc -o program file.o -ffunction-sections -fdata-sections -Wl,--gc-sections -g -O2 \
290
          -L<TT
291
CLASS="REPLACEABLE"
292
><I
293
>INSTALL_DIR</I
294
></TT
295
>/lib -Ttarget.ld -nostdlib</PRE
296
></TD
297
></TR
298
></TABLE
299
></BLOCKQUOTE
300
></DIV
301
></DIV
302
></DIV
303
><DIV
304
CLASS="NAVFOOTER"
305
><HR
306
ALIGN="LEFT"
307
WIDTH="100%"><TABLE
308
SUMMARY="Footer navigation table"
309
WIDTH="100%"
310
BORDER="0"
311
CELLPADDING="0"
312
CELLSPACING="0"
313
><TR
314
><TD
315
WIDTH="33%"
316
ALIGN="left"
317
VALIGN="top"
318
><A
319
HREF="repository-app-build-tree.html"
320
ACCESSKEY="P"
321
>Prev</A
322
></TD
323
><TD
324
WIDTH="34%"
325
ALIGN="center"
326
VALIGN="top"
327
><A
328
HREF="ecos-user-guide.html"
329
ACCESSKEY="H"
330
>Home</A
331
></TD
332
><TD
333
WIDTH="33%"
334
ALIGN="right"
335
VALIGN="top"
336
><A
337
HREF="compiling-cpp-app.html"
338
ACCESSKEY="N"
339
>Next</A
340
></TD
341
></TR
342
><TR
343
><TD
344
WIDTH="33%"
345
ALIGN="left"
346
VALIGN="top"
347
>Application Build Tree</TD
348
><TD
349
WIDTH="34%"
350
ALIGN="center"
351
VALIGN="top"
352
><A
353
HREF="ecos-programming-concepts-and-techniques.html"
354
ACCESSKEY="U"
355
>Up</A
356
></TD
357
><TD
358
WIDTH="33%"
359
ALIGN="right"
360
VALIGN="top"
361
>Compiling a C++ Application</TD
362
></TR
363
></TABLE
364
></DIV
365
></BODY
366
></HTML
367
>

powered by: WebSVN 2.1.0

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