1 | @c |
---|
2 | @c |
---|
3 | @c COPYRIGHT (c) 1988-2002. |
---|
4 | @c On-Line Applications Research Corporation (OAR). |
---|
5 | @c All rights reserved. |
---|
6 | @c |
---|
7 | @c $Id$ |
---|
8 | @c |
---|
9 | |
---|
10 | @chapter Building RTEMS |
---|
11 | |
---|
12 | @section Obtain the RTEMS Source Code |
---|
13 | |
---|
14 | This section provides pointers to the RTEMS source code and |
---|
15 | Hello World example program. These files should be |
---|
16 | placed in your @code{archive} directory. |
---|
17 | |
---|
18 | @subheading @value{RTEMSVERSION} |
---|
19 | @example |
---|
20 | FTP Site: @value{RTEMSFTPSITE} |
---|
21 | Directory: @value{RTEMSFTPDIR}/@value{VERSION} |
---|
22 | File: @value{RTEMSTAR} |
---|
23 | URL: @uref{ftp://@value{RTEMSFTPSITE}@value{RTEMSFTPDIR}/@value{VERSION}/@value{RTEMSTAR},,ftp://@value{RTEMSFTPSITE}@value{RTEMSFTPDIR}/@value{VERSION}/@value{RTEMSTAR}} |
---|
24 | @end example |
---|
25 | |
---|
26 | @subheading RTEMS Examples including Hello World |
---|
27 | @example |
---|
28 | FTP Site: @value{RTEMSFTPSITE} |
---|
29 | Directory: @value{RTEMSFTPDIR}/@value{VERSION} |
---|
30 | File: examples-@value{VERSION}.tar.bz2 |
---|
31 | URL: @uref{ftp://@value{RTEMSFTPSITE}@value{RTEMSFTPDIR}/@value{VERSION}/examples-@value{VERSION}.tar.bz2,,ftp://@value{RTEMSFTPSITE}@value{RTEMSFTPDIR}/@value{VERSION}/examples-@value{VERSION}.tar.bz2} |
---|
32 | @end example |
---|
33 | |
---|
34 | @c |
---|
35 | @c Unarchive the RTEMS Source |
---|
36 | @c |
---|
37 | |
---|
38 | @section Unarchive the RTEMS Source |
---|
39 | |
---|
40 | Use the following command sequence to unpack the RTEMS source into the |
---|
41 | tools directory: |
---|
42 | |
---|
43 | @example |
---|
44 | cd tools |
---|
45 | tar xjf ../archive/@value{RTEMSTAR} |
---|
46 | @end example |
---|
47 | |
---|
48 | This creates the directory @value{RTEMSUNTAR}. |
---|
49 | |
---|
50 | |
---|
51 | @section Add <INSTALL_POINT>/bin to Executable PATH |
---|
52 | |
---|
53 | In order to compile RTEMS, you must have the cross compilation toolset |
---|
54 | in your search path. It is important to have the RTEMS toolset first |
---|
55 | in your path to ensure that you are using the intended version of all |
---|
56 | tools. The following command prepends the directory |
---|
57 | where the tools were installed in a previous step: |
---|
58 | |
---|
59 | @example |
---|
60 | export PATH=<INSTALL_POINT>/bin:${PATH} |
---|
61 | @end example |
---|
62 | |
---|
63 | NOTE: The above command is in Bourne shell (@code{sh}) syntax and |
---|
64 | should work with the Korn (@code{ksh}) and GNU Bourne Again Shell |
---|
65 | (@code{bash}). It will not work with the C Shell (@code{csh}) or |
---|
66 | derivatives of the C Shell. |
---|
67 | |
---|
68 | @section Verifying the Operation of the Cross Toolset |
---|
69 | |
---|
70 | In order to insure that the cross-compiler is invoking the correct |
---|
71 | subprograms (like @code{as} and @code{ld}), one can test assemble |
---|
72 | a small program. When in verbose mode, @code{gcc} prints out information |
---|
73 | showing where it found the subprograms it invokes. In a temporary |
---|
74 | working directory, place the following function in a file named @code{f.c}: |
---|
75 | |
---|
76 | @example |
---|
77 | int f( int x ) |
---|
78 | @{ |
---|
79 | return x + 1; |
---|
80 | @} |
---|
81 | @end example |
---|
82 | |
---|
83 | Then assemble the file using a command similar to the following: |
---|
84 | |
---|
85 | @example |
---|
86 | m68k-rtems-gcc -v -S f.c |
---|
87 | @end example |
---|
88 | |
---|
89 | Where @code{m68k-rtems-gcc} should be changed to match the installed |
---|
90 | name of your cross compiler. The result of this command will be |
---|
91 | a sequence of output showing where the cross-compiler searched for |
---|
92 | and found its subcomponents. Verify that these paths correspond |
---|
93 | to your <INSTALL_POINT>. |
---|
94 | |
---|
95 | Look at the created file @code{f.s} and verify that it is in fact |
---|
96 | for your target processor. |
---|
97 | |
---|
98 | Then try to compile the file @code{f.c} directly to object code |
---|
99 | using a command like the following: |
---|
100 | |
---|
101 | @example |
---|
102 | m68k-rtems-gcc -v -c f.c |
---|
103 | @end example |
---|
104 | |
---|
105 | If this produces messages that indicate the assembly code is |
---|
106 | not valid, then it is likely that you have fallen victim to |
---|
107 | one of the problems described in |
---|
108 | @ref{Error Message Indicates Invalid Option to Assembler} |
---|
109 | Don't feel bad about this, one of the most common installation errors |
---|
110 | is for the cross-compiler not to be able to find the cross assembler |
---|
111 | and default to using the native @code{as}. This can result in very confusing |
---|
112 | error messages. |
---|
113 | |
---|
114 | @section Building RTEMS for a Specific Target and BSP |
---|
115 | |
---|
116 | This section describes how to configure and build RTEMS |
---|
117 | so that it is specifically tailored for your BSP and the |
---|
118 | CPU model it uses. There is currently only one supported |
---|
119 | method to compile and install RTEMS: |
---|
120 | |
---|
121 | @itemize @bullet |
---|
122 | @item direct invocation of @code{configure} and @code{make} |
---|
123 | @end itemize |
---|
124 | |
---|
125 | Direct invocation of @code{configure} and @code{make} provides more control |
---|
126 | and easier recovery from problems when building. |
---|
127 | |
---|
128 | This section describes how to build RTEMS. |
---|
129 | |
---|
130 | @subsection Using the RTEMS configure Script Directly |
---|
131 | |
---|
132 | Make a build directory under tools and build the RTEMS product in this |
---|
133 | directory. The @code{../@value{RTEMSUNTAR}/configure} |
---|
134 | command has numerous command line |
---|
135 | arguments. These arguments are discussed in detail in documentation that |
---|
136 | comes with the RTEMS distribution. A full list of these arguments can be |
---|
137 | obtained by running @code{../@value{RTEMSUNTAR}/configure --help} |
---|
138 | If you followed the procedure |
---|
139 | described in the section @ref{Unarchive the RTEMS Source}, these |
---|
140 | configuration options can be found in the file |
---|
141 | tools/@value{RTEMSUNTAR}/README.configure. |
---|
142 | |
---|
143 | @b{NOTE}: The GNAT/RTEMS run-time implementation is based on the POSIX |
---|
144 | API. Thus the RTEMS configuration for a GNAT/RTEMS environment MUST |
---|
145 | include the @code{--enable-posix} flag. |
---|
146 | |
---|
147 | The following shows the command sequence required to configure, |
---|
148 | compile, and install RTEMS with the POSIX API, FreeBSD TCP/IP, |
---|
149 | and C++ support disabled. RTEMS will be built to target |
---|
150 | the @code{BOARD_SUPPORT_PACKAGE} board. |
---|
151 | |
---|
152 | @example |
---|
153 | mkdir build-rtems |
---|
154 | cd build-rtems |
---|
155 | ../@value{RTEMSUNTAR}/configure --target=<TARGET_CONFIGURATION> \ |
---|
156 | --disable-posix --disable-networking --disable-cxx \ |
---|
157 | --enable-rtemsbsp=<BOARD_SUPPORT_PACKAGE>\ |
---|
158 | --prefix=<INSTALL_POINT> |
---|
159 | make all install |
---|
160 | @end example |
---|
161 | |
---|
162 | Where the list of currently supported <TARGET_CONFIGURATION>'s and |
---|
163 | <BOARD_SUPPORT_PACKAGE>'s can be found in |
---|
164 | tools/@value{RTEMSUNTAR}/README.configure. |
---|
165 | |
---|
166 | <INSTALL_POINT> is typically the installation point for the |
---|
167 | tools and defaults to @code{@value{RTEMSPREFIX}}. |
---|
168 | |
---|
169 | BSP is a supported BSP for the selected CPU family. The list of |
---|
170 | supported BSPs may be found in the file |
---|
171 | tools/@value{RTEMSUNTAR}/README.configure |
---|
172 | in the RTEMS source tree. If the BSP parameter is not specified, |
---|
173 | then all supported BSPs for the selected CPU family will be built. |
---|
174 | |
---|
175 | @b{NOTE:} The POSIX API must be enabled to use GNAT/RTEMS. |
---|
176 | |
---|
177 | @b{NOTE:} The @code{make} utility used should be GNU make. |
---|