1 |
1026 |
ivang |
@c
|
2 |
|
|
@c COPYRIGHT (c) 1988-2002.
|
3 |
|
|
@c On-Line Applications Research Corporation (OAR).
|
4 |
|
|
@c All rights reserved.
|
5 |
|
|
@c
|
6 |
|
|
@c sample.texi,v 1.7 2002/01/17 21:47:44 joel Exp
|
7 |
|
|
@c
|
8 |
|
|
|
9 |
|
|
@ifinfo
|
10 |
|
|
@node Sample Applications, Sample Applications Introduction, Test Suite Source Directory, Top
|
11 |
|
|
@end ifinfo
|
12 |
|
|
@chapter Sample Applications
|
13 |
|
|
@ifinfo
|
14 |
|
|
@menu
|
15 |
|
|
* Sample Applications Introduction::
|
16 |
|
|
* Sample Applications Hello World::
|
17 |
|
|
* Sample Applications Clock Tick::
|
18 |
|
|
* Sample Applications Base Single Processor Application::
|
19 |
|
|
* Sample Applications Base Multiple Processor Application::
|
20 |
|
|
* Sample Applications Constructor/Destructor C++ Application::
|
21 |
|
|
* Sample Applications Paranoia Floating Point Application::
|
22 |
|
|
@end menu
|
23 |
|
|
@end ifinfo
|
24 |
|
|
|
25 |
|
|
@ifinfo
|
26 |
|
|
@node Sample Applications Introduction, Sample Applications Hello World, Sample Applications, Sample Applications
|
27 |
|
|
@end ifinfo
|
28 |
|
|
@section Introduction
|
29 |
|
|
|
30 |
|
|
RTEMS is shipped with the following sample applications:
|
31 |
|
|
|
32 |
|
|
@itemize @bullet
|
33 |
|
|
@item Hello World - C and Ada
|
34 |
|
|
|
35 |
|
|
@item Clock Tick - C and Ada
|
36 |
|
|
|
37 |
|
|
@item Base Single Processor - C and Ada
|
38 |
|
|
|
39 |
|
|
@item Base Multiple Processor - C and Ada
|
40 |
|
|
|
41 |
|
|
@item Constructor/Destructor C++ Test - C only if C++
|
42 |
|
|
enabled
|
43 |
|
|
|
44 |
|
|
@item Paranoia Floating Point Test - C only
|
45 |
|
|
@end itemize
|
46 |
|
|
|
47 |
|
|
These applications are intended to illustrate the
|
48 |
|
|
basic format of RTEMS single and multiple processor
|
49 |
|
|
applications. In addition, these relatively simple applications
|
50 |
|
|
can be used to test locally developed board support packages and
|
51 |
|
|
device drivers.
|
52 |
|
|
|
53 |
|
|
The reader should be familiar with the terms used and
|
54 |
|
|
material presented in the RTEMS Applications User's Guide.
|
55 |
|
|
|
56 |
|
|
@ifinfo
|
57 |
|
|
@node Sample Applications Hello World, Sample Applications Clock Tick, Sample Applications Introduction, Sample Applications
|
58 |
|
|
@end ifinfo
|
59 |
|
|
@section Hello World
|
60 |
|
|
|
61 |
|
|
This sample application is in the following directory:
|
62 |
|
|
|
63 |
|
|
@example
|
64 |
|
|
$RTEMS_SRC_BASE/tests/samples/hello
|
65 |
|
|
@end example
|
66 |
|
|
|
67 |
|
|
It provides a rudimentary test of the BSP start up
|
68 |
|
|
code and the console output routine. The C version of this
|
69 |
|
|
sample application uses the printf function from the RTEMS
|
70 |
|
|
Standard C Library to output messages. The Ada version of this
|
71 |
|
|
sample use the TEXT_IO package to output the hello messages.
|
72 |
|
|
The following messages are printed:
|
73 |
|
|
|
74 |
|
|
@example
|
75 |
|
|
@group
|
76 |
|
|
*** HELLO WORLD TEST ***
|
77 |
|
|
Hello World
|
78 |
|
|
*** END OF HELLO WORLD TEST ***
|
79 |
|
|
@end group
|
80 |
|
|
@end example
|
81 |
|
|
|
82 |
|
|
These messages are printed from the application's
|
83 |
|
|
single initialization task. If the above messages are not
|
84 |
|
|
printed correctly, then either the BSP start up code or the
|
85 |
|
|
console output routine is not operating properly.
|
86 |
|
|
|
87 |
|
|
@ifinfo
|
88 |
|
|
@node Sample Applications Clock Tick, Sample Applications Base Single Processor Application, Sample Applications Hello World, Sample Applications
|
89 |
|
|
@end ifinfo
|
90 |
|
|
@section Clock Tick
|
91 |
|
|
|
92 |
|
|
This sample application is in the following directory:
|
93 |
|
|
|
94 |
|
|
@example
|
95 |
|
|
$RTEMS_SRC_BASE/tests/samples/ticker
|
96 |
|
|
@end example
|
97 |
|
|
|
98 |
|
|
This application is designed as a simple test of the
|
99 |
|
|
clock tick device driver. In addition, this application also
|
100 |
|
|
tests the printf function from the RTEMS Standard C Library by
|
101 |
|
|
using it to output the following messages:
|
102 |
|
|
|
103 |
|
|
@example
|
104 |
|
|
@group
|
105 |
|
|
*** CLOCK TICK TEST ***
|
106 |
|
|
TA1 - tm_get - 09:00:00 12/31/1988
|
107 |
|
|
TA2 - tm_get - 09:00:00 12/31/1988
|
108 |
|
|
TA3 - tm_get - 09:00:00 12/31/1988
|
109 |
|
|
TA1 - tm_get - 09:00:05 12/31/1988
|
110 |
|
|
TA1 - tm_get - 09:00:10 12/31/1988
|
111 |
|
|
TA2 - tm_get - 09:00:10 12/31/1988
|
112 |
|
|
TA1 - tm_get - 09:00:15 12/31/1988
|
113 |
|
|
TA3 - tm_get - 09:00:15 12/31/1988
|
114 |
|
|
TA1 - tm_get - 09:00:20 12/31/1988
|
115 |
|
|
TA2 - tm_get - 09:00:20 12/31/1988
|
116 |
|
|
TA1 - tm_get - 09:00:25 12/31/1988
|
117 |
|
|
TA1 - tm_get - 09:00:30 12/31/1988
|
118 |
|
|
TA2 - tm_get - 09:00:30 12/31/1988
|
119 |
|
|
TA3 - tm_get - 09:00:30 12/31/1988
|
120 |
|
|
*** END OF CLOCK TICK TEST ***
|
121 |
|
|
@end group
|
122 |
|
|
@end example
|
123 |
|
|
|
124 |
|
|
The clock tick sample application utilizes a single
|
125 |
|
|
initialization task and three copies of the single application
|
126 |
|
|
task. The initialization task prints the test herald, sets the
|
127 |
|
|
time and date, and creates and starts the three application
|
128 |
|
|
tasks before deleting itself. The three application tasks
|
129 |
|
|
generate the rest of the output. Every five seconds, one or
|
130 |
|
|
more of the tasks will print the current time obtained via the
|
131 |
|
|
tm_get directive. The first task, TA1, executes every five
|
132 |
|
|
seconds, the second task, TA2, every ten seconds, and the third
|
133 |
|
|
task, TA3, every fifteen seconds. If the time printed does not
|
134 |
|
|
match the above output, then the clock device driver is not
|
135 |
|
|
operating properly.
|
136 |
|
|
|
137 |
|
|
@ifinfo
|
138 |
|
|
@node Sample Applications Base Single Processor Application, Sample Applications Base Multiple Processor Application, Sample Applications Clock Tick, Sample Applications
|
139 |
|
|
@end ifinfo
|
140 |
|
|
@section Base Single Processor Application
|
141 |
|
|
|
142 |
|
|
This sample application is in the following directory:
|
143 |
|
|
|
144 |
|
|
@example
|
145 |
|
|
$RTEMS_SRC_BASE/tests/samples/base_sp
|
146 |
|
|
@end example
|
147 |
|
|
|
148 |
|
|
It provides a framework from which a single processor
|
149 |
|
|
RTEMS application can be developed. The use of the task argument
|
150 |
|
|
is illustrated. This sample application uses the printf
|
151 |
|
|
function from the RTEMS Standard C Library or TEXT_IO functions
|
152 |
|
|
when using the Ada version to output the following messages:
|
153 |
|
|
|
154 |
|
|
@example
|
155 |
|
|
@group
|
156 |
|
|
*** SAMPLE SINGLE PROCESSOR APPLICATION ***
|
157 |
|
|
Creating and starting an application task
|
158 |
|
|
Application task was invoked with argument (0) and has id of 0x10002
|
159 |
|
|
*** END OF SAMPLE SINGLE PROCESSOR APPLICATION ***
|
160 |
|
|
@end group
|
161 |
|
|
@end example
|
162 |
|
|
|
163 |
|
|
The first two messages are printed from the
|
164 |
|
|
application's single initialization task. The final messages
|
165 |
|
|
are printed from the single application task.
|
166 |
|
|
|
167 |
|
|
@ifinfo
|
168 |
|
|
@node Sample Applications Base Multiple Processor Application, Sample Applications Constructor/Destructor C++ Application, Sample Applications Base Single Processor Application, Sample Applications
|
169 |
|
|
@end ifinfo
|
170 |
|
|
@section Base Multiple Processor Application
|
171 |
|
|
|
172 |
|
|
This sample application is in the following directory:
|
173 |
|
|
|
174 |
|
|
@example
|
175 |
|
|
$RTEMS_SRC_BASE/tests/samples/base_mp
|
176 |
|
|
@end example
|
177 |
|
|
|
178 |
|
|
It provides a framework from which a multiprocessor
|
179 |
|
|
RTEMS application can be developed. This directory has a
|
180 |
|
|
subdirectory for each node in the multiprocessor system. The
|
181 |
|
|
task argument is used to distinguish the node on which the
|
182 |
|
|
application task is executed. The first node will print the
|
183 |
|
|
following messages:
|
184 |
|
|
|
185 |
|
|
@example
|
186 |
|
|
@group
|
187 |
|
|
*** SAMPLE MULTIPROCESSOR APPLICATION ***
|
188 |
|
|
Creating and starting an application task
|
189 |
|
|
This task was invoked with the node argument (1)
|
190 |
|
|
This task has the id of 0x10002
|
191 |
|
|
*** END OF SAMPLE MULTIPROCESSOR APPLICATION ***
|
192 |
|
|
@end group
|
193 |
|
|
@end example
|
194 |
|
|
|
195 |
|
|
The second node will print the following messages:
|
196 |
|
|
|
197 |
|
|
@example
|
198 |
|
|
@group
|
199 |
|
|
*** SAMPLE MULTIPROCESSOR APPLICATION ***
|
200 |
|
|
Creating and starting an application task
|
201 |
|
|
This task was invoked with the node argument (2)
|
202 |
|
|
This task has the id of 0x20002
|
203 |
|
|
*** END OF SAMPLE MULTIPROCESSOR APPLICATION ***
|
204 |
|
|
@end group
|
205 |
|
|
@end example
|
206 |
|
|
|
207 |
|
|
The herald is printed from the application's single
|
208 |
|
|
initialization task on each node. The final messages are
|
209 |
|
|
printed from the single application task on each node.
|
210 |
|
|
|
211 |
|
|
In this sample application, all source code is shared
|
212 |
|
|
between the nodes except for the node dependent configuration
|
213 |
|
|
files. These files contains the definition of the node number
|
214 |
|
|
used in the initialization of the RTEMS Multiprocessor
|
215 |
|
|
Configuration Table. This file is not shared because the node
|
216 |
|
|
number field in the RTEMS Multiprocessor Configuration Table
|
217 |
|
|
must be unique on each node.
|
218 |
|
|
|
219 |
|
|
@ifinfo
|
220 |
|
|
@node Sample Applications Constructor/Destructor C++ Application, Sample Applications Paranoia Floating Point Application, Sample Applications Base Multiple Processor Application, Sample Applications
|
221 |
|
|
@end ifinfo
|
222 |
|
|
@section Constructor/Destructor C++ Application
|
223 |
|
|
|
224 |
|
|
This sample application is in the following directory:
|
225 |
|
|
|
226 |
|
|
@example
|
227 |
|
|
$RTEMS_SRC_BASE/tests/samples/cdtest
|
228 |
|
|
@end example
|
229 |
|
|
|
230 |
|
|
This sample application demonstrates that RTEMS is
|
231 |
|
|
compatible with C++ applications. It uses constructors,
|
232 |
|
|
destructor, and I/O stream output in testing these various
|
233 |
|
|
capabilities. The board support package responsible for this
|
234 |
|
|
application must support a C++ environment.
|
235 |
|
|
|
236 |
|
|
This sample application uses the printf function from
|
237 |
|
|
the RTEMS Standard C Library to output the following messages:
|
238 |
|
|
|
239 |
|
|
@example
|
240 |
|
|
@group
|
241 |
|
|
Hey I'M in base class constructor number 1 for 0x400010cc.
|
242 |
|
|
Hey I'M in base class constructor number 2 for 0x400010d4.
|
243 |
|
|
Hey I'M in derived class constructor number 3 for 0x400010d4.
|
244 |
|
|
*** CONSTRUCTOR/DESTRUCTOR TEST ***
|
245 |
|
|
Hey I'M in base class constructor number 4 for 0x4009ee08.
|
246 |
|
|
Hey I'M in base class constructor number 5 for 0x4009ee10.
|
247 |
|
|
Hey I'M in base class constructor number 6 for 0x4009ee18.
|
248 |
|
|
Hey I'M in base class constructor number 7 for 0x4009ee20.
|
249 |
|
|
Hey I'M in derived class constructor number 8 for 0x4009ee20.
|
250 |
|
|
Testing a C++ I/O stream
|
251 |
|
|
Hey I'M in derived class constructor number 8 for 0x4009ee20.
|
252 |
|
|
Derived class - Instantiation order 8
|
253 |
|
|
Hey I'M in base class constructor number 7 for 0x4009ee20.
|
254 |
|
|
Instantiation order 8
|
255 |
|
|
Hey I'M in base class constructor number 6 for 0x4009ee18.
|
256 |
|
|
Instantiation order 6
|
257 |
|
|
Hey I'M in base class constructor number 5 for 0x4009ee10.
|
258 |
|
|
Instantiation order 5
|
259 |
|
|
Hey I'M in base class constructor number 4 for 0x4009ee08.
|
260 |
|
|
Instantiation order 5
|
261 |
|
|
*** END OF CONSTRUCTOR/DESTRUCTOR TEST ***
|
262 |
|
|
Hey I'M in base class constructor number 3 for 0x400010d4.
|
263 |
|
|
Hey I'M in base class constructor number 2 for 0x400010d4.
|
264 |
|
|
Hey I'M in base class constructor number 1 for 0x400010cc.
|
265 |
|
|
@end group
|
266 |
|
|
@end example
|
267 |
|
|
|
268 |
|
|
@ifinfo
|
269 |
|
|
@node Sample Applications Paranoia Floating Point Application, RTEMS Specific Utilities, Sample Applications Constructor/Destructor C++ Application, Sample Applications
|
270 |
|
|
@end ifinfo
|
271 |
|
|
@section Paranoia Floating Point Application
|
272 |
|
|
|
273 |
|
|
This sample application is in the following directory:
|
274 |
|
|
|
275 |
|
|
@example
|
276 |
|
|
$RTEMS_SRC_BASE/tests/samples/paranoia
|
277 |
|
|
@end example
|
278 |
|
|
|
279 |
|
|
This sample application uses a public domain floating
|
280 |
|
|
point and math library test to verify these capabilities of the
|
281 |
|
|
RTEMS executive. Deviations between actual and expected results
|
282 |
|
|
are reported to the screen. This is a very extensive test which
|
283 |
|
|
tests all mathematical and number conversion functions.
|
284 |
|
|
Paranoia is also very large and requires a long period of time
|
285 |
|
|
to run. Problems which commonly prevent this test from
|
286 |
|
|
executing to completion include stack overflow and FPU exception
|
287 |
|
|
handlers not installed.
|