source: rtems-docs/develenv/sample.rst @ 969e60e

5
Last change on this file since 969e60e was 5fe847f, checked in by Chris Johns <chrisj@…>, on 11/09/16 at 02:57:54

develenv: Fix header levels.

  • Property mode set to 100644
File size: 15.8 KB
Line 
1.. comment SPDX-License-Identifier: CC-BY-SA-4.0
2
3Sample Applications
4*******************
5
6Introduction
7============
8
9The RTEMS source distribution includes a set of sample applications that are
10located in the ``${RTEMS_ROOT}/testsuites/samples/`` directory.  These
11applications are intended to illustrate the basic format of RTEMS single and
12multiple processor applications and the use of some features.  In addition,
13these relatively simple applications can be used to test locally developed
14board support packages and device drivers as they exercise a critical subset of
15RTEMS functionality that is often broken in new BSPs.
16
17Some of the following sample applications will be covered in more detail in
18subsequent sections:
19
20*Hello World*
21    The RTEMS Hello World test is provided in the subdirectory
22    ``${RTEMS_ROOT}/testsuites/samples/hello/``.  This test is helpful when
23    testing new RTEMS development environment.
24
25*Clock Tick*
26    The ``${RTEMS_ROOT}/testsuites/samples/ticker/`` subdirectory provides a
27    test for verification of clock chip device drivers of BSPs.
28
29*Base Single Processor*
30    A simple single processor test similar to those in the single processor
31    test suite is provided in ``${RTEMS_ROOT}/testsuites/samples/base_sp/``.
32
33*Base Multiple Processor*
34    A simple two node multiprocessor test capable of testing an newly developed
35    MPCI layer is provided in ``${RTEMS_ROOT}/testsuites/samples/base_mp/``.
36
37*Capture*
38    The RTEMS Capture test is provided in the subdirectory
39    ``${RTEMS_ROOT}/testsuites/samples/capture/``.  This is an interactive test
40    which demonstrates the capabilities of the RTEMS Capture Engine.  It
41    includes a few test threads which generate interesting execution patterns.
42    Look at the file ``${RTEMS_ROOT}/testsuites/samples/capture/capture.scn``
43    for a sample session.
44
45*Constructor/Destructor C++ Test*
46    The ``${RTEMS_ROOT}/testsuites/samples/cdtest/`` subdirectory provides a
47    simple C++ application using constructors and destructors.  It is only
48    built when C++ is enabled and its primary purpose is to demonstrate that
49    global constructors and destructors work.  Since this requires that the
50    linker script for your BSP be correct, this is an important test.
51
52*File IO*
53    The RTEMS File IO test is provided in the subdirectory
54    ``${RTEMS_ROOT}/testsuites/samples/fileio/``.  This is an interactive test
55    which allows the user to interact with an ATA/IDE device.  It will read the
56    partition table and allow the user to dynamically mount one of the FAT32
57    partitions it finds.  Commands are also provided to write and read files on
58    the disk.
59
60*IO Stream*
61    The RTEMS IO Stream test is provided in the subdirectory
62    ``${RTEMS_ROOT}/testsuites/samples/iostream/``.  This test is a simple C++
63    application which demonstrates that C++ iostreams are functional. This
64    requires that the RTEMS C++ run-time support is functioning properly.  This
65    test is only build when C++ is enabled.
66
67*Network Loopback Test*
68    The ``${RTEMS_ROOT}/testsuites/samples/loopback/`` directory contains a
69    sample test that demonstrates the use of sockets and the loopback network
70    device.  It does not require the presence of network hardware in order to
71    run.  It is only built if RTEMS was configured with networking enabled.
72
73*Minimum Size Test*
74    The directory ``${RTEMS_ROOT}/testsuites/samples/minimum/`` contains a
75    simple RTEMS program that results in a non-functional executable.  It is
76    intended to show the size of a minimum footprint application based upon the
77    current RTEMS configuration.
78
79*Nanoseconds*
80    The RTEMS Nanoseconds test is provided in the subdirectory
81    ``${RTEMS_ROOT}/testsuites/samples/nsecs/``.  This test demonstrates that
82    the BSP has support for nanosecond timestamp granularity.  It prints the
83    time of day and uptime multiple times as quickly as possible.  It should be
84    possible from the output to determine if your BSP has nanosecond accurate
85    clock support and it is functional.
86
87*Paranoia Floating Point Test*
88    The directory ``${RTEMS_ROOT}/testsuites/samples/paranoia/`` contains the
89    public domain floating point and math library test.
90
91*Point-to-Point Protocol Daemon*
92    The RTEMS Point-to-Point Protocol Daemon test is provided in the
93    subdirectory ``${RTEMS_ROOT}/testsuites/samples/pppd/``.  This test
94    primarily serves as the baseline for a user application using the PPP
95    protocol.
96
97*Unlimited Object Allocation*
98    The ``${RTEMS_ROOT}/testsuites/samples/unlimited/`` directory contains a
99    sample test that demonstrates the use of the*unlimited* object allocation
100    configuration option to RTEMS.
101
102The sample tests are written using the Classic API so the reader should be
103familiar with the terms used and material presented in the *RTEMS Applications
104Users Guide*.
105
106Hello World
107===========
108
109This sample application is in the following directory:
110
111.. code-block:: shell
112
113    ${RTEMS_ROOT}/testsuites/samples/hello/
114
115It provides a rudimentary test of the BSP start up code and the console output
116routine.  The C version of this sample application uses the printf function
117from the RTEMS Standard C Library to output messages.  The Ada version of this
118sample uses the TEXT_IO package to output the hello messages.  The following
119messages are printed:
120
121.. code-block:: shell
122
123    *** HELLO WORLD TEST ***
124    Hello World
125    *** END OF HELLO WORLD TEST ***
126
127These messages are printed from the application's single initialization task.
128If the above messages are not printed correctly, then either the BSP start up
129code or the console output routine is not operating properly.
130
131Clock Tick
132==========
133
134This sample application is in the following directory:
135
136.. code-block:: shell
137
138    ${RTEMS_ROOT}/testsuites/samples/ticker/
139
140This application is designed as a simple test of the clock tick device driver.
141In addition, this application also tests the printf function from the RTEMS
142Standard C Library by using it to output the following messages:
143
144.. code-block:: shell
145
146    *** CLOCK TICK TEST ***
147    TA1 - tm_get - 09:00:00   12/31/1988
148    TA2 - tm_get - 09:00:00   12/31/1988
149    TA3 - tm_get - 09:00:00   12/31/1988
150    TA1 - tm_get - 09:00:05   12/31/1988
151    TA1 - tm_get - 09:00:10   12/31/1988
152    TA2 - tm_get - 09:00:10   12/31/1988
153    TA1 - tm_get - 09:00:15   12/31/1988
154    TA3 - tm_get - 09:00:15   12/31/1988
155    TA1 - tm_get - 09:00:20   12/31/1988
156    TA2 - tm_get - 09:00:20   12/31/1988
157    TA1 - tm_get - 09:00:25   12/31/1988
158    TA1 - tm_get - 09:00:30   12/31/1988
159    TA2 - tm_get - 09:00:30   12/31/1988
160    TA3 - tm_get - 09:00:30   12/31/1988
161    *** END OF CLOCK TICK TEST ***
162
163The clock tick sample application utilizes a single initialization task and
164three copies of the single application task.  The initialization task prints
165the test herald, sets the time and date, and creates and starts the three
166application tasks before deleting itself.  The three application tasks generate
167the rest of the output.  Every five seconds, one or more of the tasks will
168print the current time obtained via the tm_get directive.  The first task, TA1,
169executes every five seconds, the second task, TA2, every ten seconds, and the
170third task, TA3, every fifteen seconds. If the time printed does not match the
171above output, then the clock device driver is not operating properly.
172
173Base Single Processor Application
174=================================
175
176This sample application is in the following directory:
177
178.. code-block:: shell
179
180    ${RTEMS_ROOT}/testsuites/samples/base_sp/
181
182It provides a framework from which a single processor RTEMS application can be
183developed. The use of the task argument is illustrated.  This sample
184application uses the printf function from the RTEMS Standard C Library or
185TEXT_IO functions when using the Ada version to output the following messages:
186
187.. code-block:: shell
188
189    *** SAMPLE SINGLE PROCESSOR APPLICATION ***
190    Creating and starting an application task
191    Application task was invoked with argument (0) and has id of 0x10002
192    *** END OF SAMPLE SINGLE PROCESSOR APPLICATION ***
193
194The first two messages are printed from the application's single initialization
195task.  The final messages are printed from the single application task.
196
197Base Multiple Processor Application
198===================================
199
200This sample application is in the following directory:
201
202.. code-block:: shell
203
204    ${RTEMS_ROOT}/testsuites/samples/base_mp/
205
206It provides a framework from which a multiprocessor RTEMS application can be
207developed. This directory has a subdirectory for each node in the
208multiprocessor system.  The task argument is used to distinguish the node on
209which the application task is executed.  The first node will print the
210following messages:
211
212.. code-block:: shell
213
214    *** SAMPLE MULTIPROCESSOR APPLICATION ***
215    Creating and starting an application task
216    This task was invoked with the node argument (1)
217    This task has the id of 0x10002
218    *** END OF SAMPLE MULTIPROCESSOR APPLICATION ***
219
220The second node will print the following messages:
221
222.. code-block:: shell
223
224    *** SAMPLE MULTIPROCESSOR APPLICATION ***
225    Creating and starting an application task
226    This task was invoked with the node argument (2)
227    This task has the id of 0x20002
228    *** END OF SAMPLE MULTIPROCESSOR APPLICATION ***
229
230The herald is printed from the application's single initialization task on each
231node.  The final messages are printed from the single application task on each
232node.
233
234In this sample application, all source code is shared between the nodes except
235for the node dependent configuration files.  These files contains the
236definition of the node number used in the initialization of the RTEMS
237Multiprocessor Configuration Table. This file is not shared because the node
238number field in the RTEMS Multiprocessor Configuration Table must be unique on
239each node.
240
241Constructor/Destructor C++ Application
242======================================
243
244This sample application is in the following directory:
245
246.. code-block:: shell
247
248    ${RTEMS_ROOT}/testsuites/samples/cdtest/
249
250This sample application demonstrates that RTEMS is compatible with C++
251applications.  It uses constructors, destructor, and I/O stream output in
252testing these various capabilities.  The board support package responsible for
253this application must support a C++ environment.
254
255This sample application uses the printf function from the RTEMS Standard C
256Library to output the following messages:
257
258.. code-block:: shell
259
260    Hey I'M in base class constructor number 1 for 0x400010cc.
261    Hey I'M in base class constructor number 2 for 0x400010d4.
262    Hey I'M in derived class constructor number 3 for 0x400010d4.
263    *** CONSTRUCTOR/DESTRUCTOR TEST ***
264    Hey I'M in base class constructor number 4 for 0x4009ee08.
265    Hey I'M in base class constructor number 5 for 0x4009ee10.
266    Hey I'M in base class constructor number 6 for 0x4009ee18.
267    Hey I'M in base class constructor number 7 for 0x4009ee20.
268    Hey I'M in derived class constructor number 8 for 0x4009ee20.
269    Testing a C++ I/O stream
270    Hey I'M in derived class constructor number 8 for 0x4009ee20.
271    Derived class - Instantiation order 8
272    Hey I'M in base class constructor number 7 for 0x4009ee20.
273    Instantiation order 8
274    Hey I'M in base class constructor number 6 for 0x4009ee18.
275    Instantiation order 6
276    Hey I'M in base class constructor number 5 for 0x4009ee10.
277    Instantiation order 5
278    Hey I'M in base class constructor number 4 for 0x4009ee08.
279    Instantiation order 5
280    *** END OF CONSTRUCTOR/DESTRUCTOR TEST ***
281    Hey I'M in base class constructor number 3 for 0x400010d4.
282    Hey I'M in base class constructor number 2 for 0x400010d4.
283    Hey I'M in base class constructor number 1 for 0x400010cc.
284
285Minimum Size Test
286=================
287
288This sample application is in the following directory:
289
290.. code-block:: shell
291
292    ${RTEMS_ROOT}/testsuites/samples/minimum/
293
294This sample application is designed to produce the minimum code space required
295for any RTEMS application based upon the current RTEMS configuration and BSP.
296In many situations, the bulk of this executable consists of hardware and RTEMS
297initialization, basic infrastructure such as malloc(), and RTEMS and hardware
298shutdown support.
299
300Nanosecond Granularity Application
301==================================
302
303This sample application is in the following directory:
304
305.. code-block:: shell
306
307    ${RTEMS_ROOT}/testsuites/samples/nsecs/
308
309This sample application exercises the Clock Driver for this BSP and
310demonstrates its ability to generate accurate timestamps.  This application
311does this by exercising the time subsystem in three ways:
312
313- Obtain Time of Day Twice Back to Back
314
315- Obtain System Up Time Twice Back to Back
316
317- Use System Up Time to Measure Loops
318
319The following is an example of what the output of this test may appear like:
320
321.. code-block:: shell
322
323    *** NANOSECOND CLOCK TEST ***
324    10 iterations of getting TOD
325    Start: Sat Mar 24 11:15:00 2007:540000
326    Stop : Sat Mar 24 11:15:00 2007:549000 --> 0:9000
327    Start: Sat Mar 24 11:15:00 2007:3974000
328    Stop : Sat Mar 24 11:15:00 2007:3983000 --> 0:9000
329    Start: Sat Mar 24 11:15:00 2007:7510000
330    Stop : Sat Mar 24 11:15:00 2007:7519000 --> 0:9000
331    Start: Sat Mar 24 11:15:00 2007:11054000
332    Stop : Sat Mar 24 11:15:00 2007:11063000 --> 0:9000
333    Start: Sat Mar 24 11:15:00 2007:14638000
334    Stop : Sat Mar 24 11:15:00 2007:14647000 --> 0:9000
335    Start: Sat Mar 24 11:15:00 2007:18301000
336    Stop : Sat Mar 24 11:15:00 2007:18310000 --> 0:9000
337    Start: Sat Mar 24 11:15:00 2007:21901000
338    Stop : Sat Mar 24 11:15:00 2007:21910000 --> 0:9000
339    Start: Sat Mar 24 11:15:00 2007:25526000
340    Stop : Sat Mar 24 11:15:00 2007:25535000 --> 0:9000
341    Start: Sat Mar 24 11:15:00 2007:29196000
342    Stop : Sat Mar 24 11:15:00 2007:29206000 --> 0:10000
343    Start: Sat Mar 24 11:15:00 2007:32826000
344    Stop : Sat Mar 24 11:15:00 2007:32835000 --> 0:9000
345    10 iterations of getting Uptime
346    0:38977000 0:38986000 --> 0:9000
347    0:40324000 0:40332000 --> 0:8000
348    0:41636000 0:41645000 --> 0:9000
349    0:42949000 0:42958000 --> 0:9000
350    0:44295000 0:44304000 --> 0:9000
351    0:45608000 0:45617000 --> 0:9000
352    0:46921000 0:46930000 --> 0:9000
353    0:48282000 0:48291000 --> 0:9000
354    0:49595000 0:49603000 --> 0:8000
355    0:50908000 0:50917000 --> 0:9000
356    10 iterations of getting Uptime with different loop values
357    loop of 10000 0:119488000 0:119704000 --> 0:216000
358    loop of 20000 0:124028000 0:124463000 --> 0:435000
359    loop of 30000 0:128567000 0:129220000 --> 0:653000
360    loop of 40000 0:133097000 0:133964000 --> 0:867000
361    loop of 50000 0:137643000 0:138728000 --> 0:1085000
362    loop of 60000 0:142265000 0:143572000 --> 0:1307000
363    loop of 70000 0:146894000 0:148416000 --> 0:1522000
364    loop of 80000 0:151519000 0:153260000 --> 0:1741000
365    loop of 90000 0:156145000 0:158099000 --> 0:1954000
366    loop of 100000 0:160770000 0:162942000 --> 0:2172000
367    *** END OF NANOSECOND CLOCK TEST ***
368
369Paranoia Floating Point Application
370===================================
371
372This sample application is in the following directory:
373
374.. code-block:: shell
375
376    ${RTEMS_ROOT}/testsuites/samples/paranoia/
377
378This sample application uses a public domain floating point and math library
379test to verify these capabilities of the RTEMS executive.  Deviations between
380actual and expected results are reported to the screen.  This is a very
381extensive test which tests all mathematical and number conversion functions.
382Paranoia is also very large and requires a long period of time to run.
383Problems which commonly prevent this test from executing to completion include
384stack overflow and FPU exception handlers not installed.
385
386Network Loopback Test
387=====================
388
389This sample application is in the following directory:
390
391.. code-block:: shell
392
393    ${RTEMS_ROOT}/testsuites/samples/loopback/
394
395This sample application uses the network loopback device to demonstrate the use
396of the RTEMS TCP/IP stack.  This sample test illustrates the basic
397configuration and initialization of the TCP/IP stack as well as simple socket
398usage.
Note: See TracBrowser for help on using the repository browser.