1 |
1026 |
ivang |
@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 nextstep.t,v 1.3 2002/01/17 21:47:46 joel Exp
|
8 |
|
|
@c
|
9 |
|
|
|
10 |
|
|
@chapter Where To Go From Here
|
11 |
|
|
|
12 |
|
|
At this point, you should have successfully installed a
|
13 |
|
|
GNU C/C++ Cross Compilation Tools for RTEMS on your host system
|
14 |
|
|
as well as the RTEMS OS for the target host. You should
|
15 |
|
|
have successfully linked the "hello world" program. You
|
16 |
|
|
may even have downloaded the executable to that target
|
17 |
|
|
and run it. What do you do next?
|
18 |
|
|
|
19 |
|
|
The answer is that it depends. You may be interested in
|
20 |
|
|
writing an application that uses one of the multiple
|
21 |
|
|
APIs supported by RTEMS. You may need to investigate the
|
22 |
|
|
network or filesystem support in RTEMS. The common
|
23 |
|
|
thread is that you are largely finished with this
|
24 |
|
|
manual and ready to move on to others.
|
25 |
|
|
|
26 |
|
|
Whether or not you decide to dive in now and write
|
27 |
|
|
application code or read some documentation first,
|
28 |
|
|
this chapter is for you. The first section provides
|
29 |
|
|
a quick roadmap of some of the RTEMS documentation.
|
30 |
|
|
The next section provides a brief overview of the
|
31 |
|
|
RTEMS application structure.
|
32 |
|
|
|
33 |
|
|
@section Documentation Overview
|
34 |
|
|
|
35 |
|
|
When writing RTEMS applications, you should find the
|
36 |
|
|
following manuals useful because they define the
|
37 |
|
|
calling interface to many of the services provided
|
38 |
|
|
by RTEMS:
|
39 |
|
|
|
40 |
|
|
@itemize @bullet
|
41 |
|
|
@item @b{RTEMS Applications C User's Guide} describes the
|
42 |
|
|
Classic RTEMS API based on the RTEID specification.
|
43 |
|
|
|
44 |
|
|
@item @b{RTEMS POSIX API User's Guide} describes the
|
45 |
|
|
RTEMS POSIX API that is based on the POSIX 1003.1b API.
|
46 |
|
|
|
47 |
|
|
@item @b{RTEMS ITRON 3.0 API User's Guide} describes
|
48 |
|
|
the RTEMS implementation of the ITRON 3.0 API.
|
49 |
|
|
|
50 |
|
|
@item @b{RTEMS Network Supplement} provides information
|
51 |
|
|
on the network services provided by RTEMS.
|
52 |
|
|
|
53 |
|
|
@end itemize
|
54 |
|
|
|
55 |
|
|
In addition, the following manuals from the GNU C/C++ Cross
|
56 |
|
|
Compilation Toolset include information on run-time services
|
57 |
|
|
available.
|
58 |
|
|
|
59 |
|
|
@itemize @bullet
|
60 |
|
|
@item @b{Cygnus C Support Library} describes the Standard
|
61 |
|
|
C Library functionality provided by Newlib's libc.
|
62 |
|
|
|
63 |
|
|
@item @b{Cygnus C Math Library} describes the Standard
|
64 |
|
|
C Math Library functionality provided by Newlib's libm.
|
65 |
|
|
|
66 |
|
|
@end itemize
|
67 |
|
|
|
68 |
|
|
Finally, the RTEMS FAQ and mailing list archives are available
|
69 |
|
|
at @uref{http://www.oarcorp.com}.
|
70 |
|
|
|
71 |
|
|
There is a wealth of documentation available for RTEMS and
|
72 |
|
|
the GNU tools supporting it. If you run into something
|
73 |
|
|
that is not clear or missing, bring it to our attention.
|
74 |
|
|
|
75 |
|
|
Also, some of the RTEMS documentation is still under
|
76 |
|
|
construction. If you would like to contribute to this
|
77 |
|
|
effort, please contact the RTEMS Team at
|
78 |
|
|
@uref{mailto:rtems-users@@OARcorp.com, rtems-users@@OARcorp.com}.
|
79 |
|
|
If you are interested in sponsoring the development of a new
|
80 |
|
|
feature, BSP, device driver, port of an existing library, etc.,
|
81 |
|
|
please contact @uref{mailto:sales@@OARcorp.com, sales@@OARcorp.com}.
|
82 |
|
|
|
83 |
|
|
@section Writing an Application
|
84 |
|
|
|
85 |
|
|
From an application author's perspective, RTEMS applications do not
|
86 |
|
|
start at @code{main()}. They begin execution at one or more
|
87 |
|
|
application initialization task or thread and @code{main()} is
|
88 |
|
|
owned by the Board Support Package. Each API supported
|
89 |
|
|
by RTEMS (Classic, POSIX, and ITRON) allows the user to configure
|
90 |
|
|
a set of tasks that are created and started automatically
|
91 |
|
|
during RTEMS initialization. The RTEMS Automatic
|
92 |
|
|
Configuration Generation (@code{confdefs.h}) scheme can be
|
93 |
|
|
used to easily generate the configuration information for
|
94 |
|
|
an application that starts with a single initialization task.
|
95 |
|
|
By convention, unless overridden, the default name of the
|
96 |
|
|
initialization task varies based up API.
|
97 |
|
|
|
98 |
|
|
@itemize @bullet
|
99 |
|
|
@item @code{Init} - single Classic API Initialization Task
|
100 |
|
|
|
101 |
|
|
@item @code{POSIX_Init} - single POSIX API Initialization Thread
|
102 |
|
|
|
103 |
|
|
@item @code{ITRON_Init} - single ITRON API Initialization Task
|
104 |
|
|
@end itemize
|
105 |
|
|
|
106 |
|
|
See the Configuring a System chapter in the C User's Guide for
|
107 |
|
|
more details.
|
108 |
|
|
|
109 |
|
|
Regardless of the API used, when the initialization task executes,
|
110 |
|
|
all non-networking device drivers are normally initialized and
|
111 |
|
|
processor interrupts are enabled. The initialization task then
|
112 |
|
|
goes about its business of performing application specific
|
113 |
|
|
initialization. This often involves creating tasks and other
|
114 |
|
|
system resources such as semaphores or message queues and allocating
|
115 |
|
|
memory. In the RTEMS examples and tests, the file @code{init.c} usually
|
116 |
|
|
contains the initialization task. Although not required, in
|
117 |
|
|
most of the examples, the initialization task completes by
|
118 |
|
|
deleting itself.
|
119 |
|
|
|
120 |
|
|
As you begin to write RTEMS application code, you may be confused
|
121 |
|
|
by the range of alternatives. Supporting multiple tasking
|
122 |
|
|
APIs can make the choices confusing. Many application groups
|
123 |
|
|
writing new code choose one of the APIs as their primary API
|
124 |
|
|
and only use services from the others if nothing comparable
|
125 |
|
|
is in their preferred one. However, the support for multiple
|
126 |
|
|
APIs is a powerful feature when integrating code from multiple
|
127 |
|
|
sources. You can write new code using POSIX services and
|
128 |
|
|
still use services written in terms of the other APIs.
|
129 |
|
|
Moreover, by adding support for yet another API, one could
|
130 |
|
|
provide the infrastructure required to migrate from a
|
131 |
|
|
legacy RTOS with a non-standard API to an API like POSIX.
|
132 |
|
|
|
133 |
|
|
|