[417fcc73] | 1 | @c |
---|
[6113b3a] | 2 | @c |
---|
[0660b4f8] | 3 | @c COPYRIGHT (c) 1988-1999. |
---|
[417fcc73] | 4 | @c On-Line Applications Research Corporation (OAR). |
---|
| 5 | @c All rights reserved. |
---|
| 6 | @c |
---|
| 7 | @c $Id$ |
---|
| 8 | @c |
---|
| 9 | |
---|
[6113b3a] | 10 | @chapter Building RTEMS |
---|
[417fcc73] | 11 | |
---|
[57a736ff] | 12 | @section Unpack the RTEMS Source |
---|
[417fcc73] | 13 | |
---|
[6113b3a] | 14 | Use the following command sequence to unpack the RTEMS source into the |
---|
| 15 | tools directory: |
---|
[417fcc73] | 16 | |
---|
| 17 | @example |
---|
| 18 | cd tools |
---|
[ae2e9f2] | 19 | tar xzf ../archive/@value{RTEMS-TAR} |
---|
[417fcc73] | 20 | @end example |
---|
| 21 | |
---|
[1732414] | 22 | If you did not build and instal the tools from source, then you |
---|
| 23 | will need to unarchive the build scripts at this point. In this |
---|
| 24 | case, you will have to execute the following additional command |
---|
| 25 | since you did not do it as part of building the tools. |
---|
| 26 | |
---|
| 27 | @example |
---|
| 28 | tar xzf ../archive/@value{BUILDTOOLS-TAR} |
---|
| 29 | @end example |
---|
| 30 | |
---|
| 31 | At this point, the following files and directories should |
---|
| 32 | exist in the current directory in order to build RTEMS: |
---|
| 33 | |
---|
| 34 | @itemize @bullet |
---|
| 35 | @item bit |
---|
| 36 | @item bit_rtems |
---|
| 37 | @item common.sh |
---|
| 38 | @item @value{RTEMS-UNTAR} |
---|
| 39 | @item user.cfg |
---|
| 40 | @end itemize |
---|
| 41 | |
---|
[57a736ff] | 42 | @section Add <INSTALL_POINT>/bin to Executable PATH |
---|
[417fcc73] | 43 | |
---|
[bdec2709] | 44 | In order to compile RTEMS, you must have the cross compilation toolset |
---|
| 45 | in your search patch. The following command appends the directory |
---|
[1732414] | 46 | where the tools were installed prior to this point: |
---|
[417fcc73] | 47 | |
---|
| 48 | @example |
---|
[bdec2709] | 49 | export PATH=$PATH:<INSTALL_POINT>/bin |
---|
[417fcc73] | 50 | @end example |
---|
| 51 | |
---|
[c1c5ab9] | 52 | NOTE: The above command is in Bourne shell (@code{sh}) syntax and |
---|
| 53 | should work with the Korn (@code{ksh}) and GNU Bourne Again Shell |
---|
| 54 | (@code{bash}). It will not work with the C Shell (@code{csh}) or |
---|
| 55 | derivatives of the C Shell. |
---|
| 56 | |
---|
| 57 | @section Verifying the Operation of the Cross Toolset |
---|
| 58 | |
---|
| 59 | In order to insure that the cross-compiler is invoking the correct |
---|
| 60 | subprograms (like @code{as} and @code{ld}), one can test assemble |
---|
| 61 | a small program. When in verbose more, @code{gcc} prints out information |
---|
| 62 | showing where it found the subprograms it invokes. Place the following |
---|
| 63 | function in a file named @code{f.c}: |
---|
| 64 | |
---|
| 65 | @example |
---|
| 66 | int f( int x ) |
---|
[6cede6e] | 67 | @{ |
---|
[c1c5ab9] | 68 | return x + 1; |
---|
[6cede6e] | 69 | @} |
---|
[c1c5ab9] | 70 | @end example |
---|
| 71 | |
---|
| 72 | Then assemble the file using a command similar to the following: |
---|
| 73 | |
---|
| 74 | @example |
---|
| 75 | m68k-rtems-gcc -v -S f.c |
---|
| 76 | @end example |
---|
| 77 | |
---|
| 78 | Where @code{m68k-rtems-gcc} should be changed to match the installed |
---|
| 79 | name of your cross compiler. The result of this command will be |
---|
| 80 | a sequence of output showing where the cross-compiler searched for |
---|
| 81 | and found its subcomponents. Verify that these paths correspond |
---|
| 82 | to your <INSTALL_POINT>. |
---|
| 83 | |
---|
| 84 | @b{NOTE:} One of the most common installation errors is for the |
---|
| 85 | cross-compiler not to be able to find the cross assembler and default |
---|
| 86 | to using the native @code{as}. This can result in very confusing |
---|
| 87 | error messages. |
---|
[bdec2709] | 88 | |
---|
[57a736ff] | 89 | @section Generate RTEMS for a Specific Target and BSP |
---|
[417fcc73] | 90 | |
---|
[3fccbb34] | 91 | @subsection Using the bit_rtems Script |
---|
| 92 | |
---|
| 93 | The simplest way to build RTEMS is to use the @code{bit_rtems} script. |
---|
| 94 | This script interprets the settings in the @code{user.cfg} file to |
---|
| 95 | enable or disable the various RTEMS options. |
---|
| 96 | |
---|
| 97 | This script is invoked as follows: |
---|
| 98 | |
---|
| 99 | @example |
---|
| 100 | ./bit_rtems CPU [BSP] |
---|
| 101 | @end example |
---|
| 102 | |
---|
| 103 | Where CPU is one of the RTEMS supported CPU families from the following |
---|
| 104 | list: |
---|
| 105 | |
---|
| 106 | @itemize @bullet |
---|
| 107 | @item hppa1.1 |
---|
| 108 | @item i386 |
---|
| 109 | @item i386-elf |
---|
| 110 | @item i386-go32 |
---|
| 111 | @item i960 |
---|
| 112 | @item m68k |
---|
| 113 | @item mips64orion |
---|
| 114 | @item powerpc |
---|
| 115 | @item sh |
---|
| 116 | @item sparc |
---|
| 117 | @end itemize |
---|
| 118 | |
---|
| 119 | BSP is a supported BSP for the selected CPU family. The list of |
---|
| 120 | supported BSPs may be found in the file |
---|
| 121 | tools/@value{RTEMS-UNTAR}/README.configure |
---|
| 122 | in the RTEMS source tree. If the BSP parameter is not specified, |
---|
| 123 | then all supported BSPs for the selected CPU family will be built. |
---|
| 124 | |
---|
[adee5979] | 125 | @b{NOTE:} The POSIX API must be enabled to use GNAT/RTEMS. |
---|
| 126 | |
---|
[3fccbb34] | 127 | @subsection Using the RTEMS configure Script Directly |
---|
| 128 | |
---|
[6113b3a] | 129 | Make a build directory under tools and build the RTEMS product in this |
---|
[bdec2709] | 130 | directory. The ../@value{RTEMS-UNTAR}/configure |
---|
| 131 | command has numerous command line |
---|
[6113b3a] | 132 | arguments. These arguments are discussed in detail in documentation that |
---|
| 133 | comes with the RTEMS distribution. In the installation described in the |
---|
| 134 | section "Unpack the RTEMS source", these configuration options can be found |
---|
[3fccbb34] | 135 | in the file tools/@value{RTEMS-UNTAR}/README.configure. |
---|
[417fcc73] | 136 | |
---|
[adee5979] | 137 | The GNAT/RTEMS run-time implementation is based on the POSIX API. Thus |
---|
| 138 | the RTEMS configuration for a GNAT/RTEMS environment MUST include the |
---|
| 139 | @code{--enable-posix} flag. |
---|
| 140 | |
---|
[bdec2709] | 141 | The following shows the command sequence required to configure, |
---|
[3fccbb34] | 142 | compile, and install RTEMS with the POSIX API, FreeBSD TCP/IP, |
---|
[bdec2709] | 143 | and C++ support disabled. RTEMS will be built to target |
---|
| 144 | the @code{BOARD_SUPPORT_PACKAGE} board. |
---|
[417fcc73] | 145 | |
---|
| 146 | @example |
---|
[6113b3a] | 147 | mkdir build-rtems |
---|
| 148 | cd build-rtems |
---|
[bdec2709] | 149 | ../@value{RTEMS-UNTAR}/configure --target=<TARGET_CONFIGURATION> \ |
---|
[3fccbb34] | 150 | --disable-posix --disable-tcpip --disable-cxx \ |
---|
[bdec2709] | 151 | --enable-rtemsbsp=<BOARD_SUPPORT_PACKAGE>\ |
---|
| 152 | --prefix=<INSTALL_POINT> |
---|
[0689ac5] | 153 | make all install |
---|
[417fcc73] | 154 | @end example |
---|
| 155 | |
---|
[57a736ff] | 156 | Where the list of currently supported of <TARGET_CONFIGURATION>'s and |
---|
[6113b3a] | 157 | <BOARD_SUPPORT_PACKAGE>'s can be found in |
---|
[bdec2709] | 158 | tools/@value{RTEMS-UNTAR}/README.configure. |
---|
[417fcc73] | 159 | |
---|
[6113b3a] | 160 | <INSTALL_POINT> is the installation point from the previous step |
---|
| 161 | "Modify the bit script" in the build of the tools. |
---|
[417fcc73] | 162 | |
---|
[0689ac5] | 163 | NOTE: The @code{make} utility used should be GNU make. |
---|