source: rtems-docs/develenv/sample.rst @ 46498bd

4.115
Last change on this file since 46498bd was c0d6eff6, checked in by Amar Takhar <verm@…>, on 01/16/16 at 19:53:40

Split document.

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