[417fcc73] | 1 | @c |
---|
[6449498] | 2 | @c COPYRIGHT (c) 1988-2002. |
---|
[417fcc73] | 3 | @c On-Line Applications Research Corporation (OAR). |
---|
| 4 | @c All rights reserved. |
---|
| 5 | @c |
---|
| 6 | @c $Id$ |
---|
| 7 | @c |
---|
| 8 | |
---|
[48cd0b8e] | 9 | @chapter Building the GNU Cross Compiler Toolset |
---|
[6113b3a] | 10 | |
---|
[6449498] | 11 | NOTE: This chapter does @b{NOT} apply if you installed |
---|
| 12 | prebuilt toolset executables for BINUTILS, GCC, NEWLIB, |
---|
| 13 | and GDB. If you installed prebuilt executables for all |
---|
| 14 | of those, proceed to @ref{Building RTEMS}. If you require |
---|
| 15 | a GDB with a special configuration to connect to your |
---|
| 16 | target board, then proceed to @ref{Building the GNU Debugger GDB} |
---|
| 17 | for some advice. |
---|
| 18 | |
---|
[bdec2709] | 19 | This chapter describes the steps required to acquire the |
---|
| 20 | source code for a GNU cross compiler toolset, apply |
---|
| 21 | any required RTEMS specific patches, compile that |
---|
| 22 | toolset and install it. |
---|
| 23 | |
---|
[9f9efbc] | 24 | It is recommended that when toolset binaries are available for |
---|
| 25 | your particular host, that they be used. Prebuilt binaries |
---|
| 26 | are much easier to install. |
---|
| 27 | |
---|
[6449498] | 28 | @c |
---|
| 29 | @c Building BINUTILS GCC and NEWLIB |
---|
| 30 | @c |
---|
| 31 | @section Building BINUTILS GCC and NEWLIB |
---|
[57a736ff] | 32 | |
---|
[6449498] | 33 | NOTE: This step is NOT required if prebuilt executables for |
---|
| 34 | BINUTILS, GCC, and NEWLIB were installed. |
---|
[0df2ab87] | 35 | |
---|
[6449498] | 36 | This section describes the process of building BINUTILS, GCC, and |
---|
| 37 | NEWLIB using a variety of methods. Included is information on |
---|
| 38 | obtaining the source code and patches, applying patches, and |
---|
| 39 | building and installing the tools using multiple methods. |
---|
[0df2ab87] | 40 | |
---|
[6449498] | 41 | @c |
---|
| 42 | @c Obtain Source and Patches for BINUTILS GCC and NEWLIB |
---|
| 43 | @c |
---|
[0df2ab87] | 44 | |
---|
[6449498] | 45 | @subsection Obtain Source and Patches for BINUTILS GCC and NEWLIB |
---|
[79bb9221] | 46 | |
---|
[6449498] | 47 | NOTE: This step is required for all methods of building BINUTILS, |
---|
| 48 | GCC, and NEWLIB. |
---|
[fffe9266] | 49 | |
---|
[6449498] | 50 | This section lists the components required to build BINUTILS, GCC, |
---|
| 51 | and NEWLIB from source to target RTEMS. These files should be |
---|
| 52 | placed in your @code{archive} directory. Included are the locations |
---|
| 53 | of each component as well as any required RTEMS specific patches. |
---|
[fffe9266] | 54 | |
---|
[6449498] | 55 | @need 1000 |
---|
[bf31efd] | 56 | @subheading @value{GCCUNTAR} |
---|
[fffe9266] | 57 | @example |
---|
[6e8d424] | 58 | FTP Site: @value{GCCFTPSITE} |
---|
| 59 | Directory: @value{GCCFTPDIR} |
---|
| 60 | File: @value{GCCTAR} |
---|
[bf31efd] | 61 | @c @ifset use-html |
---|
| 62 | URL: @uref{ftp://@value{GCCFTPSITE}@value{GCCFTPDIR}/@value{GCCTAR},,ftp://@value{GCCFTPSITE}@value{GCCFTPDIR}/@value{GCCTAR}} |
---|
| 63 | @c URL: ftp://@value{GCCFTPSITE}@value{GCCFTPDIR} |
---|
| 64 | @c @end ifset |
---|
[fffe9266] | 65 | @end example |
---|
| 66 | |
---|
[6449498] | 67 | @need 1000 |
---|
[bf31efd] | 68 | @subheading @value{BINUTILSUNTAR} |
---|
[fffe9266] | 69 | @example |
---|
[6e8d424] | 70 | FTP Site: @value{BINUTILSFTPSITE} |
---|
| 71 | Directory: @value{BINUTILSFTPDIR} |
---|
| 72 | File: @value{BINUTILSTAR} |
---|
[bf31efd] | 73 | @c @ifset use-html |
---|
| 74 | URL: @uref{ftp://@value{BINUTILSFTPSITE}@value{BINUTILSFTPDIR}/@value{BINUTILSTAR},,ftp://@value{BINUTILSFTPSITE}@value{BINUTILSFTPDIR}/@value{BINUTILSTAR}} |
---|
| 75 | @c URL: ftp://@value{BINUTILSFTPSITE}@value{BINUTILSFTPDIR}/@value{BINUTILSTAR} |
---|
| 76 | @c @end ifset |
---|
[fffe9266] | 77 | @end example |
---|
| 78 | |
---|
[6449498] | 79 | @need 1000 |
---|
[bf31efd] | 80 | @subheading @value{NEWLIBUNTAR} |
---|
[fffe9266] | 81 | @example |
---|
[6e8d424] | 82 | FTP Site: @value{NEWLIBFTPSITE} |
---|
| 83 | Directory: @value{NEWLIBFTPDIR} |
---|
| 84 | File: @value{NEWLIBTAR} |
---|
[bf31efd] | 85 | @c @ifset use-html |
---|
| 86 | URL: @uref{ftp://@value{NEWLIBFTPSITE}@value{NEWLIBFTPDIR}/@value{NEWLIBTAR},,ftp://@value{NEWLIBFTPSITE}@value{NEWLIBFTPDIR}/@value{NEWLIBTAR}} |
---|
| 87 | @c URL: ftp://@value{NEWLIBFTPSITE}@value{NEWLIBFTPDIR}/@value{NEWLIBTAR} |
---|
| 88 | @c @end ifset |
---|
[fffe9266] | 89 | @end example |
---|
| 90 | |
---|
[6449498] | 91 | @need 1000 |
---|
[dff0a57c] | 92 | @subheading RTEMS Specific Tool Patches and Scripts |
---|
[fffe9266] | 93 | @example |
---|
[6e8d424] | 94 | FTP Site: @value{RTEMSFTPSITE} |
---|
[39075eb2] | 95 | Directory: @value{RTEMSFTPDIR}/@value{VERSION} |
---|
[bf31efd] | 96 | @ifset BINUTILSPATCHVERSION |
---|
[6e8d424] | 97 | File: @value{BINUTILSRTEMSPATCH} |
---|
[fffe9266] | 98 | @end ifset |
---|
[bf31efd] | 99 | @ifset NEWLIBPATCHVERSION |
---|
[6e8d424] | 100 | File: @value{NEWLIBRTEMSPATCH} |
---|
[fffe9266] | 101 | @end ifset |
---|
[bf31efd] | 102 | @ifset GCCPATCHVERSION |
---|
[6e8d424] | 103 | File: @value{GCCRTEMSPATCH} |
---|
[fffe9266] | 104 | @end ifset |
---|
[dff0a57c] | 105 | @ifset use-html |
---|
[0c69cdd] | 106 | URL: @uref{ftp://@value{RTEMSFTPSITE}@value{RTEMSFTPDIR}/SOURCES,,ftp://@value{RTEMSFTPSITE}@value{RTEMSFTPDIR}/SOURCES} |
---|
| 107 | @c URL: ftp://@value{RTEMSFTPSITE}@value{RTEMSFTPDIR}/SOURCES |
---|
[dff0a57c] | 108 | @end ifset |
---|
[fffe9266] | 109 | @end example |
---|
| 110 | |
---|
[6449498] | 111 | @c |
---|
| 112 | @c Unarchiving the Tools |
---|
| 113 | @c |
---|
| 114 | @subsection Unarchiving the Tools |
---|
| 115 | |
---|
| 116 | NOTE: This step is required if building BINUTILS, GCC, and NEWLIB |
---|
[4a675a5c] | 117 | using the procedure described in @ref{Using configure and make}. |
---|
| 118 | It is @b{NOT} required if using the procedure |
---|
[6449498] | 119 | described in @ref{Using RPM to Build BINUTILS GCC and NEWLIB}. |
---|
[0df2ab87] | 120 | |
---|
[b2e3795] | 121 | GNU source distributions are archived using @code{tar} and |
---|
| 122 | compressed using either @code{gzip} or @code{bzip}. |
---|
| 123 | If compressed with @code{gzip}, the extension @code{.gz} is used. |
---|
| 124 | If compressed with @code{bzip}, the extension @code{.bz2} is used. |
---|
| 125 | |
---|
[0df2ab87] | 126 | While in the @code{tools} directory, unpack the compressed |
---|
[b2e3795] | 127 | tar files for BINUTILS, GCC, and NEWLIB using the appropriate |
---|
| 128 | command based upon the compression program used. |
---|
[417fcc73] | 129 | |
---|
| 130 | @example |
---|
| 131 | cd tools |
---|
[b2e3795] | 132 | tar xzf ../archive/TOOLNAME.tar.gz # for gzip'ed tools |
---|
[a785e63] | 133 | tar xjf ../archive/TOOLNAME.tar.bz2 # for bzip'ed tools |
---|
[417fcc73] | 134 | @end example |
---|
| 135 | |
---|
[b2e3795] | 136 | After the compressed tar files have been unpacked using |
---|
| 137 | the appropriate commands, the following |
---|
[6113b3a] | 138 | directories will have been created under tools. |
---|
| 139 | |
---|
| 140 | @itemize @bullet |
---|
[6e8d424] | 141 | @item @value{BINUTILSUNTAR} |
---|
| 142 | @item @value{GCCUNTAR} |
---|
| 143 | @item @value{NEWLIBUNTAR} |
---|
[6113b3a] | 144 | @end itemize |
---|
| 145 | |
---|
[ae2e9f2] | 146 | The tree should look something like the following figure: |
---|
[0df2ab87] | 147 | |
---|
| 148 | @example |
---|
| 149 | @group |
---|
[ae2e9f2] | 150 | /whatever/prefix/you/choose/ |
---|
| 151 | archive/ |
---|
[6e8d424] | 152 | @value{GCCTAR} |
---|
| 153 | @value{BINUTILSTAR} |
---|
| 154 | @value{NEWLIBTAR} |
---|
[bf31efd] | 155 | @ifset GCCPATCHVERSION |
---|
[6e8d424] | 156 | @value{GCCRTEMSPATCH} |
---|
[0df2ab87] | 157 | @end ifset |
---|
[bf31efd] | 158 | @ifset BINUTILSPATCHVERSION |
---|
[6e8d424] | 159 | @value{BINUTILSRTEMSPATCH} |
---|
[ae2e9f2] | 160 | @end ifset |
---|
[bf31efd] | 161 | @ifset NEWLIBPATCHVERSION |
---|
[6e8d424] | 162 | @value{NEWLIBRTEMSPATCH} |
---|
[ae2e9f2] | 163 | @end ifset |
---|
| 164 | tools/ |
---|
[6e8d424] | 165 | @value{BINUTILSUNTAR}/ |
---|
| 166 | @value{GCCUNTAR}/ |
---|
| 167 | @value{NEWLIBUNTAR}/ |
---|
[0df2ab87] | 168 | @end group |
---|
| 169 | @end example |
---|
| 170 | |
---|
[77ea5d30] | 171 | @c |
---|
[6449498] | 172 | @c Applying RTEMS Patches |
---|
[77ea5d30] | 173 | @c |
---|
| 174 | |
---|
[6449498] | 175 | @subsection Applying RTEMS Patches |
---|
[77ea5d30] | 176 | |
---|
[6449498] | 177 | NOTE: This step is required if building BINUTILS, GCC, and NEWLIB |
---|
[4a675a5c] | 178 | using the procedures described in @ref{Using configure and make}. |
---|
| 179 | It is @b{NOT} required if using the procedure |
---|
[6449498] | 180 | described in @ref{Using RPM to Build BINUTILS GCC and NEWLIB}. |
---|
[cdf30aba] | 181 | |
---|
[6449498] | 182 | This section describes the process of applying the RTEMS patches |
---|
| 183 | to GCC, NEWLIB, and BINUTILS. |
---|
[513196f] | 184 | |
---|
[bdec2709] | 185 | @c |
---|
[adee5979] | 186 | @c GCC patches |
---|
[bdec2709] | 187 | @c |
---|
| 188 | |
---|
[6449498] | 189 | @subheading Apply RTEMS Patch to GCC |
---|
[bdec2709] | 190 | |
---|
[bf31efd] | 191 | @ifclear GCCPATCHVERSION |
---|
| 192 | No RTEMS specific patches are required for @value{GCCUNTAR} to |
---|
[6e8d424] | 193 | support @value{RTEMSVERSION}. |
---|
[bdec2709] | 194 | @end ifclear |
---|
| 195 | |
---|
[bf31efd] | 196 | @ifset GCCPATCHVERSION |
---|
[bdec2709] | 197 | |
---|
| 198 | Apply the patch using the following command sequence: |
---|
| 199 | |
---|
| 200 | @example |
---|
[6e8d424] | 201 | cd tools/@value{GCCUNTAR} |
---|
| 202 | cat ../../archive/@value{GCCRTEMSPATCH} | \ |
---|
[6449498] | 203 | patch -p1 |
---|
[bdec2709] | 204 | @end example |
---|
| 205 | |
---|
[9789eefc] | 206 | If the patch was compressed with the @code{gzip} program, it will |
---|
| 207 | have a suffix of @code{.gz} and you should use @code{zcat} instead |
---|
| 208 | of @code{cat} as shown above. If the patch was compressed with |
---|
| 209 | the @code{gzip} program, it will have a suffix of @code{.bz2} and |
---|
| 210 | you should use @code{bzcat} instead of @code{cat} as shown above. |
---|
| 211 | |
---|
[bdec2709] | 212 | Check to see if any of these patches have been rejected using the following |
---|
| 213 | sequence: |
---|
| 214 | |
---|
| 215 | @example |
---|
[6e8d424] | 216 | cd tools/@value{GCCUNTAR} |
---|
[bdec2709] | 217 | find . -name "*.rej" -print |
---|
| 218 | @end example |
---|
| 219 | |
---|
| 220 | If any files are found with the .rej extension, a patch has been rejected. |
---|
[77ea5d30] | 221 | This should not happen with a good patch file which is properly applied. |
---|
[bdec2709] | 222 | |
---|
| 223 | @end ifset |
---|
| 224 | |
---|
| 225 | @c |
---|
| 226 | @c BINUTILS patches |
---|
| 227 | @c |
---|
| 228 | |
---|
[6449498] | 229 | @subheading Apply RTEMS Patch to binutils |
---|
[bdec2709] | 230 | |
---|
[bf31efd] | 231 | @ifclear BINUTILSPATCHVERSION |
---|
| 232 | No RTEMS specific patches are required for @value{BINUTILSUNTAR} to |
---|
[6e8d424] | 233 | support @value{RTEMSVERSION}. |
---|
[bdec2709] | 234 | @end ifclear |
---|
[417fcc73] | 235 | |
---|
[bf31efd] | 236 | @ifset BINUTILSPATCHVERSION |
---|
[bdec2709] | 237 | Apply the patch using the following command sequence: |
---|
[417fcc73] | 238 | |
---|
| 239 | @example |
---|
[6e8d424] | 240 | cd tools/@value{BINUTILSUNTAR} |
---|
| 241 | cat ../../archive/@value{BINUTILSRTEMSPATCH} | \ |
---|
[6449498] | 242 | patch -p1 |
---|
[417fcc73] | 243 | @end example |
---|
| 244 | |
---|
[9789eefc] | 245 | If the patch was compressed with the @code{gzip} program, it will |
---|
| 246 | have a suffix of @code{.gz} and you should use @code{zcat} instead |
---|
| 247 | of @code{cat} as shown above. If the patch was compressed with |
---|
| 248 | the @code{gzip} program, it will have a suffix of @code{.bz2} and |
---|
| 249 | you should use @code{bzcat} instead of @code{cat} as shown above. |
---|
| 250 | |
---|
[6113b3a] | 251 | Check to see if any of these patches have been rejected using the following |
---|
| 252 | sequence: |
---|
| 253 | |
---|
| 254 | @example |
---|
[6e8d424] | 255 | cd tools/@value{BINUTILSUNTAR} |
---|
[6113b3a] | 256 | find . -name "*.rej" -print |
---|
| 257 | @end example |
---|
[417fcc73] | 258 | |
---|
[6113b3a] | 259 | If any files are found with the .rej extension, a patch has been rejected. |
---|
[77ea5d30] | 260 | This should not happen with a good patch file which is properly applied. |
---|
[6113b3a] | 261 | |
---|
[bdec2709] | 262 | @end ifset |
---|
[6113b3a] | 263 | |
---|
[bdec2709] | 264 | @c |
---|
| 265 | @c Newlib patches |
---|
| 266 | @c |
---|
[6113b3a] | 267 | |
---|
[6449498] | 268 | @subheading Apply RTEMS Patch to newlib |
---|
[bdec2709] | 269 | |
---|
[bf31efd] | 270 | @ifclear NEWLIBPATCHVERSION |
---|
| 271 | No RTEMS specific patches are required for @value{NEWLIBUNTAR} to |
---|
[6e8d424] | 272 | support @value{RTEMSVERSION}. |
---|
[bdec2709] | 273 | @end ifclear |
---|
| 274 | |
---|
[bf31efd] | 275 | @ifset NEWLIBPATCHVERSION |
---|
[bdec2709] | 276 | |
---|
| 277 | Apply the patch using the following command sequence: |
---|
[6113b3a] | 278 | |
---|
| 279 | @example |
---|
[6e8d424] | 280 | cd tools/@value{NEWLIBUNTAR} |
---|
| 281 | cat ../../archive/@value{NEWLIBRTEMSPATCH} | \ |
---|
[6449498] | 282 | patch -p1 |
---|
[6113b3a] | 283 | @end example |
---|
| 284 | |
---|
[9789eefc] | 285 | If the patch was compressed with the @code{gzip} program, it will |
---|
| 286 | have a suffix of @code{.gz} and you should use @code{zcat} instead |
---|
| 287 | of @code{cat} as shown above. If the patch was compressed with |
---|
| 288 | the @code{gzip} program, it will have a suffix of @code{.bz2} and |
---|
| 289 | you should use @code{bzcat} instead of @code{cat} as shown above. |
---|
| 290 | |
---|
[6113b3a] | 291 | Check to see if any of these patches have been rejected using the following |
---|
| 292 | sequence: |
---|
| 293 | |
---|
| 294 | @example |
---|
[6e8d424] | 295 | cd tools/@value{NEWLIBUNTAR} |
---|
[6113b3a] | 296 | find . -name "*.rej" -print |
---|
| 297 | @end example |
---|
| 298 | |
---|
| 299 | If any files are found with the .rej extension, a patch has been rejected. |
---|
[77ea5d30] | 300 | This should not happen with a good patch file which is properly applied. |
---|
[6113b3a] | 301 | |
---|
[bdec2709] | 302 | @end ifset |
---|
| 303 | |
---|
[6449498] | 304 | |
---|
| 305 | @c |
---|
| 306 | @c Compiling and Installing BINUTILS GCC and NEWLIB |
---|
| 307 | @c |
---|
| 308 | |
---|
| 309 | @subsection Compiling and Installing BINUTILS GCC and NEWLIB |
---|
| 310 | |
---|
[4a675a5c] | 311 | There are two supported methods to compile and install BINUTILS, GCC, |
---|
| 312 | and NEWLIB: |
---|
[6449498] | 313 | |
---|
| 314 | @itemize @bullet |
---|
| 315 | @item RPM |
---|
| 316 | @item direct invocation of @code{configure} and @code{make} |
---|
| 317 | @end itemize |
---|
| 318 | |
---|
| 319 | Direct invocation of @code{configure} and @code{make} provides more control |
---|
| 320 | and easier recovery from problems when building. |
---|
| 321 | |
---|
| 322 | @c |
---|
| 323 | @c Using RPM to Build BINUTILS GCC and NEWLIB |
---|
| 324 | @c |
---|
| 325 | |
---|
| 326 | @subsubsection Using RPM to Build BINUTILS GCC and NEWLIB |
---|
| 327 | |
---|
| 328 | NOTE: The procedures described in the following sections must |
---|
| 329 | be completed before this step: |
---|
| 330 | |
---|
| 331 | @itemize @bullet |
---|
| 332 | @item @ref{Obtain Source and Patches for BINUTILS GCC and NEWLIB} |
---|
| 333 | @end itemize |
---|
| 334 | |
---|
| 335 | RPM automatically unarchives the source and applies any needed |
---|
| 336 | patches so you do @b{NOT} have to manually perform the procedures |
---|
| 337 | described @ref{Unarchiving the Tools} and |
---|
| 338 | @ref{Applying RTEMS Patches}. |
---|
| 339 | |
---|
| 340 | This section describes the process of building binutils, gcc, and |
---|
| 341 | newlib using RPM. RPM is a packaging format which can be used to |
---|
| 342 | distribute binary files as well as to capture the procedure and |
---|
| 343 | source code used to produce those binary files. Before |
---|
| 344 | attempting to build any RPM from source, it is necessary to |
---|
| 345 | ensure that all required source and patches are in the @code{SOURCES} |
---|
| 346 | directory under the RPM root (probably @code{/usr/src/redhat} or |
---|
| 347 | @code{/usr/local/src/redhat}) on your machine. This procedure |
---|
| 348 | starts by installing the source RPMs as shown in the following |
---|
| 349 | example: |
---|
| 350 | |
---|
| 351 | @example |
---|
[c9c98d7f] | 352 | rpm -U @value{RTEMSRPMPREFIX}i386-rtems@value{RTEMSAPI}-binutils-@value{BINUTILSVERSION}-@value{BINUTILSRPMRELEASE}.nosrc.rpm |
---|
| 353 | rpm -U @value{RTEMSRPMPREFIX}i386-rtems@value{RTEMSAPI}-gcc-@value{GCCVERSION}-@value{GCCRPMRELEASE}.nosrc.rpm |
---|
[6449498] | 354 | @end example |
---|
| 355 | |
---|
[bf31efd] | 356 | The RTEMS tool source RPMS are called "nosrc" to indicate that one or |
---|
[6449498] | 357 | more source files required to produce the RPMs are not present. |
---|
[bf31efd] | 358 | The RTEMS source RPMs typically include all required patches, but do not |
---|
| 359 | include the large @code{.tar.gz} or @code{.tgz} files for |
---|
[6449498] | 360 | each component such as BINUTILS, GCC, or NEWLIB. These are shared |
---|
| 361 | by all RTEMS RPMs regardless of target CPU and there was no reason |
---|
| 362 | to duplicate them. You will have to get the required source |
---|
| 363 | archive files by hand and place them in the @code{SOURCES} directory |
---|
| 364 | before attempting to build. If you forget to do this, RPM is |
---|
| 365 | smart -- it will tell you what is missing. To determine what is |
---|
| 366 | included or referenced by a particular RPM, use a command like the |
---|
| 367 | following: |
---|
| 368 | |
---|
| 369 | @example |
---|
[bf31efd] | 370 | @c Don't use @value{GCC*} below. This is an example |
---|
[c9c98d7f] | 371 | $ rpm -q -l -p @value{RTEMSRPMPREFIX}i386-rtems@value{RTEMSAPI}-gcc-3.2.3-1.nosrc.rpm |
---|
| 372 | gcc-3.2.3-rtems@value{RTEMSAPI}-20030507a.diff |
---|
| 373 | @value{RTEMSRPMPREFIX}i386-rtems4.7-gcc.spec |
---|
| 374 | newlib-1.11.0-rtems@value{RTEMSAPI}-20030507.diff |
---|
[6449498] | 375 | @end example |
---|
| 376 | |
---|
[bf31efd] | 377 | Notice that there are patch files (the @code{.diff} files) and a file |
---|
| 378 | describing the build procedure and files produced (the @code{.spec} file), |
---|
| 379 | but no source archives (the @code{*tar.*} files). |
---|
| 380 | When installing this source RPM |
---|
[c9c98d7f] | 381 | (@code{rpm -U @value{RTEMSRPMPREFIX}i386-rtems@value{RTEMSAPI}-gcc-newlib-gcc3.2.3newlib1.11.0-1.nosrc.rpm}), |
---|
[bf31efd] | 382 | the @code{.spec} file is placed in the @code{SPECS} directory under the RPM root |
---|
| 383 | directory, while the @code{*.diff} files are placed into the @code{SOURCES} |
---|
| 384 | directory. |
---|
[6449498] | 385 | |
---|
| 386 | @c |
---|
| 387 | @c Configuring and Building BINUTILS using RPM |
---|
| 388 | @c |
---|
| 389 | |
---|
| 390 | @subheading Configuring and Building BINUTILS using RPM |
---|
| 391 | |
---|
| 392 | The following example illustrates the invocation of RPM to build a new, |
---|
| 393 | locally compiled, binutils binary RPM that matches the installed source |
---|
| 394 | RPM. This example assumes that all of the required source is installed. |
---|
| 395 | |
---|
| 396 | @example |
---|
| 397 | cd <RPM_ROOT_DIRECTORY>/SPECS |
---|
[c9c98d7f] | 398 | rpm -bb i386-rtems@value{RTEMSAPI}-binutils-@value{BINUTILSVERSION}.spec |
---|
[6449498] | 399 | @end example |
---|
| 400 | |
---|
| 401 | If the build completes successfully, RPMS like the following will |
---|
| 402 | be generated in a build-host architecture specific subdirectory |
---|
| 403 | of the RPMS directory under the RPM root directory. |
---|
| 404 | |
---|
| 405 | @example |
---|
[57caf2d6] | 406 | @value{RTEMSRPMPREFIX}binutils-common-@value{BINUTILSVERSION}-@value{BINUTILSRPMRELEASE}.i386.rpm |
---|
[c9c98d7f] | 407 | @value{RTEMSRPMPREFIX}i386-rtems@value{RTEMSAPI}-binutils-@value{BINUTILSVERSION}-@value{BINUTILSRPMRELEASE}.i386.rpm |
---|
[6449498] | 408 | @end example |
---|
| 409 | |
---|
| 410 | NOTE: It may be necessary to remove the build tree in the |
---|
| 411 | @code{BUILD} directory under the RPM root directory. |
---|
| 412 | |
---|
| 413 | @c |
---|
| 414 | @c Configuring and Building GCC and NEWLIB using RPM |
---|
| 415 | @c |
---|
| 416 | |
---|
| 417 | @subheading Configuring and Building GCC and NEWLIB using RPM |
---|
| 418 | |
---|
| 419 | The following example illustrates the invocation of RPM to build a new, |
---|
| 420 | locally compiled, set of GCC and NEWLIB binary RPMs that match the |
---|
| 421 | installed source RPM. It is also necessary to install the BINUTILS |
---|
| 422 | RPMs and place them in your PATH. This example assumes that all of |
---|
| 423 | the required source is installed. |
---|
| 424 | |
---|
| 425 | @example |
---|
| 426 | cd <RPM_ROOT_DIRECTORY>/RPMS/i386 |
---|
[57caf2d6] | 427 | rpm -U @value{RTEMSRPMPREFIX}binutils-common-@value{BINUTILSVERSION}-@value{BINUTILSRPMRELEASE}.i386.rpm |
---|
[c9c98d7f] | 428 | rpm -U @value{RTEMSRPMPREFIX}i386-rtems@value{RTEMSAPI}-binutils-@value{BINUTILSVERSION}-@value{BINUTILSRPMRELEASE}.i386.rpm |
---|
[bf31efd] | 429 | export PATH=@value{RTEMSPREFIX}/bin:$PATH |
---|
[6449498] | 430 | cd <RPM_ROOT_DIRECTORY>/SPECS |
---|
[c9c98d7f] | 431 | rpm -bb i386-rtems@value{RTEMSAPI}-gcc-@value{GCCVERSION}-newlib-@value{NEWLIBVERSION}.spec |
---|
[6449498] | 432 | @end example |
---|
| 433 | |
---|
| 434 | If the build completes successfully, a set of RPMS like the following will |
---|
| 435 | be generated in a build-host architecture specific subdirectory |
---|
| 436 | of the RPMS directory under the RPM root directory. |
---|
| 437 | |
---|
| 438 | @example |
---|
[57caf2d6] | 439 | @value{RTEMSRPMPREFIX}gcc-common-@value{GCCVERSION}-@value{GCCRPMRELEASE}.i386.rpm |
---|
[c9c98d7f] | 440 | @value{RTEMSRPMPREFIX}i386-rtems@value{RTEMSAPI}-newlib-@value{NEWLIBVERSION}-@value{GCCRPMRELEASE}.i386.rpm |
---|
| 441 | @value{RTEMSRPMPREFIX}i386-rtems@value{RTEMSAPI}-gcc-@value{GCCVERSION}-@value{GCCRPMRELEASE}.i386.rpm |
---|
| 442 | @value{RTEMSRPMPREFIX}i386-rtems@value{RTEMSAPI}-gcc-c++-@value{GCCVERSION}-@value{GCCRPMRELEASE}.i386.rpm |
---|
[6449498] | 443 | @end example |
---|
| 444 | |
---|
| 445 | NOTE: Some targets do not support building all languages. |
---|
| 446 | |
---|
| 447 | NOTE: It may be necessary to remove the build tree in the |
---|
| 448 | @code{BUILD} directory under the RPM root directory. |
---|
| 449 | |
---|
| 450 | @c |
---|
| 451 | @c Using configure and make |
---|
| 452 | @c |
---|
| 453 | |
---|
| 454 | @subsubsection Using configure and make |
---|
| 455 | |
---|
| 456 | NOTE: The procedures described in the following sections must |
---|
| 457 | be completed before this step: |
---|
| 458 | |
---|
| 459 | @itemize @bullet |
---|
| 460 | @item @ref{Obtain Source and Patches for BINUTILS GCC and NEWLIB} |
---|
| 461 | @item @ref{Unarchiving the Tools} |
---|
| 462 | @item @ref{Applying RTEMS Patches} |
---|
| 463 | @end itemize |
---|
| 464 | |
---|
| 465 | This section describes the process of building binutils, gcc, and |
---|
| 466 | newlib manually using @code{configure} and @code{make} directly. |
---|
| 467 | |
---|
| 468 | @c |
---|
| 469 | @c Configuring and Building BINUTILS |
---|
| 470 | @c |
---|
| 471 | |
---|
| 472 | @subheading Configuring and Building BINUTILS |
---|
| 473 | |
---|
| 474 | The following example illustrates the invocation of |
---|
| 475 | @code{configure} and @code{make} |
---|
[6e8d424] | 476 | to build and install @value{BINUTILSUNTAR} for the |
---|
[0c69cdd] | 477 | sparc-rtems@value{RTEMSAPI} target: |
---|
[6449498] | 478 | |
---|
| 479 | @example |
---|
| 480 | mkdir b-binutils |
---|
| 481 | cd b-binutils |
---|
[0c69cdd] | 482 | ../@value{BINUTILSUNTAR}/configure --target=sparc-rtems@value{RTEMSAPI} \ |
---|
[bf31efd] | 483 | --prefix=@value{RTEMSPREFIX} |
---|
[6449498] | 484 | make all |
---|
| 485 | make info |
---|
| 486 | make install |
---|
| 487 | @end example |
---|
| 488 | |
---|
[6e8d424] | 489 | After @value{BINUTILSUNTAR} is built and installed the |
---|
[6449498] | 490 | build directory @code{b-binutils} may be removed. |
---|
| 491 | |
---|
| 492 | For more information on the invocation of @code{configure}, please |
---|
[6e8d424] | 493 | refer to the documentation for @value{BINUTILSUNTAR} or |
---|
| 494 | invoke the @value{BINUTILSUNTAR} @code{configure} command with the |
---|
[6449498] | 495 | @code{--help} option. |
---|
| 496 | |
---|
[3e0c94f] | 497 | NOTE: The shell PATH variable needs to be updated to include the path |
---|
[34ffa99] | 498 | the binutils user executables have been installed in. The directory |
---|
| 499 | containing the executables is the prefix used above with |
---|
[3e0c94f] | 500 | @file{bin} post-fixed. |
---|
| 501 | |
---|
| 502 | @example |
---|
[da8c85d] | 503 | export PATH=@value{RTEMSPREFIX}/bin:$@{PATH@} |
---|
[3e0c94f] | 504 | @end example |
---|
| 505 | |
---|
| 506 | Failure to have the binutils in the path will cause the GCC and NEWLIB |
---|
| 507 | build to fail with an error message similar to: |
---|
| 508 | |
---|
| 509 | @example |
---|
[c9c98d7f] | 510 | sparc-rtems@value{RTEMSAPI}-ar: command not found |
---|
[3e0c94f] | 511 | @end example |
---|
| 512 | |
---|
[6449498] | 513 | @c |
---|
| 514 | @c Configuring and Building GCC and NEWLIB |
---|
| 515 | @c |
---|
| 516 | |
---|
| 517 | @subheading Configuring and Building GCC and NEWLIB |
---|
| 518 | |
---|
[6e8d424] | 519 | Before building @value{GCCUNTAR} and @value{NEWLIBUNTAR}, |
---|
| 520 | @value{BINUTILSUNTAR} must be installed and the directory |
---|
[6449498] | 521 | containing those executables must be in your PATH. |
---|
| 522 | |
---|
| 523 | The C Library is built as a subordinate component of |
---|
[6e8d424] | 524 | @value{GCCUNTAR}. Because of this, the @value{NEWLIBUNTAR} |
---|
| 525 | directory source must be available inside the @value{GCCUNTAR} |
---|
[6449498] | 526 | source tree. This is normally accomplished using a symbolic |
---|
| 527 | link as shown in this example: |
---|
| 528 | |
---|
| 529 | @example |
---|
[6e8d424] | 530 | cd @value{GCCUNTAR} |
---|
| 531 | ln -s ../@value{NEWLIBUNTAR}/newlib . |
---|
[6449498] | 532 | @end example |
---|
| 533 | |
---|
| 534 | The following example illustrates the invocation of |
---|
| 535 | @code{configure} and @code{make} |
---|
[48cd0b8e] | 536 | to build and install @value{GCCUNTAR} with only |
---|
[0c69cdd] | 537 | C and C++ support for the sparc-rtems@value{RTEMSAPI} target: |
---|
[6449498] | 538 | |
---|
| 539 | @example |
---|
| 540 | mkdir b-gcc |
---|
| 541 | cd b-gcc |
---|
[0c69cdd] | 542 | ../@value{GCCUNTAR}/configure --target=sparc-rtems@value{RTEMSAPI} \ |
---|
[6449498] | 543 | --with-gnu-as --with-gnu-ld --with-newlib --verbose \ |
---|
[48cd0b8e] | 544 | --enable-threads --enable-languages="c,c++" \ |
---|
| 545 | --prefix=@value{RTEMSPREFIX} |
---|
[6449498] | 546 | make all |
---|
| 547 | make info |
---|
| 548 | make install |
---|
| 549 | @end example |
---|
| 550 | |
---|
[6e8d424] | 551 | After @value{GCCUNTAR} is built and installed the |
---|
[6449498] | 552 | build directory @code{b-gcc} may be removed. |
---|
| 553 | |
---|
| 554 | For more information on the invocation of @code{configure}, please |
---|
[6e8d424] | 555 | refer to the documentation for @value{GCCUNTAR} or |
---|
| 556 | invoke the @value{GCCUNTAR} @code{configure} command with the |
---|
[6449498] | 557 | @code{--help} option. |
---|
| 558 | |
---|
[48cd0b8e] | 559 | @c |
---|
| 560 | @c Building GCC with Ada Support |
---|
| 561 | @c |
---|
| 562 | @subheading Building GCC with Ada Support |
---|
| 563 | |
---|
| 564 | If you want a GCC toolset that includes support for Ada |
---|
| 565 | (e.g. GNAT), there are some additional requirements on |
---|
| 566 | the host environment and additional build steps to perform. |
---|
| 567 | It is critical that you use the same version of GCC/GNAT as |
---|
| 568 | the native compiler. GNAT must be compiled with an Ada compiler |
---|
| 569 | and when building a GNAT cross-compiler, it should be |
---|
| 570 | the same version of GNAT itself. |
---|
| 571 | |
---|
| 572 | The build procedure is the same until the configure step. |
---|
| 573 | A GCC toolset with GNAT enabled requires that @code{ada} |
---|
| 574 | be included in the set of enabled languages. |
---|
| 575 | The following example illustrates the invocation of |
---|
| 576 | @code{configure} and @code{make} |
---|
| 577 | to build and install @value{GCCUNTAR} with only |
---|
[0c69cdd] | 578 | C, C++, and Ada support for the sparc-rtems@value{RTEMSAPI} target: |
---|
[48cd0b8e] | 579 | |
---|
| 580 | @example |
---|
| 581 | mkdir b-gcc |
---|
| 582 | cd @value{GCCUNTAR}/gcc/ada |
---|
| 583 | touch treeprs.ads [es]info.h nmake.ad[bs] |
---|
| 584 | cd ../../../b-gcc |
---|
[0c69cdd] | 585 | ../@value{GCCUNTAR}/configure --target=sparc-rtems@value{RTEMSAPI} \ |
---|
[48cd0b8e] | 586 | --with-gnu-as --with-gnu-ld --with-newlib --verbose \ |
---|
| 587 | --enable-threads --enable-languages="c,c++,ada" \ |
---|
| 588 | --prefix=@value{RTEMSPREFIX} |
---|
| 589 | make all |
---|
| 590 | make info |
---|
| 591 | make -C gcc cross-gnattools |
---|
| 592 | make -C gcc ada.all.cross |
---|
| 593 | make -C gcc GNATLIBCFLAGS="USER_SELECTED_CPU_CFLAGS" gnatlib |
---|
| 594 | make install |
---|
| 595 | @end example |
---|
| 596 | |
---|
| 597 | After @value{GCCUNTAR} is built and installed the |
---|
| 598 | build directory @code{b-gcc} may be removed. |
---|
| 599 | |
---|
[6449498] | 600 | @c |
---|
| 601 | @c Building the GNU Debugger GDB |
---|
| 602 | @c |
---|
| 603 | |
---|
| 604 | @section Building the GNU Debugger GDB |
---|
| 605 | |
---|
| 606 | NOTE: This step is NOT required if prebuilt executables for |
---|
| 607 | the GNU Debugger GDB were installed. |
---|
| 608 | |
---|
| 609 | The GNU Debugger GDB supports many configurations but requires some |
---|
| 610 | means of communicating between the host computer and target board. |
---|
| 611 | This communication can be via a serial port, Ethernet, BDM, or ROM emulator. |
---|
| 612 | The communication protocol can be the GDB remote protocol or GDB |
---|
| 613 | can talk directly to a ROM monitor. This setup is target board |
---|
| 614 | specific. The following configurations have been |
---|
| 615 | successfully used with RTEMS applications: |
---|
| 616 | |
---|
| 617 | @itemize @bullet |
---|
[48cd0b8e] | 618 | @item BDM with ColdFire, 683xx, MPC860 CPUs |
---|
[6449498] | 619 | @item Motorola Mxxxbug found on M68xxx VME boards |
---|
[48cd0b8e] | 620 | @item Motorola PPCbug found on PowerPC VME, CompactPCI, and MTX boards |
---|
| 621 | @item ARM based Cogent EDP7312 |
---|
| 622 | @item PC's using various Intel and AMD CPUs including i386, |
---|
| 623 | i486, Pentium and above, and Athlon |
---|
| 624 | @item PowerPC Instruction Simulator in GDB (PSIM) |
---|
| 625 | @item MIPS Instruction Simulator in GDB (JMR3904) |
---|
| 626 | @item Sparc Instruction Simulator in GDB (SIS) |
---|
| 627 | @item Sparc Instruction Simulator (TSIM) |
---|
| 628 | @item DINK32 on various PowerPC boards |
---|
[6449498] | 629 | @end itemize |
---|
| 630 | |
---|
| 631 | GDB is currently RTEMS thread/task aware only if you are using the |
---|
| 632 | remote debugging support via Ethernet. These are configured |
---|
| 633 | using gdb targets of the form CPU-RTEMS. Note the capital RTEMS. |
---|
| 634 | |
---|
| 635 | It is recommended that when toolset binaries are available for |
---|
| 636 | your particular host, that they be used. Prebuilt binaries |
---|
| 637 | are much easier to install but in the case of gdb may or may |
---|
| 638 | not include support for your particular target board. |
---|
| 639 | |
---|
| 640 | @c |
---|
| 641 | @c Obtain Source and Patches for GDB |
---|
| 642 | @c |
---|
| 643 | |
---|
| 644 | @subsection Obtain Source and Patches for GDB |
---|
| 645 | |
---|
| 646 | NOTE: This step is required for all methods of building GDB. |
---|
| 647 | |
---|
| 648 | This section lists the components required to build GDB |
---|
| 649 | from source to target RTEMS. These files should be |
---|
| 650 | placed in your @code{archive} directory. Included are the locations |
---|
| 651 | of each component as well as any required RTEMS specific patches. |
---|
| 652 | |
---|
| 653 | @need 1000 |
---|
[bf31efd] | 654 | @subheading @value{GDBUNTAR} |
---|
[6449498] | 655 | @example |
---|
[6e8d424] | 656 | FTP Site: @value{GDBFTPSITE} |
---|
| 657 | Directory: @value{GDBFTPDIR} |
---|
| 658 | File: @value{GDBTAR} |
---|
[bf31efd] | 659 | URL: @uref{@value{GDBFTPURL},,@value{GDBFTPURL}} |
---|
[6449498] | 660 | @end example |
---|
| 661 | |
---|
| 662 | @need 1000 |
---|
| 663 | @subheading RTEMS Specific Tool Patches and Scripts |
---|
| 664 | @example |
---|
[6e8d424] | 665 | FTP Site: @value{RTEMSFTPSITE} |
---|
[39075eb2] | 666 | Directory: @value{RTEMSFTPDIR}/SOURCES |
---|
[bf31efd] | 667 | @ifset GDBPATCHVERSION |
---|
[6e8d424] | 668 | File: @value{GDBRTEMSPATCH} |
---|
[39075eb2] | 669 | URL: @uref{ftp://@value{RTEMSFTPSITE}@value{RTEMSFTPDIR}/SOURCES/@value{GDBRTEMSPATCH},,ftp://@value{RTEMSFTPSITE}@value{RTEMSFTPDIR}/SOURCES/@value{GDBRTEMSPATCH}} |
---|
[6449498] | 670 | @end ifset |
---|
| 671 | @end example |
---|
| 672 | |
---|
| 673 | @c |
---|
| 674 | @c Unarchiving the GDB Distribution |
---|
| 675 | @c |
---|
| 676 | @subsection Unarchiving the GDB Distribution |
---|
| 677 | |
---|
| 678 | Use the following commands to unarchive the GDB distribution: |
---|
| 679 | |
---|
| 680 | @example |
---|
| 681 | cd tools |
---|
[6e8d424] | 682 | tar xzf ../archive/@value{GDBTAR} |
---|
[6449498] | 683 | @end example |
---|
| 684 | |
---|
[6e8d424] | 685 | The directory @value{GDBUNTAR} is created under the tools directory. |
---|
[6449498] | 686 | |
---|
| 687 | @c |
---|
| 688 | @c Applying RTEMS Patch to GDB |
---|
| 689 | @c |
---|
| 690 | |
---|
| 691 | @subsection Applying RTEMS Patch to GDB |
---|
| 692 | |
---|
[bf31efd] | 693 | @ifclear GDBPATCHVERSION |
---|
[6e8d424] | 694 | No RTEMS specific patches are required for @value{GDBVERSION} to |
---|
| 695 | support @value{RTEMSVERSION}. |
---|
[6449498] | 696 | @end ifclear |
---|
| 697 | |
---|
[bf31efd] | 698 | @ifset GDBPATCHVERSION |
---|
[6449498] | 699 | |
---|
| 700 | Apply the patch using the following command sequence: |
---|
| 701 | |
---|
| 702 | @example |
---|
[6e8d424] | 703 | cd tools/@value{GDBUNTAR} |
---|
| 704 | cat archive/@value{GDBRTEMSPATCH} | \ |
---|
[6449498] | 705 | patch -p1 |
---|
| 706 | @end example |
---|
| 707 | |
---|
[9789eefc] | 708 | If the patch was compressed with the @code{gzip} program, it will |
---|
| 709 | have a suffix of @code{.gz} and you should use @code{zcat} instead |
---|
| 710 | of @code{cat} as shown above. If the patch was compressed with |
---|
| 711 | the @code{gzip} program, it will have a suffix of @code{.bz2} and |
---|
| 712 | you should use @code{bzcat} instead of @code{cat} as shown above. |
---|
| 713 | |
---|
[6449498] | 714 | Check to see if any of these patches have been rejected using the following |
---|
| 715 | sequence: |
---|
| 716 | |
---|
| 717 | @example |
---|
[6e8d424] | 718 | cd tools/@value{GDBUNTAR} |
---|
[6449498] | 719 | find . -name "*.rej" -print |
---|
| 720 | @end example |
---|
| 721 | |
---|
| 722 | If any files are found with the .rej extension, a patch has been rejected. |
---|
| 723 | This should not happen with a good patch file. |
---|
| 724 | |
---|
| 725 | @end ifset |
---|
| 726 | |
---|
| 727 | @c |
---|
| 728 | @c Compiling and Installing the GNU Debugger GDB |
---|
| 729 | @c |
---|
| 730 | |
---|
| 731 | @subsection Compiling and Installing the GNU Debugger GDB |
---|
| 732 | |
---|
| 733 | There are three methods of building the GNU Debugger: |
---|
| 734 | |
---|
| 735 | @itemize @bullet |
---|
| 736 | @item RPM |
---|
| 737 | @item direct invocation of @code{configure} and @code{make} |
---|
| 738 | @end itemize |
---|
| 739 | |
---|
| 740 | Direct invocation of @code{configure} and @code{make} provides more control |
---|
| 741 | and easier recovery from problems when building. |
---|
| 742 | |
---|
| 743 | @c |
---|
| 744 | @c Using RPM to Build GDB |
---|
| 745 | @c |
---|
| 746 | |
---|
| 747 | @subsubsection Using RPM to Build GDB |
---|
| 748 | |
---|
| 749 | This section describes the process of building binutils, gcc, and |
---|
| 750 | newlib using RPM. RPM is a packaging format which can be used to |
---|
| 751 | distribute binary files as well as to capture the procedure and |
---|
| 752 | source code used to produce those binary files. Before |
---|
| 753 | attempting to build any RPM from source, it is necessary to |
---|
| 754 | ensure that all required source and patches are in the @code{SOURCES} |
---|
| 755 | directory under the RPM root (probably @code{/usr/src/redhat} or |
---|
| 756 | @code{/usr/local/src/redhat}) on your machine. This procedure |
---|
| 757 | starts by installing the source RPMs as shown in the following |
---|
| 758 | example: |
---|
| 759 | |
---|
| 760 | @example |
---|
[c9c98d7f] | 761 | rpm -U @value{RTEMSRPMPREFIX}i386-rtems@value{RTEMSAPI}-gdb-@value{GDBVERSION}-@value{GDBRPMRELEASE}.nosrc.rpm |
---|
[6449498] | 762 | @end example |
---|
| 763 | |
---|
| 764 | Because RTEMS tool RPMS are called "nosrc" to indicate that one or |
---|
| 765 | more source files required to produce the RPMs are not present. |
---|
| 766 | The RTEMS source GDB RPM does not include the large @code{.tar.gz} or |
---|
| 767 | @code{.tgz} files for GDB. This is shared by all RTEMS RPMs |
---|
| 768 | regardless of target CPU and there was no reason |
---|
| 769 | to duplicate them. You will have to get the required source |
---|
| 770 | archive files by hand and place them in the @code{SOURCES} directory |
---|
| 771 | before attempting to build. If you forget to do this, RPM is |
---|
| 772 | smart -- it will tell you what is missing. To determine what is |
---|
| 773 | included or referenced by a particular RPM, use a command like the |
---|
| 774 | following: |
---|
| 775 | |
---|
| 776 | @example |
---|
[c9c98d7f] | 777 | $ rpm -q -l -p @value{RTEMSRPMPREFIX}i386-rtems@value{RTEMSAPI}-gdb-@value{GDBVERSION}-@value{GDBRPMRELEASE}.nosrc.rpm |
---|
| 778 | gdb-@value{GDBVERSION}-rtems@value{RTEMSAPI}-@value{GDBPATCHVERSION}.diff |
---|
[bf31efd] | 779 | gdb-@value{GDBVERSION}.tar.gz |
---|
[c9c98d7f] | 780 | i386-rtems@value{RTEMSAPI}-gdb-@value{GDBVERSION}.spec |
---|
[6449498] | 781 | @end example |
---|
| 782 | |
---|
| 783 | Notice that there is a patch file (the @code{.diff} file), a source archive |
---|
| 784 | file (the @code{.tar.gz}), and a file describing the build procedure and |
---|
| 785 | files produced (the @code{.spec} file). The @code{.spec} file is placed |
---|
| 786 | in the @code{SPECS} directory under the RPM root directory. |
---|
| 787 | |
---|
| 788 | @c |
---|
| 789 | @c Configuring and Building GDB using RPM |
---|
| 790 | @c |
---|
| 791 | |
---|
| 792 | @subheading Configuring and Building GDB using RPM |
---|
| 793 | |
---|
| 794 | The following example illustrates the invocation of RPM to build a new, |
---|
| 795 | locally compiled, binutils binary RPM that matches the installed source |
---|
| 796 | RPM. This example assumes that all of the required source is installed. |
---|
| 797 | |
---|
| 798 | @example |
---|
| 799 | cd <RPM_ROOT_DIRECTORY>/SPECS |
---|
[c9c98d7f] | 800 | rpm -bb i386-rtems@value{RTEMSAPI}-gdb-@value{GDBVERSION}.spec |
---|
[6449498] | 801 | @end example |
---|
| 802 | |
---|
| 803 | If the build completes successfully, RPMS like the following will |
---|
| 804 | be generated in a build-host architecture specific subdirectory |
---|
| 805 | of the RPMS directory under the RPM root directory. |
---|
| 806 | |
---|
| 807 | @example |
---|
[c9c98d7f] | 808 | @value{RTEMSRPMPREFIX}gdb-common-@value{GDBVERSION}-@value{GDBRPMRELEASE}.i386.rpm |
---|
| 809 | @value{RTEMSRPMPREFIX}i386-rtems@value{RTEMSAPI}-gdb-@value{GDBVERSION}-@value{GDBRPMRELEASE}.i386.rpm |
---|
[6449498] | 810 | @end example |
---|
| 811 | |
---|
| 812 | NOTE: It may be necessary to remove the build tree in the |
---|
| 813 | @code{BUILD} directory under the RPM root directory. |
---|
| 814 | |
---|
| 815 | @c |
---|
| 816 | @c Using the GDB configure Script Directly |
---|
| 817 | @c |
---|
| 818 | |
---|
| 819 | @subsubsection Using the GDB configure Script Directly |
---|
| 820 | |
---|
| 821 | This section describes how to configure the GNU debugger for |
---|
| 822 | RTEMS targets using @code{configure} and @code{make} directly. |
---|
| 823 | The following example illustrates the invocation of @code{configure} |
---|
[6e8d424] | 824 | and @code{make} to build and install @value{GDBUNTAR} for the |
---|
[0c69cdd] | 825 | m68k-rtems@value{RTEMSAPI} target: |
---|
[6449498] | 826 | |
---|
| 827 | @example |
---|
| 828 | mkdir b-gdb |
---|
| 829 | cd b-gdb |
---|
[0c69cdd] | 830 | ../@value{GDBUNTAR}/configure --target=m68k-rtems@value{RTEMSAPI} \ |
---|
[bf31efd] | 831 | --prefix=@value{RTEMSPREFIX} |
---|
[6449498] | 832 | make all |
---|
| 833 | make info |
---|
| 834 | make install |
---|
| 835 | @end example |
---|
| 836 | |
---|
| 837 | For some configurations, it is necessary to specify extra options |
---|
| 838 | to @code{configure} to enable and configure option components |
---|
| 839 | such as a processor simulator. The following is a list of |
---|
| 840 | configurations for which there are extra options: |
---|
| 841 | |
---|
| 842 | @table @b |
---|
[0c69cdd] | 843 | @item powerpc-rtems@value{RTEMSAPI} |
---|
[6449498] | 844 | @code{--enable-sim --enable-sim-powerpc --enable-sim-timebase --enable-sim-hardware} |
---|
| 845 | |
---|
[0c69cdd] | 846 | @item sparc-rtems@value{RTEMSAPI} |
---|
[6449498] | 847 | @code{--enable-sim} |
---|
| 848 | |
---|
| 849 | @end table |
---|
| 850 | |
---|
[6e8d424] | 851 | After @value{GDBUNTAR} is built and installed the |
---|
[6449498] | 852 | build directory @code{b-gdb} may be removed. |
---|
| 853 | |
---|
| 854 | For more information on the invocation of @code{configure}, please |
---|
[6e8d424] | 855 | refer to the documentation for @value{GDBUNTAR} or |
---|
| 856 | invoke the @value{GDBUNTAR} @code{configure} command with the |
---|
[6449498] | 857 | @code{--help} option. |
---|
| 858 | |
---|
| 859 | @c |
---|
| 860 | @c Common Problems |
---|
| 861 | @c |
---|
| 862 | |
---|
[3048b8f] | 863 | @section Common Problems |
---|
| 864 | |
---|
| 865 | @subsection Error Message Indicates Invalid Option to Assembler |
---|
| 866 | |
---|
| 867 | If a message like this is printed then the new cross compiler |
---|
| 868 | is most likely using the native assembler instead of the cross |
---|
| 869 | assembler or vice-versa (native compiler using new cross assembler). |
---|
| 870 | This can occur for one of the following reasons: |
---|
| 871 | |
---|
| 872 | @itemize @bullet |
---|
| 873 | |
---|
| 874 | @item Binutils Patch Improperly Applied |
---|
| 875 | @item Binutils Not Built |
---|
| 876 | @item Current Directory is in Your PATH |
---|
| 877 | |
---|
| 878 | @end itemize |
---|
| 879 | |
---|
[6449498] | 880 | If you are using binutils 2.9.1 or newer with certain older versions of |
---|
[0ab65474] | 881 | gcc, they do not agree on what the name of the newly |
---|
[3048b8f] | 882 | generated cross assembler is. Older binutils called it @code{as.new} |
---|
| 883 | which became @code{as.new.exe} under Windows. This is not a valid |
---|
| 884 | file name, so @code{as.new} is now called @code{as-new}. By using the latest |
---|
| 885 | released tool versions and RTEMS patches, this problem will be avoided. |
---|
| 886 | |
---|
| 887 | If binutils did not successfully build the cross assembler, then |
---|
| 888 | the new cross gcc (@code{xgcc}) used to build the libraries can not |
---|
| 889 | find it. Make sure the build of the binutils succeeded. |
---|
| 890 | |
---|
| 891 | If you include the current directory in your PATH, then there |
---|
| 892 | is a chance that the native compiler will accidentally use |
---|
| 893 | the new cross assembler instead of the native one. This usually |
---|
| 894 | indicates that "." is before the standard system directories |
---|
| 895 | in your PATH. As a general rule, including "." in your PATH |
---|
| 896 | is a security risk and should be avoided. Remove "." from |
---|
| 897 | your PATH. |
---|
| 898 | |
---|
[6449498] | 899 | NOTE: In some environments, it may be difficult to remove "." |
---|
[adee5979] | 900 | completely from your PATH. In this case, make sure that "." |
---|
| 901 | is after the system directories containing "as" and "ld". |
---|
| 902 | |
---|
[3048b8f] | 903 | @subsection Error Messages Indicating Configuration Problems |
---|
| 904 | |
---|
| 905 | If you see error messages like the following, |
---|
| 906 | |
---|
| 907 | @itemize @bullet |
---|
| 908 | |
---|
[6449498] | 909 | @item cannot configure libiberty |
---|
[3048b8f] | 910 | @item coff-emulation not found |
---|
| 911 | @item etc. |
---|
| 912 | |
---|
| 913 | @end itemize |
---|
| 914 | |
---|
| 915 | Then it is likely that one or more of your gnu tools is |
---|
| 916 | already configured locally in its source tree. You can check |
---|
| 917 | for this by searching for the @code{config.status} file |
---|
| 918 | in the various tool source trees. The following command |
---|
| 919 | does this for the binutils source: |
---|
| 920 | |
---|
| 921 | @example |
---|
[6e8d424] | 922 | find @value{BINUTILSUNTAR} -name config.status -print |
---|
[3048b8f] | 923 | @end example |
---|
| 924 | |
---|
| 925 | The solution for this is to execute the command |
---|
| 926 | @code{make distclean} in each of the GNU tools |
---|
| 927 | root source directory. This should remove all |
---|
| 928 | generated files including Makefiles. |
---|
| 929 | |
---|
| 930 | This situation usually occurs when you have previously |
---|
| 931 | built the tool source for some non-RTEMS target. The |
---|
| 932 | generated configuration specific files are still in |
---|
| 933 | the source tree and the include path specified during |
---|
| 934 | the RTEMS build accidentally picks up the previous |
---|
| 935 | configuration. The include path used is something like |
---|
| 936 | this: |
---|
| 937 | |
---|
| 938 | @example |
---|
[6e8d424] | 939 | -I../../@value{BINUTILSUNTAR}/gcc -I/@value{BINUTILSUNTAR}/gcc/include -I. |
---|
[3048b8f] | 940 | @end example |
---|
| 941 | |
---|
| 942 | Note that the tool source directory is searched before the |
---|
| 943 | build directory. |
---|
| 944 | |
---|
| 945 | This situation can be avoided entirely by never using |
---|
| 946 | the source tree as the build directory -- even for |
---|
[6449498] | 947 | |
---|