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 target.t,v 1.13 2002/01/17 21:47:44 joel Exp
|
7 |
|
|
@c
|
8 |
|
|
|
9 |
|
|
@chapter Target Dependent Files
|
10 |
|
|
|
11 |
|
|
RTEMS has a multi-layered approach to portability. This is done to
|
12 |
|
|
maximize the amount of software that can be reused. Much of the
|
13 |
|
|
RTEMS source code can be reused on all RTEMS platforms. Other parts
|
14 |
|
|
of the executive are specific to hardware in some sense.
|
15 |
|
|
RTEMS classifies target dependent code based upon its dependencies
|
16 |
|
|
into one of the following categories.
|
17 |
|
|
|
18 |
|
|
@itemize @bullet
|
19 |
|
|
@item CPU dependent
|
20 |
|
|
@item Board dependent
|
21 |
|
|
@item Peripheral dependent
|
22 |
|
|
@end itemize
|
23 |
|
|
|
24 |
|
|
@section CPU Dependent
|
25 |
|
|
|
26 |
|
|
This class of code includes the foundation
|
27 |
|
|
routines for the executive proper such as the context switch and
|
28 |
|
|
the interrupt subroutine implementations. Sources for the supported
|
29 |
|
|
processor families can be found in @code{c/src/exec/score/cpu}.
|
30 |
|
|
A good starting point for a new family of processors is the
|
31 |
|
|
@code{no_cpu} directory, which holds both prototypes and
|
32 |
|
|
descriptions of each needed CPU dependent function.
|
33 |
|
|
|
34 |
|
|
CPU dependent code is further subcategorized if the implementation is
|
35 |
|
|
dependent on a particular CPU model. For example, the MC68000 and MC68020
|
36 |
|
|
processors are both members of the m68k CPU family but there are significant
|
37 |
|
|
differents between these CPU models which RTEMS must take into account.
|
38 |
|
|
|
39 |
|
|
@section Board Dependent
|
40 |
|
|
|
41 |
|
|
This class of code provides the most specific glue between RTEMS and
|
42 |
|
|
a particular board. This code is represented by the Board Support Packages
|
43 |
|
|
and associated Device Drivers. Sources for the BSPs included in the
|
44 |
|
|
RTEMS distribution are located in the directory @code{c/src/lib/libbsp}.
|
45 |
|
|
The BSP source directory is further subdivided based on the CPU family
|
46 |
|
|
and BSP.
|
47 |
|
|
|
48 |
|
|
Some BSPs may support multiple board models within a single board family.
|
49 |
|
|
This is necessary when the board supports multiple variants on a
|
50 |
|
|
single base board. For example, the Motorola MVME162 board family has a
|
51 |
|
|
fairly large number of variations based upon the particular CPU model
|
52 |
|
|
and the peripherals actually placed on the board.
|
53 |
|
|
|
54 |
|
|
@section Peripheral Dependent
|
55 |
|
|
|
56 |
|
|
This class of code provides a reusable library of peripheral device
|
57 |
|
|
drivers which can be tailored easily to a particular board. The
|
58 |
|
|
libchip library is a collection of reusable software objects that
|
59 |
|
|
correspond to standard controllers. Just as the hardware engineer
|
60 |
|
|
chooses a standard controller when designing a board, the goal of
|
61 |
|
|
this library is to let the software engineer do the same thing.
|
62 |
|
|
|
63 |
|
|
The source code for the reusable peripheral driver library may be found
|
64 |
|
|
in the directory @code{c/src/lib/libchip}. The source code is further
|
65 |
|
|
divided based upon the class of hardware. Example classes include serial
|
66 |
|
|
communications controllers, real-time clocks, non-volatile memory, and
|
67 |
|
|
network controllers.
|
68 |
|
|
|
69 |
|
|
@section Questions to Ask
|
70 |
|
|
|
71 |
|
|
When evaluating what is required to support RTEMS applications on
|
72 |
|
|
a particular target board, the following questions should be asked:
|
73 |
|
|
|
74 |
|
|
@itemize @bullet
|
75 |
|
|
|
76 |
|
|
@item Does a BSP for this board exist?
|
77 |
|
|
|
78 |
|
|
@item Does a BSP for a similar board exists?
|
79 |
|
|
|
80 |
|
|
@item Is the board's CPU supported?
|
81 |
|
|
|
82 |
|
|
@end itemize
|
83 |
|
|
|
84 |
|
|
If there is already a BSP for the board, then things may already be ready
|
85 |
|
|
to start developing application software. All that remains is to verify
|
86 |
|
|
that the existing BSP provides device drivers for all the peripherals
|
87 |
|
|
on the board that the application will be using. For example, the application
|
88 |
|
|
in question may require that the board's Ethernet controller be used and
|
89 |
|
|
the existing BSP may not support this.
|
90 |
|
|
|
91 |
|
|
If the BSP does not exist and the board's CPU model is supported, then
|
92 |
|
|
examine the reusable chip library and existing BSPs for a close match.
|
93 |
|
|
Other BSPs and libchip provide starting points for the development
|
94 |
|
|
of a new BSP. It is often possible to copy existing components in
|
95 |
|
|
the reusable chip library or device drivers from BSPs from different
|
96 |
|
|
CPU families as the starting point for a new device driver.
|
97 |
|
|
This will help reduce the development effort required.
|
98 |
|
|
|
99 |
|
|
If the board's CPU family is supported but the particular CPU model on
|
100 |
|
|
that board is not, then the RTEMS port to that CPU family will have to
|
101 |
|
|
be augmented. After this is done, development of the new BSP can proceed.
|
102 |
|
|
|
103 |
|
|
Otherwise both CPU dependent code and the BSP will have to be written.
|
104 |
|
|
|
105 |
|
|
Regardless of the amount of development required, OAR Corporation
|
106 |
|
|
offers custom development services to assist RTEMS users.
|
107 |
|
|
For more information on custom development, training courses, and
|
108 |
|
|
support, contact OAR Corporation at
|
109 |
|
|
@uref{http://www.oarcorp.com}.
|
110 |
|
|
|
111 |
|
|
|
112 |
|
|
@section CPU Dependent Executive Files
|
113 |
|
|
|
114 |
|
|
The CPU dependent files in the RTEMS executive source code are found
|
115 |
|
|
in the following directory:
|
116 |
|
|
|
117 |
|
|
@example
|
118 |
|
|
c/src/exec/score/cpu/@i{CPU}
|
119 |
|
|
@end example
|
120 |
|
|
|
121 |
|
|
where @i{CPU} is replaced with the CPU family name.
|
122 |
|
|
|
123 |
|
|
Within each CPU dependent directory inside the executive proper is a
|
124 |
|
|
file named @code{@i{CPU}.h} which contains information about each of the
|
125 |
|
|
supported CPU models within that family.
|
126 |
|
|
|
127 |
|
|
@section CPU Dependent Support Files
|
128 |
|
|
|
129 |
|
|
The CPU dependent support files contain routines which aid in the development
|
130 |
|
|
of applications using that CPU family. For example, the support routines
|
131 |
|
|
may contain standard trap handlers for alignment or floating point exceptions
|
132 |
|
|
or device drivers for peripheral controllers found on the CPU itself.
|
133 |
|
|
This class of code may be found in the following directory:
|
134 |
|
|
|
135 |
|
|
@example
|
136 |
|
|
c/src/lib/libcpu/@i{CPU}
|
137 |
|
|
@end example
|
138 |
|
|
|
139 |
|
|
CPU model dependent support code is found in the following directory:
|
140 |
|
|
|
141 |
|
|
@example
|
142 |
|
|
c/src/lib/libcpu/@i{CPU}/@i{CPU_MODEL}
|
143 |
|
|
@end example
|
144 |
|
|
|
145 |
|
|
@section Board Support Package Structure
|
146 |
|
|
|
147 |
|
|
The BSPs are all under the c/src/lib/libbsp directory. Below this
|
148 |
|
|
directory, there is a subdirectory for each CPU family. Each BSP
|
149 |
|
|
is found under the subdirectory for the appropriate processor
|
150 |
|
|
family (m68k, powerpc, etc.). In addition, there is source code
|
151 |
|
|
available which may be shared across all BSPs regardless of
|
152 |
|
|
the CPU family or just across BSPs within a single CPU family. This
|
153 |
|
|
results in a BSP using the following directories:
|
154 |
|
|
|
155 |
|
|
@example
|
156 |
|
|
c/src/lib/libbsp/shared
|
157 |
|
|
c/src/lib/libbsp/@i{CPU}/shared
|
158 |
|
|
c/src/lib/libbsp/@i{CPU}/@i{BSP}
|
159 |
|
|
@end example
|
160 |
|
|
|
161 |
|
|
Under each BSP specific directory, there is a collection of
|
162 |
|
|
subdirectories. For commonly provided functionality, the BSPs
|
163 |
|
|
follow a convention on subdirectory naming. The following list
|
164 |
|
|
describes the commonly found subdirectories under each BSP.
|
165 |
|
|
|
166 |
|
|
@itemize @bullet
|
167 |
|
|
|
168 |
|
|
@item @b{console}:
|
169 |
|
|
is technically the serial driver for the BSP rather
|
170 |
|
|
than just a console driver, it deals with the board
|
171 |
|
|
UARTs (i.e. serial devices).
|
172 |
|
|
|
173 |
|
|
@item @b{clock}:
|
174 |
|
|
support for the clock tick -- a regular time basis to the kernel.
|
175 |
|
|
|
176 |
|
|
@item @b{timer}:
|
177 |
|
|
support of timer devices.
|
178 |
|
|
|
179 |
|
|
@item @b{rtc}:
|
180 |
|
|
support for the hardware real-time clock.
|
181 |
|
|
|
182 |
|
|
@item @b{nvmem}:
|
183 |
|
|
support for non-volatile memory such as EEPROM or Flash.
|
184 |
|
|
|
185 |
|
|
@item @b{network}:
|
186 |
|
|
the Ethernet driver.
|
187 |
|
|
|
188 |
|
|
@item @b{shmsupp}:
|
189 |
|
|
support of shared memory driver MPCI layer in a multiprocessor system,
|
190 |
|
|
|
191 |
|
|
@item @b{include}:
|
192 |
|
|
include files for this BSP.
|
193 |
|
|
|
194 |
|
|
@item @b{wrapup}:
|
195 |
|
|
bundles all the components necessary to construct the BSP library.
|
196 |
|
|
|
197 |
|
|
@end itemize
|
198 |
|
|
|
199 |
|
|
The build order of the BSP is determined by the Makefile structure.
|
200 |
|
|
This structure is discussed in more detail in the @ref{Makefiles}
|
201 |
|
|
chapter.
|
202 |
|
|
|
203 |
|
|
@b{NOTE:} This manual refers to the gen68340 BSP for numerous concrete
|
204 |
|
|
examples. You should have a copy of the gen68340 BSP available while
|
205 |
|
|
reading this piece of documentation. This BSP is located in the
|
206 |
|
|
following directory:
|
207 |
|
|
|
208 |
|
|
@example
|
209 |
|
|
c/src/lib/libbsp/m68k/gen68340
|
210 |
|
|
@end example
|
211 |
|
|
|
212 |
|
|
Later in this document, the $BSP340_ROOT label will be used
|
213 |
|
|
to refer to this directory.
|
214 |
|
|
|