[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 | |
---|
| 118 | @section Unarchiving the Sources |
---|
[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 | |
---|
[4aa6b64] | 141 | Graphically, this will look something like the following figure: |
---|
| 142 | |
---|
| 143 | @ifset use-ascii |
---|
| 144 | @example |
---|
| 145 | @group |
---|
| 146 | Not currently available in ASCII. |
---|
| 147 | @end group |
---|
| 148 | @end example |
---|
| 149 | @end ifset |
---|
| 150 | |
---|
| 151 | |
---|
| 152 | @ifset use-tex |
---|
| 153 | @c for now use the ascii version |
---|
| 154 | @example |
---|
| 155 | @group |
---|
| 156 | Not currently available in printed document. |
---|
| 157 | @end group |
---|
| 158 | @end example |
---|
| 159 | @tex |
---|
| 160 | @end tex |
---|
| 161 | @end ifset |
---|
| 162 | |
---|
| 163 | @ifset use-html |
---|
| 164 | @html |
---|
| 165 | <IMG SRC="bit_ada.jpg" WIDTH=816 HEIGHT=267 ALT="Directory Organization"> |
---|
| 166 | @end html |
---|
| 167 | @end ifset |
---|
| 168 | |
---|
| 169 | |
---|
[8e8676da] | 170 | @c |
---|
[6d3d425d] | 171 | @c GCC patches |
---|
[8e8676da] | 172 | @c |
---|
| 173 | |
---|
[6d3d425d] | 174 | @section Apply RTEMS Patch to GCC |
---|
[8e8676da] | 175 | |
---|
| 176 | @ifclear GCC-RTEMSPATCH |
---|
| 177 | No RTEMS specific patches are required for @value{GCC-VERSION} to |
---|
| 178 | support @value{RTEMS-VERSION}. |
---|
| 179 | @end ifclear |
---|
| 180 | |
---|
| 181 | @ifset GCC-RTEMSPATCH |
---|
| 182 | |
---|
| 183 | Apply the patch using the following command sequence: |
---|
| 184 | |
---|
| 185 | @example |
---|
| 186 | cd tools/@value{GCC-UNTAR} |
---|
| 187 | zcat arc/@value{GCC-RTEMSPATCH} | patch -p1 |
---|
| 188 | @end example |
---|
| 189 | |
---|
| 190 | Check to see if any of these patches have been rejected using the following |
---|
| 191 | sequence: |
---|
| 192 | |
---|
| 193 | @example |
---|
| 194 | cd tools/@value{GCC-UNTAR} |
---|
| 195 | find . -name "*.rej" -print |
---|
| 196 | @end example |
---|
| 197 | |
---|
| 198 | If any files are found with the .rej extension, a patch has been rejected. |
---|
| 199 | This should not happen with a good patch file. |
---|
| 200 | |
---|
| 201 | To see the files that have been modified use the sequence: |
---|
| 202 | |
---|
| 203 | @example |
---|
| 204 | cd tools/@value{GCC-UNTAR} |
---|
| 205 | find . -name "*.orig" -print |
---|
| 206 | @end example |
---|
| 207 | |
---|
| 208 | The files that are found, have been modified by the patch file. |
---|
| 209 | |
---|
| 210 | @end ifset |
---|
| 211 | |
---|
| 212 | @c |
---|
| 213 | @c BINUTILS patches |
---|
| 214 | @c |
---|
| 215 | |
---|
| 216 | @section Apply RTEMS Patch to binutils |
---|
| 217 | |
---|
| 218 | @ifclear BINUTILS-RTEMSPATCH |
---|
| 219 | No RTEMS specific patches are required for @value{BINUTILS-VERSION} to |
---|
| 220 | support @value{RTEMS-VERSION}. |
---|
| 221 | @end ifclear |
---|
| 222 | |
---|
| 223 | @ifset BINUTILS-RTEMSPATCH |
---|
| 224 | Apply the patch using the following command sequence: |
---|
| 225 | |
---|
| 226 | @example |
---|
| 227 | cd tools/@value{BINUTILS-UNTAR} |
---|
| 228 | zcat arc/@value{BINUTILS-RTEMSPATCH} | patch -p1 |
---|
| 229 | @end example |
---|
| 230 | |
---|
| 231 | Check to see if any of these patches have been rejected using the following |
---|
| 232 | sequence: |
---|
| 233 | |
---|
| 234 | @example |
---|
| 235 | cd tools/@value{BINUTILS-UNTAR} |
---|
| 236 | find . -name "*.rej" -print |
---|
| 237 | @end example |
---|
| 238 | |
---|
| 239 | If any files are found with the .rej extension, a patch has been rejected. |
---|
| 240 | This should not happen with a good patch file. |
---|
| 241 | |
---|
| 242 | To see the files that have been modified use the sequence: |
---|
| 243 | |
---|
| 244 | @example |
---|
| 245 | cd tools/@value{BINUTILS-UNTAR} |
---|
| 246 | find . -name "*.orig" -print |
---|
| 247 | @end example |
---|
| 248 | |
---|
| 249 | The files that are found, have been modified by the patch file. |
---|
| 250 | |
---|
| 251 | @end ifset |
---|
| 252 | |
---|
| 253 | @c |
---|
| 254 | @c Newlib patches |
---|
| 255 | @c |
---|
| 256 | |
---|
| 257 | @section Apply RTEMS Patch to newlib |
---|
| 258 | |
---|
| 259 | @ifclear NEWLIB-RTEMSPATCH |
---|
| 260 | No RTEMS specific patches are required for @value{NEWLIB-VERSION} to |
---|
| 261 | support @value{RTEMS-VERSION}. |
---|
| 262 | @end ifclear |
---|
| 263 | |
---|
| 264 | @ifset NEWLIB-RTEMSPATCH |
---|
| 265 | |
---|
| 266 | Apply the patch using the following command sequence: |
---|
| 267 | |
---|
| 268 | @example |
---|
| 269 | cd tools/@value{NEWLIB-UNTAR} |
---|
| 270 | zcat arc/@value{NEWLIB-RTEMSPATCH} | patch -p1 |
---|
| 271 | @end example |
---|
| 272 | |
---|
| 273 | Check to see if any of these patches have been rejected using the following |
---|
| 274 | sequence: |
---|
| 275 | |
---|
| 276 | @example |
---|
| 277 | cd tools/@value{NEWLIB-UNTAR} |
---|
| 278 | find . -name "*.rej" -print |
---|
| 279 | @end example |
---|
| 280 | |
---|
| 281 | If any files are found with the .rej extension, a patch has been rejected. |
---|
| 282 | This should not happen with a good patch file. |
---|
| 283 | |
---|
| 284 | To see the files that have been modified use the sequence: |
---|
| 285 | |
---|
| 286 | @example |
---|
| 287 | cd tools/@value{NEWLIB-UNTAR} |
---|
| 288 | find . -name "*.orig" -print |
---|
| 289 | @end example |
---|
| 290 | |
---|
| 291 | The files that are found, have been modified by the patch file. |
---|
| 292 | |
---|
| 293 | @end ifset |
---|
| 294 | |
---|
[6d3d425d] | 295 | @c |
---|
| 296 | @c GNAT patches |
---|
[8e8676da] | 297 | @c |
---|
[6d3d425d] | 298 | |
---|
| 299 | @section Apply RTEMS Patch to GNAT |
---|
| 300 | |
---|
| 301 | @ifclear GNAT-RTEMSPATCH |
---|
| 302 | No RTEMS specific patches are required for @value{GNAT-VERSION} to |
---|
| 303 | support @value{RTEMS-VERSION}. |
---|
| 304 | @end ifclear |
---|
| 305 | |
---|
| 306 | @ifset GNAT-RTEMSPATCH |
---|
| 307 | |
---|
| 308 | Apply the patch using the following command sequence: |
---|
| 309 | |
---|
| 310 | @example |
---|
| 311 | cd tools/@value{GNAT-UNTAR} |
---|
| 312 | zcat arc/@value{GNAT-RTEMSPATCH} | patch -p1 |
---|
| 313 | @end example |
---|
| 314 | |
---|
| 315 | Check to see if any of these patches have been rejected using the following |
---|
| 316 | sequence: |
---|
| 317 | |
---|
| 318 | @example |
---|
| 319 | cd tools/@value{GNAT-UNTAR} |
---|
| 320 | find . -name "*.rej" -print |
---|
| 321 | @end example |
---|
| 322 | |
---|
| 323 | If any files are found with the .rej extension, a patch has been rejected. |
---|
| 324 | This should not happen with a good patch file. |
---|
| 325 | |
---|
| 326 | To see the files that have been modified use the sequence: |
---|
| 327 | |
---|
| 328 | @example |
---|
| 329 | cd tools/@value{GNAT-UNTAR} |
---|
| 330 | find . -name "*.orig" -print |
---|
| 331 | @end example |
---|
| 332 | |
---|
| 333 | The files that are found, have been modified by the patch file. |
---|
| 334 | |
---|
| 335 | @end ifset |
---|
| 336 | |
---|
| 337 | @c |
---|
| 338 | @c Copy the ada directory |
---|
| 339 | @c |
---|
| 340 | |
---|
| 341 | |
---|
| 342 | @section Copy the ada Subdirectory to the GCC Source Tree |
---|
| 343 | |
---|
| 344 | Copy the ada subtree in the patched subtree of |
---|
| 345 | tools/@value{GNAT-UNTAR}/src to the |
---|
| 346 | tools/@value{GCC-UNTAR} directory: |
---|
| 347 | |
---|
| 348 | @example |
---|
| 349 | cd tools/@value{GNAT-UNTAR}/src |
---|
| 350 | cp -r ada ../../../@value{GCC-UNTAR} |
---|
| 351 | @end example |
---|
| 352 | |
---|
| 353 | @c |
---|
| 354 | @c Modify the bit_ada script |
---|
[8e8676da] | 355 | @c |
---|
| 356 | |
---|
[6d3d425d] | 357 | @section Modify the bit_ada Script |
---|
[8e8676da] | 358 | |
---|
[6d3d425d] | 359 | Copy the @code{bit_ada} script from arc to the tools directory. |
---|
[8e8676da] | 360 | |
---|
[6d3d425d] | 361 | Edit the @code{bit_ada} file to alter the following environmental variables: |
---|
[8e8676da] | 362 | |
---|
| 363 | @itemize @bullet |
---|
| 364 | @item INSTALL_POINT |
---|
| 365 | @item BINUTILS |
---|
| 366 | @item NEWLIB |
---|
| 367 | @item GCC |
---|
| 368 | @item BUILD_DOCS |
---|
| 369 | @end itemize |
---|
| 370 | |
---|
| 371 | These variables are located in the script section that resembles the |
---|
| 372 | extract below: |
---|
| 373 | |
---|
| 374 | |
---|
| 375 | @example |
---|
| 376 | # USERCHANGE -- localize these. |
---|
| 377 | # |
---|
| 378 | # INSTALL_POINT: Directory tools are installed into. |
---|
| 379 | # Recommended installation point for various OS's: |
---|
| 380 | # Linux: /usr/local/rtems |
---|
| 381 | # Solaris: /opt/gnu/rtems |
---|
| 382 | # BINUTILS: Binutils source directory |
---|
| 383 | # NEWLIB: Newlib source directory |
---|
| 384 | # GCC: Newlib source directory |
---|
| 385 | # BUILD_DOCS: Set to "yes" if you want to install documentation. |
---|
| 386 | # |
---|
| 387 | BINUTILS=@value{BINUTILS-UNTAR} |
---|
| 388 | GCC=@value{GCC-UNTAR} |
---|
| 389 | NEWLIB=@value{NEWLIB-UNTAR} |
---|
| 390 | BUILD_DOCS=yes |
---|
| 391 | INSTALL_POINT=/home/joel/$@{GCC@}/$@{target@} |
---|
| 392 | |
---|
| 393 | # USERCHANGE - uncomment this if you want to watch the commands. |
---|
| 394 | @end example |
---|
| 395 | |
---|
| 396 | Where each of the variables which may be modified is described below: |
---|
| 397 | |
---|
| 398 | @table @code |
---|
| 399 | @item INSTALL_POINT |
---|
| 400 | is the location where you wish the GNU C/C++ cross compilation tools for |
---|
| 401 | RTEMS to be built. It is recommended that the directory chosen to receive |
---|
| 402 | these tools be named so that it is clear from which egcs distribution it |
---|
| 403 | was generated and for which target system the tools are to produce code for. |
---|
| 404 | |
---|
| 405 | @item BINUTILS |
---|
| 406 | is the directory under tools that contains @value{BINUTILS-UNTAR}. |
---|
[fdd6a26] | 407 | For example: |
---|
[8e8676da] | 408 | |
---|
| 409 | @example |
---|
[fdd6a26] | 410 | BINUTILS=@value{BINUTILS-UNTAR} |
---|
[8e8676da] | 411 | @end example |
---|
| 412 | |
---|
| 413 | @item GCC |
---|
| 414 | is the directory under tools that contains @value{GCC-UNTAR}. |
---|
[fdd6a26] | 415 | For example: |
---|
[8e8676da] | 416 | |
---|
| 417 | @example |
---|
[fdd6a26] | 418 | GCC=@value{GCC-UNTAR} |
---|
[8e8676da] | 419 | @end example |
---|
| 420 | |
---|
| 421 | @item NEWLIB |
---|
| 422 | is the directory under tools that contains @value{NEWLIB-UNTAR}. |
---|
[fdd6a26] | 423 | For example: |
---|
[8e8676da] | 424 | |
---|
| 425 | @example |
---|
[fdd6a26] | 426 | NEWLIB=@value{NEWLIB-UNTAR} |
---|
[8e8676da] | 427 | @end example |
---|
| 428 | |
---|
| 429 | @item BUILD_DOCS |
---|
| 430 | is set to "yes" if you want to install documentation. |
---|
[fdd6a26] | 431 | For example: |
---|
[8e8676da] | 432 | |
---|
| 433 | @example |
---|
| 434 | BUILD_DOCS=yes |
---|
| 435 | @end example |
---|
| 436 | |
---|
| 437 | @end table |
---|
| 438 | |
---|
[6d3d425d] | 439 | @section Running the bit_ada Script |
---|
[8e8676da] | 440 | |
---|
[6d3d425d] | 441 | After the @code{bit_ada} script has been modified to reflect the |
---|
| 442 | local installation, the modified @code{bit_ada} script is run |
---|
[8e8676da] | 443 | using the following sequence: |
---|
| 444 | |
---|
| 445 | @example |
---|
| 446 | cd tools |
---|
[6d3d425d] | 447 | ./bit_ada <target configuration> |
---|
[8e8676da] | 448 | @end example |
---|
| 449 | |
---|
| 450 | Where <target configuration> is one of the following: |
---|
| 451 | |
---|
| 452 | @itemize @bullet |
---|
| 453 | @item hppa1.1 |
---|
| 454 | @item i386 |
---|
| 455 | @item i386-elf |
---|
| 456 | @item i386-go32 |
---|
| 457 | @item i960 |
---|
| 458 | @item m68k |
---|
| 459 | @item mips64orion |
---|
| 460 | @item powerpc |
---|
| 461 | @item sh |
---|
| 462 | @item sparc |
---|
| 463 | @end itemize |
---|
| 464 | |
---|
[6d3d425d] | 465 | NOTE: The above list of target configurations is the list of RTEMS supported |
---|
| 466 | targets. Only a subset of these have been tested with GNAT/RTEMS. For more |
---|
| 467 | information, contact your GNAT/RTEMS representative. |
---|
| 468 | |
---|
| 469 | If no errors are encountered, the @code{bit_ada} script will conclude by |
---|
[8e8676da] | 470 | printing messages similar to the following: |
---|
| 471 | |
---|
| 472 | @example |
---|
| 473 | |
---|
| 474 | The src and build-i386-tools subdirectory may now be removed. |
---|
| 475 | |
---|
| 476 | Started: Fri Apr 10 10:14:07 CDT 1998 |
---|
| 477 | Finished: Fri Apr 10 12:01:33 CDT 1998 |
---|
| 478 | @end example |
---|
| 479 | |
---|
[6d3d425d] | 480 | If the @code{bit_ada} script successfully completes, then the |
---|
[8e8676da] | 481 | GNU C/C++ cross compilation tools are installed. |
---|
| 482 | |
---|
[6d3d425d] | 483 | If the @code{bit_ada} script does not successfully complete, then investigation |
---|
[8e8676da] | 484 | will be required to determine the source of the error. |
---|
| 485 | |
---|