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