1 | @c |
---|
2 | @c COPYRIGHT (c) 1989-2007. |
---|
3 | @c On-Line Applications Research Corporation (OAR). |
---|
4 | @c All rights reserved. |
---|
5 | @c |
---|
6 | @c $Id$ |
---|
7 | @c |
---|
8 | |
---|
9 | @chapter Sample Applications |
---|
10 | |
---|
11 | @section Introduction |
---|
12 | |
---|
13 | The RTEMS source distribution includes a set of sample applications |
---|
14 | that are located in the @code{$@{RTEMS_ROOT@}/testsuites/samples/} |
---|
15 | directory. These applications are intended to illustrate the |
---|
16 | basic format of RTEMS single and multiple processor |
---|
17 | applications and the use of some features. In addition, these |
---|
18 | relatively simple applications can be used to test locally |
---|
19 | developed board support packages and device drivers as they |
---|
20 | exercise a critical subset of RTEMS functionality that is often |
---|
21 | broken in new BSPs. |
---|
22 | |
---|
23 | Each of the following sample applications will be listed in |
---|
24 | more detail in the following sections: |
---|
25 | |
---|
26 | @table @b |
---|
27 | @item Hello World |
---|
28 | The RTEMS Hello World test is provided in |
---|
29 | the subdirectory @code{$@{RTEMS_ROOT@}/testsuites/samples/hello/}. |
---|
30 | This test is helpful when testing new |
---|
31 | versions of RTEMS, BSPs, or modifications to any portion of the |
---|
32 | RTEMS development environment. |
---|
33 | |
---|
34 | @item Clock Tick |
---|
35 | The @code{$@{RTEMS_ROOT@}/testsuites/samples/ticker/} |
---|
36 | subdirectory provides a test for verification of clock chip |
---|
37 | device drivers of BSPs. |
---|
38 | |
---|
39 | @item Base Single Processor |
---|
40 | A simple single processor test similar to those in the |
---|
41 | single processor test suite is provided in |
---|
42 | @code{$@{RTEMS_ROOT@}/testsuites/samples/base_sp/}. |
---|
43 | |
---|
44 | @item Base Multiple Processor |
---|
45 | A simple two node multiprocessor test capable of testing an newly |
---|
46 | developed MPCI layer is provided in |
---|
47 | @code{$@{RTEMS_ROOT@}/testsuites/samples/base_mp/}. |
---|
48 | |
---|
49 | @item Constructor/Destructor C++ Test |
---|
50 | The @code{$@{RTEMS_ROOT@}/testsuites/samples/cdtest/} |
---|
51 | subdirectory provides a simple C++ application using |
---|
52 | constructors and destructors. It is only built when |
---|
53 | C++ is enabled. |
---|
54 | |
---|
55 | |
---|
56 | @item Paranoia Floating Point Test |
---|
57 | The directory @code{$@{RTEMS_ROOT@}/testsuites/samples/paranoia/} |
---|
58 | contains the public domain floating point and math library test. |
---|
59 | |
---|
60 | @item Minimum Size Test |
---|
61 | The directory |
---|
62 | @code{$@{RTEMS_ROOT@}/testsuites/samples/minimum/} |
---|
63 | contains a simple RTEMS program that results in a non-functional |
---|
64 | executable. It is intended to show the size of a minimum footprint |
---|
65 | application based upon the current RTEMS configuration. |
---|
66 | |
---|
67 | @item Unlimited Object Allocation |
---|
68 | The @code{$@{RTEMS_ROOT@}/testsuites/samples/unlimited/} |
---|
69 | directory contains a sample test that demonstrates the use of the |
---|
70 | @i{unlimited} object allocation configuration option to RTEMS. |
---|
71 | |
---|
72 | @item Network Loopback Test |
---|
73 | The @code{$@{RTEMS_ROOT@}/testsuites/samples/loopback/} |
---|
74 | directory contains a sample test that demonstrates the use of |
---|
75 | sockets and the loopback network device. It does not require |
---|
76 | the presence of network hardware in order to run. |
---|
77 | It is only built if RTEMS was configured with networking enabled. |
---|
78 | |
---|
79 | @end table |
---|
80 | |
---|
81 | The sample tests are written using the Classic API so the reader |
---|
82 | should be familiar with the terms used and |
---|
83 | material presented in the @b{RTEMS Applications Users Guide}. |
---|
84 | |
---|
85 | @section Hello World |
---|
86 | |
---|
87 | This sample application is in the following directory: |
---|
88 | |
---|
89 | @example |
---|
90 | $@{RTEMS_ROOT@}/testsuites/samples/hello/ |
---|
91 | @end example |
---|
92 | |
---|
93 | It provides a rudimentary test of the BSP start up |
---|
94 | code and the console output routine. The C version of this |
---|
95 | sample application uses the printf function from the RTEMS |
---|
96 | Standard C Library to output messages. The Ada version of this |
---|
97 | sample use the TEXT_IO package to output the hello messages. |
---|
98 | The following messages are printed: |
---|
99 | |
---|
100 | @example |
---|
101 | @group |
---|
102 | *** HELLO WORLD TEST *** |
---|
103 | Hello World |
---|
104 | *** END OF HELLO WORLD TEST *** |
---|
105 | @end group |
---|
106 | @end example |
---|
107 | |
---|
108 | These messages are printed from the application's |
---|
109 | single initialization task. If the above messages are not |
---|
110 | printed correctly, then either the BSP start up code or the |
---|
111 | console output routine is not operating properly. |
---|
112 | |
---|
113 | @section Clock Tick |
---|
114 | |
---|
115 | This sample application is in the following directory: |
---|
116 | |
---|
117 | @example |
---|
118 | $@{RTEMS_ROOT@}/testsuites/samples/ticker/ |
---|
119 | @end example |
---|
120 | |
---|
121 | This application is designed as a simple test of the |
---|
122 | clock tick device driver. In addition, this application also |
---|
123 | tests the printf function from the RTEMS Standard C Library by |
---|
124 | using it to output the following messages: |
---|
125 | |
---|
126 | @example |
---|
127 | @group |
---|
128 | *** CLOCK TICK TEST *** |
---|
129 | TA1 - tm_get - 09:00:00 12/31/1988 |
---|
130 | TA2 - tm_get - 09:00:00 12/31/1988 |
---|
131 | TA3 - tm_get - 09:00:00 12/31/1988 |
---|
132 | TA1 - tm_get - 09:00:05 12/31/1988 |
---|
133 | TA1 - tm_get - 09:00:10 12/31/1988 |
---|
134 | TA2 - tm_get - 09:00:10 12/31/1988 |
---|
135 | TA1 - tm_get - 09:00:15 12/31/1988 |
---|
136 | TA3 - tm_get - 09:00:15 12/31/1988 |
---|
137 | TA1 - tm_get - 09:00:20 12/31/1988 |
---|
138 | TA2 - tm_get - 09:00:20 12/31/1988 |
---|
139 | TA1 - tm_get - 09:00:25 12/31/1988 |
---|
140 | TA1 - tm_get - 09:00:30 12/31/1988 |
---|
141 | TA2 - tm_get - 09:00:30 12/31/1988 |
---|
142 | TA3 - tm_get - 09:00:30 12/31/1988 |
---|
143 | *** END OF CLOCK TICK TEST *** |
---|
144 | @end group |
---|
145 | @end example |
---|
146 | |
---|
147 | The clock tick sample application utilizes a single |
---|
148 | initialization task and three copies of the single application |
---|
149 | task. The initialization task prints the test herald, sets the |
---|
150 | time and date, and creates and starts the three application |
---|
151 | tasks before deleting itself. The three application tasks |
---|
152 | generate the rest of the output. Every five seconds, one or |
---|
153 | more of the tasks will print the current time obtained via the |
---|
154 | tm_get directive. The first task, TA1, executes every five |
---|
155 | seconds, the second task, TA2, every ten seconds, and the third |
---|
156 | task, TA3, every fifteen seconds. If the time printed does not |
---|
157 | match the above output, then the clock device driver is not |
---|
158 | operating properly. |
---|
159 | |
---|
160 | @section Base Single Processor Application |
---|
161 | |
---|
162 | This sample application is in the following directory: |
---|
163 | |
---|
164 | @example |
---|
165 | $@{RTEMS_ROOT@}/testsuites/samples/base_sp/ |
---|
166 | @end example |
---|
167 | |
---|
168 | It provides a framework from which a single processor |
---|
169 | RTEMS application can be developed. The use of the task argument |
---|
170 | is illustrated. This sample application uses the printf |
---|
171 | function from the RTEMS Standard C Library or TEXT_IO functions |
---|
172 | when using the Ada version to output the following messages: |
---|
173 | |
---|
174 | @example |
---|
175 | @group |
---|
176 | *** SAMPLE SINGLE PROCESSOR APPLICATION *** |
---|
177 | Creating and starting an application task |
---|
178 | Application task was invoked with argument (0) and has id of 0x10002 |
---|
179 | *** END OF SAMPLE SINGLE PROCESSOR APPLICATION *** |
---|
180 | @end group |
---|
181 | @end example |
---|
182 | |
---|
183 | The first two messages are printed from the |
---|
184 | application's single initialization task. The final messages |
---|
185 | are printed from the single application task. |
---|
186 | |
---|
187 | @section Base Multiple Processor Application |
---|
188 | |
---|
189 | This sample application is in the following directory: |
---|
190 | |
---|
191 | @example |
---|
192 | $@{RTEMS_ROOT@}/testsuites/samples/base_mp/ |
---|
193 | @end example |
---|
194 | |
---|
195 | It provides a framework from which a multiprocessor |
---|
196 | RTEMS application can be developed. This directory has a |
---|
197 | subdirectory for each node in the multiprocessor system. The |
---|
198 | task argument is used to distinguish the node on which the |
---|
199 | application task is executed. The first node will print the |
---|
200 | following messages: |
---|
201 | |
---|
202 | @example |
---|
203 | @group |
---|
204 | *** SAMPLE MULTIPROCESSOR APPLICATION *** |
---|
205 | Creating and starting an application task |
---|
206 | This task was invoked with the node argument (1) |
---|
207 | This task has the id of 0x10002 |
---|
208 | *** END OF SAMPLE MULTIPROCESSOR APPLICATION *** |
---|
209 | @end group |
---|
210 | @end example |
---|
211 | |
---|
212 | The second node will print the following messages: |
---|
213 | |
---|
214 | @example |
---|
215 | @group |
---|
216 | *** SAMPLE MULTIPROCESSOR APPLICATION *** |
---|
217 | Creating and starting an application task |
---|
218 | This task was invoked with the node argument (2) |
---|
219 | This task has the id of 0x20002 |
---|
220 | *** END OF SAMPLE MULTIPROCESSOR APPLICATION *** |
---|
221 | @end group |
---|
222 | @end example |
---|
223 | |
---|
224 | The herald is printed from the application's single |
---|
225 | initialization task on each node. The final messages are |
---|
226 | printed from the single application task on each node. |
---|
227 | |
---|
228 | In this sample application, all source code is shared |
---|
229 | between the nodes except for the node dependent configuration |
---|
230 | files. These files contains the definition of the node number |
---|
231 | used in the initialization of the RTEMS Multiprocessor |
---|
232 | Configuration Table. This file is not shared because the node |
---|
233 | number field in the RTEMS Multiprocessor Configuration Table |
---|
234 | must be unique on each node. |
---|
235 | |
---|
236 | @section Constructor/Destructor C++ Application |
---|
237 | |
---|
238 | This sample application is in the following directory: |
---|
239 | |
---|
240 | @example |
---|
241 | $@{RTEMS_ROOT@}/testsuites/samples/cdtest/ |
---|
242 | @end example |
---|
243 | |
---|
244 | This sample application demonstrates that RTEMS is |
---|
245 | compatible with C++ applications. It uses constructors, |
---|
246 | destructor, and I/O stream output in testing these various |
---|
247 | capabilities. The board support package responsible for this |
---|
248 | application must support a C++ environment. |
---|
249 | |
---|
250 | This sample application uses the printf function from |
---|
251 | the RTEMS Standard C Library to output the following messages: |
---|
252 | |
---|
253 | @example |
---|
254 | @group |
---|
255 | Hey I'M in base class constructor number 1 for 0x400010cc. |
---|
256 | Hey I'M in base class constructor number 2 for 0x400010d4. |
---|
257 | Hey I'M in derived class constructor number 3 for 0x400010d4. |
---|
258 | *** CONSTRUCTOR/DESTRUCTOR TEST *** |
---|
259 | Hey I'M in base class constructor number 4 for 0x4009ee08. |
---|
260 | Hey I'M in base class constructor number 5 for 0x4009ee10. |
---|
261 | Hey I'M in base class constructor number 6 for 0x4009ee18. |
---|
262 | Hey I'M in base class constructor number 7 for 0x4009ee20. |
---|
263 | Hey I'M in derived class constructor number 8 for 0x4009ee20. |
---|
264 | Testing a C++ I/O stream |
---|
265 | Hey I'M in derived class constructor number 8 for 0x4009ee20. |
---|
266 | Derived class - Instantiation order 8 |
---|
267 | Hey I'M in base class constructor number 7 for 0x4009ee20. |
---|
268 | Instantiation order 8 |
---|
269 | Hey I'M in base class constructor number 6 for 0x4009ee18. |
---|
270 | Instantiation order 6 |
---|
271 | Hey I'M in base class constructor number 5 for 0x4009ee10. |
---|
272 | Instantiation order 5 |
---|
273 | Hey I'M in base class constructor number 4 for 0x4009ee08. |
---|
274 | Instantiation order 5 |
---|
275 | *** END OF CONSTRUCTOR/DESTRUCTOR TEST *** |
---|
276 | Hey I'M in base class constructor number 3 for 0x400010d4. |
---|
277 | Hey I'M in base class constructor number 2 for 0x400010d4. |
---|
278 | Hey I'M in base class constructor number 1 for 0x400010cc. |
---|
279 | @end group |
---|
280 | @end example |
---|
281 | |
---|
282 | @section Minimum Size Test |
---|
283 | |
---|
284 | This sample application is in the following directory: |
---|
285 | |
---|
286 | @example |
---|
287 | $@{RTEMS_ROOT@}/testsuites/samples/minimum/ |
---|
288 | @end example |
---|
289 | |
---|
290 | This sample application is designed to produce the |
---|
291 | minimum code space required for any RTEMS application |
---|
292 | based upon the current RTEMS configuration and |
---|
293 | BSP. In many situations, the bulk of this executable |
---|
294 | consists of hardware and RTEMS initialization, basic |
---|
295 | infrastructure such as malloc(), and RTEMS and |
---|
296 | hardware shutdown support. |
---|
297 | |
---|
298 | @section Paranoia Floating Point Application |
---|
299 | |
---|
300 | This sample application is in the following directory: |
---|
301 | |
---|
302 | @example |
---|
303 | $@{RTEMS_ROOT@}/testsuites/samples/paranoia/ |
---|
304 | @end example |
---|
305 | |
---|
306 | This sample application uses a public domain floating |
---|
307 | point and math library test to verify these capabilities of the |
---|
308 | RTEMS executive. Deviations between actual and expected results |
---|
309 | are reported to the screen. This is a very extensive test which |
---|
310 | tests all mathematical and number conversion functions. |
---|
311 | Paranoia is also very large and requires a long period of time |
---|
312 | to run. Problems which commonly prevent this test from |
---|
313 | executing to completion include stack overflow and FPU exception |
---|
314 | handlers not installed. |
---|
315 | |
---|
316 | @section Network Loopback Test |
---|
317 | |
---|
318 | This sample application is in the following directory: |
---|
319 | |
---|
320 | @example |
---|
321 | $@{RTEMS_ROOT@}/testsuites/samples/loopback/ |
---|
322 | @end example |
---|
323 | |
---|
324 | This sample application uses the network loopback device to |
---|
325 | demonstrate the use of the RTEMS TCP/IP stack. This sample |
---|
326 | test illustrates the basic configuration and initialization |
---|
327 | of the TCP/IP stack as well as simple socket usage. |
---|
328 | |
---|