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