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{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 <INSTALL_POINT>/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:<INSTALL_POINT>/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 <INSTALL_POINT>. |
---|
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 is currently only one supported |
---|
123 | method to compile and install RTEMS: |
---|
124 | |
---|
125 | @itemize @bullet |
---|
126 | @item direct invocation of @code{configure} and @code{make} |
---|
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=<TARGET_CONFIGURATION> \ |
---|
158 | --disable-posix --disable-tcpip --disable-cxx \ |
---|
159 | --enable-rtemsbsp=<BOARD_SUPPORT_PACKAGE>\ |
---|
160 | --prefix=<INSTALL_POINT> |
---|
161 | make all install |
---|
162 | @end example |
---|
163 | |
---|
164 | Where the list of currently supported <TARGET_CONFIGURATION>'s and |
---|
165 | <BOARD_SUPPORT_PACKAGE>'s can be found in |
---|
166 | tools/@value{RTEMS-UNTAR}/README.configure. |
---|
167 | |
---|
168 | <INSTALL_POINT> is typically the installation point for the |
---|
169 | tools and is @code{/opt/rtems} when using prebuilt toolset executables. |
---|
170 | |
---|
171 | BSP is a supported BSP for the selected CPU family. The list of |
---|
172 | supported BSPs may be found in the file |
---|
173 | tools/@value{RTEMS-UNTAR}/README.configure |
---|
174 | in the RTEMS source tree. If the BSP parameter is not specified, |
---|
175 | then all supported BSPs for the selected CPU family will be built. |
---|
176 | |
---|
177 | @b{NOTE:} The POSIX API must be enabled to use GNAT/RTEMS. |
---|
178 | |
---|
179 | @b{NOTE:} The @code{make} utility used should be GNU make. |
---|
180 | |
---|