1 | @c |
---|
2 | @c COPYRIGHT (c) 1988-1998. |
---|
3 | @c On-Line Applications Research Corporation (OAR). |
---|
4 | @c All rights reserved. |
---|
5 | @c |
---|
6 | @c $Id$ |
---|
7 | @c |
---|
8 | |
---|
9 | @chapter Building the GNAT Cross Compiler Toolset |
---|
10 | |
---|
11 | This chapter describes the steps required to acquire the |
---|
12 | source code for a GNU cross compiler toolset, apply |
---|
13 | any required RTEMS specific patches, compile that |
---|
14 | toolset and install it. |
---|
15 | |
---|
16 | @section Create the Archive and Build Directories |
---|
17 | |
---|
18 | Start by making the @code{archive} directory to contain the downloaded |
---|
19 | source code and the @code{tools} directory to be used as a build |
---|
20 | directory. The command sequence to do this is shown |
---|
21 | below: |
---|
22 | |
---|
23 | @example |
---|
24 | mkdir archive |
---|
25 | mkdir tools |
---|
26 | @end example |
---|
27 | |
---|
28 | This will result in an initial directory structure similar to the |
---|
29 | one shown in the following figure: |
---|
30 | |
---|
31 | @example |
---|
32 | @group |
---|
33 | /whatever/prefix/you/choose/ |
---|
34 | archive/ |
---|
35 | tools/ |
---|
36 | |
---|
37 | @end group |
---|
38 | @end example |
---|
39 | |
---|
40 | @c @ifset use-html |
---|
41 | @c @html |
---|
42 | @c <IMG SRC="sfile12c.jpg" WIDTH=417 HEIGHT=178 |
---|
43 | @c ALT="Starting Directory Organization"> |
---|
44 | @c @end html |
---|
45 | @c @end ifset |
---|
46 | |
---|
47 | @section Get All the Pieces |
---|
48 | |
---|
49 | This section lists the components of an RTEMS cross development system. |
---|
50 | Included are the locations of each component as well as any required RTEMS |
---|
51 | specific patches. |
---|
52 | |
---|
53 | @subheading @value{GCC-VERSION} |
---|
54 | @example |
---|
55 | FTP Site: @value{GCC-FTPSITE} |
---|
56 | Directory: @value{GCC-FTPDIR} |
---|
57 | File: @value{GCC-TAR} |
---|
58 | @ifset use-html |
---|
59 | URL: @href{Download @value{GCC-VERSION},,,ftp://@value{GCC-FTPSITE}@value{GCC-FTPDIR}/@value{GCC-TAR}} |
---|
60 | @end ifset |
---|
61 | @end example |
---|
62 | |
---|
63 | @subheading @value{GNAT-VERSION} |
---|
64 | @example |
---|
65 | FTP Site: @value{GNAT-FTPSITE} |
---|
66 | Directory: @value{GNAT-FTPDIR} |
---|
67 | File: @value{GNAT-TAR} |
---|
68 | @ifset use-html |
---|
69 | URL: @href{Download @value{GNAT-VERSION},,,ftp://@value{GNAT-FTPSITE}@value{GNAT-FTPDIR}/@value{GNAT-TAR}} |
---|
70 | @end ifset |
---|
71 | @end example |
---|
72 | |
---|
73 | @subheading @value{BINUTILS-VERSION} |
---|
74 | @example |
---|
75 | FTP Site: @value{BINUTILS-FTPSITE} |
---|
76 | Directory: @value{BINUTILS-FTPDIR} |
---|
77 | File: @value{BINUTILS-TAR} |
---|
78 | @ifset use-html |
---|
79 | URL: @href{Download @value{BINUTILS-VERSION},,,ftp://@value{BINUTILS-FTPSITE}@value{BINUTILS-FTPDIR}/@value{BINUTILS-TAR}} |
---|
80 | @end ifset |
---|
81 | @end example |
---|
82 | |
---|
83 | @subheading @value{NEWLIB-VERSION} |
---|
84 | @example |
---|
85 | FTP Site: @value{NEWLIB-FTPSITE} |
---|
86 | Directory: @value{NEWLIB-FTPDIR} |
---|
87 | File: @value{NEWLIB-TAR} |
---|
88 | @ifset use-html |
---|
89 | URL: @href{Download @value{NEWLIB-VERSION},,,ftp://@value{NEWLIB-FTPSITE}@value{NEWLIB-FTPDIR}/@value{NEWLIB-TAR}} |
---|
90 | @end ifset |
---|
91 | @end example |
---|
92 | |
---|
93 | @subheading @value{RTEMS-VERSION} |
---|
94 | @example |
---|
95 | FTP Site: @value{RTEMS-FTPSITE} |
---|
96 | Directory: @value{RTEMS-FTPDIR} |
---|
97 | File: @value{RTEMS-TAR} |
---|
98 | @ifset use-html |
---|
99 | URL: @href{Download RTEMS components,,,ftp://@value{RTEMS-FTPSITE}@value{RTEMS-FTPDIR}} |
---|
100 | @end ifset |
---|
101 | @end example |
---|
102 | |
---|
103 | @subheading RTEMS Hello World |
---|
104 | @example |
---|
105 | FTP Site: @value{RTEMS-FTPSITE} |
---|
106 | Directory: @value{RTEMS-FTPDIR} |
---|
107 | File: hello_world_ada.tgz |
---|
108 | @ifset use-html |
---|
109 | URL: @href{Download RTEMS Hello World,,,ftp://@value{RTEMS-FTPSITE}@value{RTEMS-FTPDIR}/ada_tools/hello_world_ada.tgz} |
---|
110 | @end ifset |
---|
111 | @end example |
---|
112 | |
---|
113 | @subheading RTEMS Specific Tool Patches and Scripts |
---|
114 | @example |
---|
115 | FTP Site: @value{RTEMS-FTPSITE} |
---|
116 | Directory: @value{RTEMS-FTPDIR}/ada_tools |
---|
117 | File: bit_ada |
---|
118 | @ifset BINUTILS-RTEMSPATCH |
---|
119 | File: @value{BINUTILS-RTEMSPATCH} |
---|
120 | @end ifset |
---|
121 | @ifset NEWLIB-RTEMSPATCH |
---|
122 | File: @value{NEWLIB-RTEMSPATCH} |
---|
123 | @end ifset |
---|
124 | @ifset GCC-RTEMSPATCH |
---|
125 | File: @value{GCC-RTEMSPATCH} |
---|
126 | @end ifset |
---|
127 | @ifset GNAT-RTEMSPATCH |
---|
128 | File: @value{GNAT-RTEMSPATCH} |
---|
129 | @end ifset |
---|
130 | @ifset use-html |
---|
131 | URL: @href{Download RTEMS patches,,,ftp://@value{RTEMS-FTPSITE}@value{RTEMS-FTPDIR}/ada_tools} |
---|
132 | @end ifset |
---|
133 | @end example |
---|
134 | |
---|
135 | @section Unarchiving the Tools |
---|
136 | |
---|
137 | While in the @code{tools} directory, unpack the compressed |
---|
138 | tar files using the following command sequence: |
---|
139 | |
---|
140 | @example |
---|
141 | cd tools |
---|
142 | tar xzf ../archive/@value{GCC-TAR} |
---|
143 | tar xzf ../archive/@value{GNAT-TAR} |
---|
144 | tar xzf ../archive/@value{BINUTILS-TAR} |
---|
145 | tar xzf ../archive/@value{NEWLIB-TAR} |
---|
146 | @end example |
---|
147 | |
---|
148 | After the compressed tar files have been unpacked, the following |
---|
149 | directories will have been created under tools. |
---|
150 | |
---|
151 | @itemize @bullet |
---|
152 | @item @value{BINUTILS-UNTAR} |
---|
153 | @item @value{GCC-UNTAR} |
---|
154 | @item @value{GNAT-UNTAR} |
---|
155 | @item @value{NEWLIB-UNTAR} |
---|
156 | @end itemize |
---|
157 | |
---|
158 | Copy the @code{bit_ada} script from the @code{archive} directory |
---|
159 | to the @code{tools} directory as shown below: |
---|
160 | |
---|
161 | @example |
---|
162 | cp ../archive/bit_ada . |
---|
163 | @end example |
---|
164 | |
---|
165 | When the @code{bit_ada} script is executed later in this process, |
---|
166 | it will automatically create two other subdirectories: |
---|
167 | |
---|
168 | @itemize @bullet |
---|
169 | @item src |
---|
170 | @item build-$@{CPU@}-tools |
---|
171 | @end itemize |
---|
172 | |
---|
173 | The directory tree should look something like the following figure: |
---|
174 | |
---|
175 | @example |
---|
176 | @group |
---|
177 | /whatever/prefix/you/choose/ |
---|
178 | bit |
---|
179 | archive/ |
---|
180 | @value{GCC-TAR} |
---|
181 | @value{GNAT-TAR} |
---|
182 | @value{BINUTILS-TAR} |
---|
183 | @value{NEWLIB-TAR} |
---|
184 | @value{RTEMS-TAR} |
---|
185 | @ifset GCC-RTEMSPATCH |
---|
186 | @value{GCC-RTEMSPATCH} |
---|
187 | @end ifset |
---|
188 | @ifset BINUTILS-RTEMSPATCH |
---|
189 | @value{BINUTILS-RTEMSPATCH} |
---|
190 | @end ifset |
---|
191 | @ifset NEWLIB-RTEMSPATCH |
---|
192 | @value{NEWLIB-RTEMSPATCH} |
---|
193 | @end ifset |
---|
194 | @ifset GNAT-RTEMSPATCH |
---|
195 | @value{GNAT-RTEMSPATCH} |
---|
196 | @end ifset |
---|
197 | hello_world_c.tgz |
---|
198 | bit |
---|
199 | tools/ |
---|
200 | @value{BINUTILS-UNTAR}/ |
---|
201 | @value{GCC-UNTAR}/ |
---|
202 | @value{GNAT-UNTAR}/ |
---|
203 | @value{NEWLIB-UNTAR}/ |
---|
204 | @value{RTEMS-UNTAR}/ |
---|
205 | bit |
---|
206 | |
---|
207 | @end group |
---|
208 | @end example |
---|
209 | |
---|
210 | @c @ifset use-html |
---|
211 | @c @html |
---|
212 | @c <IMG SRC="bit_ada.jpg" WIDTH=816 HEIGHT=267 ALT="Directory Organization"> |
---|
213 | @c @end html |
---|
214 | @c @end ifset |
---|
215 | |
---|
216 | @c |
---|
217 | @c Reading the Documentation |
---|
218 | @c |
---|
219 | |
---|
220 | @section Reading the Tools Documentation |
---|
221 | |
---|
222 | Each of the tools in the GNU development suite comes with documentation. |
---|
223 | It is in the reader's and tool maintainers' interest that one read the |
---|
224 | documentation before posting a problem to a mailing list or news group. |
---|
225 | |
---|
226 | |
---|
227 | @c |
---|
228 | @c GCC patches |
---|
229 | @c |
---|
230 | |
---|
231 | @section Apply RTEMS Patch to GCC |
---|
232 | |
---|
233 | @ifclear GCC-RTEMSPATCH |
---|
234 | No RTEMS specific patches are required for @value{GCC-VERSION} to |
---|
235 | support @value{RTEMS-VERSION}. |
---|
236 | @end ifclear |
---|
237 | |
---|
238 | @ifset GCC-RTEMSPATCH |
---|
239 | |
---|
240 | Apply the patch using the following command sequence: |
---|
241 | |
---|
242 | @example |
---|
243 | cd tools/@value{GCC-UNTAR} |
---|
244 | zcat archive/@value{GCC-RTEMSPATCH} | patch -p1 |
---|
245 | @end example |
---|
246 | |
---|
247 | Check to see if any of these patches have been rejected using the following |
---|
248 | sequence: |
---|
249 | |
---|
250 | @example |
---|
251 | cd tools/@value{GCC-UNTAR} |
---|
252 | find . -name "*.rej" -print |
---|
253 | @end example |
---|
254 | |
---|
255 | If any files are found with the .rej extension, a patch has been rejected. |
---|
256 | This should not happen with a good patch file. |
---|
257 | |
---|
258 | @end ifset |
---|
259 | |
---|
260 | @c |
---|
261 | @c BINUTILS patches |
---|
262 | @c |
---|
263 | |
---|
264 | @section Apply RTEMS Patch to binutils |
---|
265 | |
---|
266 | @ifclear BINUTILS-RTEMSPATCH |
---|
267 | No RTEMS specific patches are required for @value{BINUTILS-VERSION} to |
---|
268 | support @value{RTEMS-VERSION}. |
---|
269 | @end ifclear |
---|
270 | |
---|
271 | @ifset BINUTILS-RTEMSPATCH |
---|
272 | Apply the patch using the following command sequence: |
---|
273 | |
---|
274 | @example |
---|
275 | cd tools/@value{BINUTILS-UNTAR} |
---|
276 | zcat archive/@value{BINUTILS-RTEMSPATCH} | patch -p1 |
---|
277 | @end example |
---|
278 | |
---|
279 | Check to see if any of these patches have been rejected using the following |
---|
280 | sequence: |
---|
281 | |
---|
282 | @example |
---|
283 | cd tools/@value{BINUTILS-UNTAR} |
---|
284 | find . -name "*.rej" -print |
---|
285 | @end example |
---|
286 | |
---|
287 | If any files are found with the .rej extension, a patch has been rejected. |
---|
288 | This should not happen with a good patch file. |
---|
289 | |
---|
290 | @end ifset |
---|
291 | |
---|
292 | @c |
---|
293 | @c Newlib patches |
---|
294 | @c |
---|
295 | |
---|
296 | @section Apply RTEMS Patch to newlib |
---|
297 | |
---|
298 | @ifclear NEWLIB-RTEMSPATCH |
---|
299 | No RTEMS specific patches are required for @value{NEWLIB-VERSION} to |
---|
300 | support @value{RTEMS-VERSION}. |
---|
301 | @end ifclear |
---|
302 | |
---|
303 | @ifset NEWLIB-RTEMSPATCH |
---|
304 | |
---|
305 | Apply the patch using the following command sequence: |
---|
306 | |
---|
307 | @example |
---|
308 | cd tools/@value{NEWLIB-UNTAR} |
---|
309 | zcat archive/@value{NEWLIB-RTEMSPATCH} | patch -p1 |
---|
310 | @end example |
---|
311 | |
---|
312 | Check to see if any of these patches have been rejected using the following |
---|
313 | sequence: |
---|
314 | |
---|
315 | @example |
---|
316 | cd tools/@value{NEWLIB-UNTAR} |
---|
317 | find . -name "*.rej" -print |
---|
318 | @end example |
---|
319 | |
---|
320 | If any files are found with the .rej extension, a patch has been rejected. |
---|
321 | This should not happen with a good patch file. |
---|
322 | |
---|
323 | @end ifset |
---|
324 | |
---|
325 | @c |
---|
326 | @c GNAT patches |
---|
327 | @c |
---|
328 | |
---|
329 | @section Apply RTEMS Patch to GNAT |
---|
330 | |
---|
331 | @ifclear GNAT-RTEMSPATCH |
---|
332 | No RTEMS specific patches are required for @value{GNAT-VERSION} to |
---|
333 | support @value{RTEMS-VERSION}. |
---|
334 | @end ifclear |
---|
335 | |
---|
336 | @ifset GNAT-RTEMSPATCH |
---|
337 | |
---|
338 | Apply the patch using the following command sequence: |
---|
339 | |
---|
340 | @example |
---|
341 | cd tools/@value{GNAT-UNTAR} |
---|
342 | zcat archive/@value{GNAT-RTEMSPATCH} | patch -p1 |
---|
343 | @end example |
---|
344 | |
---|
345 | Check to see if any of these patches have been rejected using the following |
---|
346 | sequence: |
---|
347 | |
---|
348 | @example |
---|
349 | cd tools/@value{GNAT-UNTAR} |
---|
350 | find . -name "*.rej" -print |
---|
351 | @end example |
---|
352 | |
---|
353 | If any files are found with the .rej extension, a patch has been rejected. |
---|
354 | This should not happen with a good patch file. |
---|
355 | |
---|
356 | @end ifset |
---|
357 | |
---|
358 | @c |
---|
359 | @c Copy the ada directory |
---|
360 | @c |
---|
361 | |
---|
362 | |
---|
363 | @section Copy the ada Subdirectory to the GCC Source Tree |
---|
364 | |
---|
365 | Copy the ada subtree in the patched subtree of |
---|
366 | tools/@value{GNAT-UNTAR}/src to the |
---|
367 | tools/@value{GCC-UNTAR} directory: |
---|
368 | |
---|
369 | @example |
---|
370 | cd tools/@value{GNAT-UNTAR}/src |
---|
371 | cp -r ada ../../../@value{GCC-UNTAR} |
---|
372 | @end example |
---|
373 | |
---|
374 | @c |
---|
375 | @c Modify the bit_ada script |
---|
376 | @c |
---|
377 | |
---|
378 | @section Modify the bit_ada Script |
---|
379 | |
---|
380 | Copy the @code{bit_ada} script from @code{archive} to the @code{tools} |
---|
381 | directory. |
---|
382 | |
---|
383 | Edit the @code{bit_ada} file to alter the following environmental variables: |
---|
384 | |
---|
385 | @itemize @bullet |
---|
386 | @item INSTALL_POINT |
---|
387 | @item BINUTILS |
---|
388 | @item NEWLIB |
---|
389 | @item GCC |
---|
390 | @item BUILD_DOCS |
---|
391 | @end itemize |
---|
392 | |
---|
393 | These variables are located in the script section that resembles the |
---|
394 | extract below: |
---|
395 | |
---|
396 | |
---|
397 | @example |
---|
398 | # USERCHANGE -- localize these. |
---|
399 | # |
---|
400 | # INSTALL_POINT: Directory tools are installed into. |
---|
401 | # Recommended installation point for various OS's: |
---|
402 | # Linux: /usr/local/rtems |
---|
403 | # Solaris: /opt/gnu/rtems |
---|
404 | # BINUTILS: Binutils source directory |
---|
405 | # NEWLIB: Newlib source directory |
---|
406 | # GCC: Newlib source directory |
---|
407 | # BUILD_DOCS: Set to "yes" if you want to install documentation. |
---|
408 | # |
---|
409 | BINUTILS=@value{BINUTILS-UNTAR} |
---|
410 | GCC=@value{GCC-UNTAR} |
---|
411 | NEWLIB=@value{NEWLIB-UNTAR} |
---|
412 | BUILD_DOCS=yes |
---|
413 | INSTALL_POINT=/home/joel/$@{GCC@}/$@{target@} |
---|
414 | |
---|
415 | # USERCHANGE - uncomment this if you want to watch the commands. |
---|
416 | @end example |
---|
417 | |
---|
418 | Where each of the variables which may be modified is described below: |
---|
419 | |
---|
420 | @table @code |
---|
421 | @item INSTALL_POINT |
---|
422 | is the location where you wish the GNU C/C++ cross compilation tools for |
---|
423 | RTEMS to be built. It is recommended that the directory chosen to receive |
---|
424 | these tools be named so that it is clear from which egcs distribution it |
---|
425 | was generated and for which target system the tools are to produce code for. |
---|
426 | |
---|
427 | @item BINUTILS |
---|
428 | is the directory under tools that contains @value{BINUTILS-UNTAR}. |
---|
429 | For example: |
---|
430 | |
---|
431 | @example |
---|
432 | BINUTILS=@value{BINUTILS-UNTAR} |
---|
433 | @end example |
---|
434 | |
---|
435 | @item GCC |
---|
436 | is the directory under tools that contains @value{GCC-UNTAR}. |
---|
437 | For example: |
---|
438 | |
---|
439 | @example |
---|
440 | GCC=@value{GCC-UNTAR} |
---|
441 | @end example |
---|
442 | |
---|
443 | @item NEWLIB |
---|
444 | is the directory under tools that contains @value{NEWLIB-UNTAR}. |
---|
445 | For example: |
---|
446 | |
---|
447 | @example |
---|
448 | NEWLIB=@value{NEWLIB-UNTAR} |
---|
449 | @end example |
---|
450 | |
---|
451 | @item BUILD_DOCS |
---|
452 | is set to "yes" if you want to install documentation. |
---|
453 | For example: |
---|
454 | |
---|
455 | @example |
---|
456 | BUILD_DOCS=yes |
---|
457 | @end example |
---|
458 | |
---|
459 | @end table |
---|
460 | |
---|
461 | @section Running the bit_ada Script |
---|
462 | |
---|
463 | After the @code{bit_ada} script has been modified to reflect the |
---|
464 | local installation, the modified @code{bit_ada} script is run |
---|
465 | using the following sequence: |
---|
466 | |
---|
467 | @example |
---|
468 | cd tools |
---|
469 | ./bit_ada <target configuration> |
---|
470 | @end example |
---|
471 | |
---|
472 | Where <target configuration> is one of the following: |
---|
473 | |
---|
474 | @itemize @bullet |
---|
475 | @item hppa1.1 |
---|
476 | @item i386 |
---|
477 | @item i386-elf |
---|
478 | @item i386-go32 |
---|
479 | @item i960 |
---|
480 | @item m68k |
---|
481 | @item mips64orion |
---|
482 | @item powerpc |
---|
483 | @item sh |
---|
484 | @item sparc |
---|
485 | @end itemize |
---|
486 | |
---|
487 | NOTE: The above list of target configurations is the list of RTEMS supported |
---|
488 | targets. Only a subset of these have been tested with GNAT/RTEMS. For more |
---|
489 | information, contact your GNAT/RTEMS representative. |
---|
490 | |
---|
491 | If no errors are encountered, the @code{bit_ada} script will conclude by |
---|
492 | printing messages similar to the following: |
---|
493 | |
---|
494 | @example |
---|
495 | |
---|
496 | The src and build-i386-tools subdirectory may now be removed. |
---|
497 | |
---|
498 | Started: Fri Apr 10 10:14:07 CDT 1998 |
---|
499 | Finished: Fri Apr 10 12:01:33 CDT 1998 |
---|
500 | @end example |
---|
501 | |
---|
502 | If the @code{bit_ada} script successfully completes, then the |
---|
503 | GNU C/C++ cross compilation tools are installed. |
---|
504 | |
---|
505 | If the @code{bit_ada} script does not successfully complete, then investigation |
---|
506 | will be required to determine the source of the error. |
---|
507 | |
---|