source: rtems/doc/started/buildrt.t @ 34ffa99

4.104.114.84.95
Last change on this file since 34ffa99 was 34ffa99, checked in by Joel Sherrill <joel.sherrill@…>, on 09/27/04 at 22:28:16

2004-09-27 Joel Sherrill <joel@…>

PR 681/doc
PR 682/doc

  • buildc.t, buildrt.t, sample.t: Fix PATH and tar examples. Enable binutils link again.
  • user/overview.t: Chapter numbering in preface was wrong.
  • Property mode set to 100644
File size: 6.0 KB
Line 
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
14This section provides pointers to the RTEMS source code and
15Hello World example program.  These files should be
16placed 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
40Use the following command sequence to unpack the RTEMS source into the
41tools directory:
42
43@example
44cd tools
45tar xjf ../archive/@value{RTEMSTAR}
46@end example
47
48This creates the directory @value{RTEMSUNTAR}.
49
50
51@section Add <INSTALL_POINT>/bin to Executable PATH
52
53In order to compile RTEMS, you must have the cross compilation toolset
54in your search path.  It is important to have the RTEMS toolset first
55in your path to ensure that you are using the intended version of all
56tools.  The following command prepends the directory
57where the tools were installed in a previous step:
58
59@example
60export PATH=<INSTALL_POINT>/bin:${PATH}
61@end example
62
63NOTE:  The above command is in Bourne shell (@code{sh}) syntax and
64should 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
66derivatives of the C Shell.
67
68@section Verifying the Operation of the Cross Toolset
69
70In order to insure that the cross-compiler is invoking the correct
71subprograms (like @code{as} and @code{ld}), one can test assemble
72a small program.  When in verbose mode, @code{gcc} prints out information
73showing where it found the subprograms it invokes.  In a temporary
74working directory, place the following function in a file named @code{f.c}:
75
76@example
77int f( int x )
78@{
79  return x + 1;
80@}
81@end example
82
83Then assemble the file using a command similar to the following:
84
85@example
86m68k-rtems-gcc -v -S f.c
87@end example
88
89Where @code{m68k-rtems-gcc} should be changed to match the installed
90name of your cross compiler.  The result of this command will be
91a sequence of output showing where the cross-compiler searched for
92and found its subcomponents.  Verify that these paths correspond
93to your <INSTALL_POINT>.
94
95Look at the created file @code{f.s} and verify that it is in fact
96for your target processor.
97
98Then try to compile the file @code{f.c} directly to object code
99using a command like the following:
100
101@example
102m68k-rtems-gcc -v -c f.c
103@end example
104
105If this produces messages that indicate the assembly code is
106not valid, then it is likely that you have fallen victim to
107one of the problems described in
108@ref{Error Message Indicates Invalid Option to Assembler}
109Don't feel bad about this, one of the most common installation errors
110is for the cross-compiler not to be able to find the cross assembler
111and default to using the native @code{as}.  This can result in very confusing
112error messages.
113
114@section Building RTEMS for a Specific Target and BSP
115
116This section describes how to configure and build RTEMS
117so that it is specifically tailored for your BSP and the
118CPU model it uses.  There is currently only one supported
119method to compile and install RTEMS:
120
121@itemize @bullet
122@item direct invocation of @code{configure} and @code{make}
123@end itemize
124
125Direct invocation of @code{configure} and @code{make} provides more control
126and easier recovery from problems when building.
127
128This section describes how to build RTEMS.
129
130@subsection Using the RTEMS configure Script Directly
131
132Make a build directory under tools and build the RTEMS product in this
133directory. The @code{../@value{RTEMSUNTAR}/configure}
134command has numerous command line
135arguments. These arguments are discussed in detail in documentation that
136comes with the RTEMS distribution. A full list of these arguments can be
137obtained by running @code{../@value{RTEMSUNTAR}/configure --help}
138If you followed the procedure
139described in the section @ref{Unarchive the RTEMS Source}, these
140configuration options can be found in the file
141tools/@value{RTEMSUNTAR}/README.configure.
142
143@b{NOTE}: The GNAT/RTEMS run-time implementation is based on the POSIX
144API.  Thus the RTEMS configuration for a GNAT/RTEMS environment MUST
145include the @code{--enable-posix} flag.
146
147The following shows the command sequence required to configure,
148compile, and install RTEMS with the POSIX API, FreeBSD TCP/IP,
149and C++ support disabled.  RTEMS will be built to target
150the @code{BOARD_SUPPORT_PACKAGE} board.
151
152@example
153mkdir build-rtems
154cd 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>
159make all install
160@end example
161
162Where the list of currently supported <TARGET_CONFIGURATION>'s and
163<BOARD_SUPPORT_PACKAGE>'s can be found in
164tools/@value{RTEMSUNTAR}/README.configure.
165
166<INSTALL_POINT> is typically the installation point for the
167tools and defaults to @code{@value{RTEMSPREFIX}}.
168
169BSP is a supported BSP for the selected CPU family.  The list of
170supported BSPs may be found in the file
171tools/@value{RTEMSUNTAR}/README.configure
172in the RTEMS source tree.  If the BSP parameter is not specified,
173then 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.
Note: See TracBrowser for help on using the repository browser.