1 |
1026 |
ivang |
@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 buildrt.t,v 1.14 2002/01/17 21:47:46 joel Exp
|
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{RTEMS-VERSION}
|
19 |
|
|
@example
|
20 |
|
|
FTP Site: @value{RTEMS-FTPSITE}
|
21 |
|
|
Directory: @value{RTEMS-FTPDIR}
|
22 |
|
|
File: @value{RTEMS-TAR}
|
23 |
|
|
@ifset use-html
|
24 |
|
|
@c URL: @uref{ftp://@value{RTEMS-FTPSITE}@value{RTEMS-FTPDIR}, Download RTEMS components}
|
25 |
|
|
URL: ftp://@value{RTEMS-FTPSITE}@value{RTEMS-FTPDIR}
|
26 |
|
|
@end ifset
|
27 |
|
|
@end example
|
28 |
|
|
|
29 |
|
|
@subheading RTEMS Hello World
|
30 |
|
|
@example
|
31 |
|
|
FTP Site: @value{RTEMS-FTPSITE}
|
32 |
|
|
Directory: @value{RTEMS-FTPDIR}
|
33 |
|
|
File: hello_world_c.tgz
|
34 |
|
|
@ifset use-html
|
35 |
|
|
@c URL: @uref{ftp://@value{RTEMS-FTPSITE}@value{RTEMS-FTPDIR}/hello_world_c.tgz, Download RTEMS Hello World}
|
36 |
|
|
URL: ftp://@value{RTEMS-FTPSITE}@value{RTEMS-FTPDIR}/hello_world_c.tgz
|
37 |
|
|
@end ifset
|
38 |
|
|
@end example
|
39 |
|
|
|
40 |
|
|
@c
|
41 |
|
|
@c Unarchive the RTEMS Source
|
42 |
|
|
@c
|
43 |
|
|
|
44 |
|
|
@section Unarchive the RTEMS Source
|
45 |
|
|
|
46 |
|
|
Use the following command sequence to unpack the RTEMS source into the
|
47 |
|
|
tools directory:
|
48 |
|
|
|
49 |
|
|
@example
|
50 |
|
|
cd tools
|
51 |
|
|
tar xzf ../archive/@value{RTEMS-TAR}
|
52 |
|
|
@end example
|
53 |
|
|
|
54 |
|
|
This creates the directory @value{RTEMS-UNTAR}.
|
55 |
|
|
|
56 |
|
|
|
57 |
|
|
@section Add /bin to Executable PATH
|
58 |
|
|
|
59 |
|
|
In order to compile RTEMS, you must have the cross compilation toolset
|
60 |
|
|
in your search path. The following command appends the directory
|
61 |
|
|
where the tools were installed prior to this point:
|
62 |
|
|
|
63 |
|
|
@example
|
64 |
|
|
export PATH=$PATH:/bin
|
65 |
|
|
@end example
|
66 |
|
|
|
67 |
|
|
NOTE: The above command is in Bourne shell (@code{sh}) syntax and
|
68 |
|
|
should work with the Korn (@code{ksh}) and GNU Bourne Again Shell
|
69 |
|
|
(@code{bash}). It will not work with the C Shell (@code{csh}) or
|
70 |
|
|
derivatives of the C Shell.
|
71 |
|
|
|
72 |
|
|
@section Verifying the Operation of the Cross Toolset
|
73 |
|
|
|
74 |
|
|
In order to insure that the cross-compiler is invoking the correct
|
75 |
|
|
subprograms (like @code{as} and @code{ld}), one can test assemble
|
76 |
|
|
a small program. When in verbose mode, @code{gcc} prints out information
|
77 |
|
|
showing where it found the subprograms it invokes. In a temporary
|
78 |
|
|
working directory, place the following function in a file named @code{f.c}:
|
79 |
|
|
|
80 |
|
|
@example
|
81 |
|
|
int f( int x )
|
82 |
|
|
@{
|
83 |
|
|
return x + 1;
|
84 |
|
|
@}
|
85 |
|
|
@end example
|
86 |
|
|
|
87 |
|
|
Then assemble the file using a command similar to the following:
|
88 |
|
|
|
89 |
|
|
@example
|
90 |
|
|
m68k-rtems-gcc -v -S f.c
|
91 |
|
|
@end example
|
92 |
|
|
|
93 |
|
|
Where @code{m68k-rtems-gcc} should be changed to match the installed
|
94 |
|
|
name of your cross compiler. The result of this command will be
|
95 |
|
|
a sequence of output showing where the cross-compiler searched for
|
96 |
|
|
and found its subcomponents. Verify that these paths correspond
|
97 |
|
|
to your .
|
98 |
|
|
|
99 |
|
|
Look at the created file @code{f.s} and verify that it is in fact
|
100 |
|
|
for your target processor.
|
101 |
|
|
|
102 |
|
|
Then try to compile the file @code{f.c} directly to object code
|
103 |
|
|
using a command like the following:
|
104 |
|
|
|
105 |
|
|
@example
|
106 |
|
|
m68k-rtems-gcc -v -c f.c
|
107 |
|
|
@end example
|
108 |
|
|
|
109 |
|
|
If this produces messages that indicate the assembly code is
|
110 |
|
|
not valid, then it is likely that you have fallen victim to
|
111 |
|
|
one of the problems described in
|
112 |
|
|
@ref{Error Message Indicates Invalid Option to Assembler}
|
113 |
|
|
Don't feel bad about this, one of the most common installation errors
|
114 |
|
|
is for the cross-compiler not to be able to find the cross assembler
|
115 |
|
|
and default to using the native @code{as}. This can result in very confusing
|
116 |
|
|
error messages.
|
117 |
|
|
|
118 |
|
|
@section Building RTEMS for a Specific Target and BSP
|
119 |
|
|
|
120 |
|
|
This section describes how to configure and build RTEMS
|
121 |
|
|
so that it is specifically tailored for your BSP and the
|
122 |
|
|
CPU model it uses. There are two methods to compile and install RTEMS:
|
123 |
|
|
|
124 |
|
|
@itemize @bullet
|
125 |
|
|
@item direct invocation of @code{configure} and @code{make}
|
126 |
|
|
@item using the @code{bit} script
|
127 |
|
|
@end itemize
|
128 |
|
|
|
129 |
|
|
Direct invocation of @code{configure} and @code{make} provides more control
|
130 |
|
|
and easier recovery from problems when building.
|
131 |
|
|
|
132 |
|
|
This section describes how to build RTEMS.
|
133 |
|
|
|
134 |
|
|
@subsection Using the RTEMS configure Script Directly
|
135 |
|
|
|
136 |
|
|
Make a build directory under tools and build the RTEMS product in this
|
137 |
|
|
directory. The ../@value{RTEMS-UNTAR}/configure
|
138 |
|
|
command has numerous command line
|
139 |
|
|
arguments. These arguments are discussed in detail in documentation that
|
140 |
|
|
comes with the RTEMS distribution. If you followed the procedure
|
141 |
|
|
described in the section @ref{Unarchive the RTEMS Source}, these
|
142 |
|
|
configuration options can be found in the file
|
143 |
|
|
tools/@value{RTEMS-UNTAR}/README.configure.
|
144 |
|
|
|
145 |
|
|
@b{NOTE}: The GNAT/RTEMS run-time implementation is based on the POSIX
|
146 |
|
|
API. Thus the RTEMS configuration for a GNAT/RTEMS environment MUST
|
147 |
|
|
include the @code{--enable-posix} flag.
|
148 |
|
|
|
149 |
|
|
The following shows the command sequence required to configure,
|
150 |
|
|
compile, and install RTEMS with the POSIX API, FreeBSD TCP/IP,
|
151 |
|
|
and C++ support disabled. RTEMS will be built to target
|
152 |
|
|
the @code{BOARD_SUPPORT_PACKAGE} board.
|
153 |
|
|
|
154 |
|
|
@example
|
155 |
|
|
mkdir build-rtems
|
156 |
|
|
cd build-rtems
|
157 |
|
|
../@value{RTEMS-UNTAR}/configure --target= \
|
158 |
|
|
--disable-posix --disable-tcpip --disable-cxx \
|
159 |
|
|
--enable-rtemsbsp=\
|
160 |
|
|
--prefix=
|
161 |
|
|
make all install
|
162 |
|
|
@end example
|
163 |
|
|
|
164 |
|
|
Where the list of currently supported 's and
|
165 |
|
|
's can be found in
|
166 |
|
|
tools/@value{RTEMS-UNTAR}/README.configure.
|
167 |
|
|
|
168 |
|
|
is typically the installation point for the
|
169 |
|
|
tools and is @code{/opt/rtems} when using prebuilt toolset executables.
|
170 |
|
|
|
171 |
|
|
NOTE: The @code{make} utility used should be GNU make.
|
172 |
|
|
|
173 |
|
|
@c
|
174 |
|
|
@c Using the bit_rtems Script
|
175 |
|
|
@c
|
176 |
|
|
|
177 |
|
|
@subsection Using the bit_rtems Script
|
178 |
|
|
|
179 |
|
|
If you have not previously unarchived the build tools, then you
|
180 |
|
|
will need to unarchive the build scripts at this point if you
|
181 |
|
|
plan to use @code{bit_rtems} to build RTEMS. If this is the
|
182 |
|
|
case, you will have to execute the following additional command
|
183 |
|
|
since you did not do it as part of building the tools.
|
184 |
|
|
|
185 |
|
|
@example
|
186 |
|
|
cd tools
|
187 |
|
|
tar xzf ../archive/@value{BUILDTOOLS-TAR}
|
188 |
|
|
@end example
|
189 |
|
|
|
190 |
|
|
This script interprets the settings in the @code{user.cfg} file to
|
191 |
|
|
enable or disable the various RTEMS options. The RTEMS
|
192 |
|
|
specific entries described below must be set to
|
193 |
|
|
tailor the RTEMS configuration to meet your application requirements:
|
194 |
|
|
|
195 |
|
|
@table @code
|
196 |
|
|
|
197 |
|
|
@item RTEMS
|
198 |
|
|
is the directory under tools that contains @value{RTEMS-UNTAR}.
|
199 |
|
|
|
200 |
|
|
@item ENABLE_RTEMS_POSIX
|
201 |
|
|
is set to "yes" if you want to enable the RTEMS POSIX API support.
|
202 |
|
|
At this time, this feature is not supported by the UNIX ports of RTEMS
|
203 |
|
|
and is forced to "no" for those targets. This corresponds to the
|
204 |
|
|
@code{configure} option @code{--enable-posix}.
|
205 |
|
|
|
206 |
|
|
@item ENABLE_RTEMS_ITRON
|
207 |
|
|
is set to "yes" if you want to enable the RTEMS ITRON API support.
|
208 |
|
|
At this time, this feature is not supported by the UNIX ports of RTEMS
|
209 |
|
|
and is forced to "no" for those targets. This corresponds to the
|
210 |
|
|
@code{configure} option @code{--enable-itron}.
|
211 |
|
|
|
212 |
|
|
@item ENABLE_RTEMS_MP
|
213 |
|
|
is set to "yes" if you want to enable the RTEMS multiprocessing
|
214 |
|
|
support. This feature is not supported by all RTEMS BSPs and
|
215 |
|
|
is automatically forced to "no" for those BSPs. This corresponds to the
|
216 |
|
|
@code{configure} option @code{--enable-multiprocessing}.
|
217 |
|
|
|
218 |
|
|
@item ENABLE_RTEMS_CXX
|
219 |
|
|
is set to "yes" if you want to build the RTEMS C++ support including
|
220 |
|
|
the C++ Wrapper for the Classic API. This corresponds to the
|
221 |
|
|
@code{configure} option @code{--enable-cxx}.
|
222 |
|
|
|
223 |
|
|
@item ENABLE_RTEMS_TESTS
|
224 |
|
|
is set to "yes" if you want to build the RTEMS Test Suite. If this
|
225 |
|
|
is set to "no", then only the Sample Tests will be built. Setting
|
226 |
|
|
this option to "yes" significantly increases the amount of disk
|
227 |
|
|
space required to build RTEMS.
|
228 |
|
|
This corresponds to the @code{configure} option @code{--enable-tests}.
|
229 |
|
|
|
230 |
|
|
@item ENABLE_RTEMS_TCPIP
|
231 |
|
|
is set to "yes" if you want to build the RTEMS TCP/IP Stack. If a
|
232 |
|
|
particular BSP does not support TCP/IP, then this feature is automatically
|
233 |
|
|
disabled. This corresponds to the @code{configure} option
|
234 |
|
|
@code{--enable-tcpip}.
|
235 |
|
|
|
236 |
|
|
@item ENABLE_RTEMS_NONDEBUG
|
237 |
|
|
is set to "yes" if you want to build RTEMS in a fully optimized
|
238 |
|
|
state. This corresponds to executing @code{make} after configuring
|
239 |
|
|
the source tree.
|
240 |
|
|
|
241 |
|
|
@item ENABLE_RTEMS_DEBUG
|
242 |
|
|
is set to "yes" if you want to build RTEMS in a debug version.
|
243 |
|
|
When built for debug, RTEMS will include run-time code to
|
244 |
|
|
perform consistency checks such as heap consistency checks.
|
245 |
|
|
Although the precise compilation arguments are BSP dependent,
|
246 |
|
|
the debug version of RTEMS is usually built at a lower optimization
|
247 |
|
|
level. This is usually done to reduce inlining which can make
|
248 |
|
|
tracing code execution difficult. This corresponds to executing
|
249 |
|
|
@code{make VARIANT=debug} after configuring
|
250 |
|
|
the source tree.
|
251 |
|
|
|
252 |
|
|
@item INSTALL_RTEMS
|
253 |
|
|
is set to "yes" if you want to install RTEMS after building it.
|
254 |
|
|
This corresponds to executing @code{make install} after configuring
|
255 |
|
|
and building the source tree.
|
256 |
|
|
|
257 |
|
|
@item ENABLE_RTEMS_MAINTAINER_MODE
|
258 |
|
|
is set to "yes" if you want to enabled maintainer mode functionality
|
259 |
|
|
in the RTEMS Makefile. This is disabled by default and it is not
|
260 |
|
|
expected that most users will want to enable this. When this option
|
261 |
|
|
is enabled, the build process may attempt to regenerate files that
|
262 |
|
|
require tools not required when this option is disabled.
|
263 |
|
|
This corresponds to the @code{configure} option
|
264 |
|
|
@code{--enable-maintainer-mode}.
|
265 |
|
|
|
266 |
|
|
@end table
|
267 |
|
|
|
268 |
|
|
After tailoring @code{user.cfg} for your application, the @code{bit_rtems}
|
269 |
|
|
script may be invoked as follows:
|
270 |
|
|
|
271 |
|
|
@example
|
272 |
|
|
./bit_rtems CPU [BSP]
|
273 |
|
|
@end example
|
274 |
|
|
|
275 |
|
|
Where CPU is one of the RTEMS supported CPU families from the following
|
276 |
|
|
list:
|
277 |
|
|
|
278 |
|
|
@itemize @bullet
|
279 |
|
|
@item hppa1.1
|
280 |
|
|
@item i386
|
281 |
|
|
@item i386-coff
|
282 |
|
|
@item i386-elf
|
283 |
|
|
@item i960
|
284 |
|
|
@item m68k
|
285 |
|
|
@item m68k-coff
|
286 |
|
|
@item mips64orion
|
287 |
|
|
@item powerpc
|
288 |
|
|
@item sh
|
289 |
|
|
@item sh-elf
|
290 |
|
|
@item sparc
|
291 |
|
|
@end itemize
|
292 |
|
|
|
293 |
|
|
BSP is a supported BSP for the selected CPU family. The list of
|
294 |
|
|
supported BSPs may be found in the file
|
295 |
|
|
tools/@value{RTEMS-UNTAR}/README.configure
|
296 |
|
|
in the RTEMS source tree. If the BSP parameter is not specified,
|
297 |
|
|
then all supported BSPs for the selected CPU family will be built.
|
298 |
|
|
|
299 |
|
|
@b{NOTE:} The POSIX API must be enabled to use GNAT/RTEMS.
|
300 |
|
|
|