OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [doc/] [user/] [bsp.t] - Blame information for rev 1771

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
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  bsp.t,v 1.10 2002/01/17 21:47:47 joel Exp
7
@c
8
 
9
@chapter Board Support Packages
10
 
11
@cindex Board Support Packages
12
@cindex BSPs
13
 
14
@section Introduction
15
 
16
@cindex BSP, definition
17
 
18
A board support package (BSP) is a collection of
19
user-provided facilities which interface RTEMS and an
20
application with a specific hardware platform.  These facilities
21
may  include hardware initialization, device drivers, user
22
extensions, and a Multiprocessor Communications Interface
23
(MPCI).  However, a minimal BSP need only support processor
24
reset and initialization and, if needed, a clock tick.
25
 
26
@section Reset and Initialization
27
 
28
An RTEMS based application is initiated or
29
re-initiated when the processor is reset.  This initialization
30
code is responsible for preparing the target platform for the
31
RTEMS application.  Although the exact actions performed by the
32
initialization code are highly processor and target dependent,
33
the logical functionality of these actions are similar across a
34
variety of processors and target platforms.
35
 
36
Normally, the application's initialization is
37
performed at two separate times:  before the call to
38
@code{@value{DIRPREFIX}initialize_executive}
39
(reset application initialization) and
40
after @code{@value{DIRPREFIX}initialize_executive}
41
in the user's initialization tasks
42
(local and global application initialization).  The order of the
43
startup procedure is as follows:
44
 
45
@enumerate
46
@item Reset application initialization.
47
@item Call to @code{@value{DIRPREFIX}initialize_executive}
48
@item Local and global application initialization.
49
@end enumerate
50
 
51
The reset application initialization code is executed
52
first when the processor is reset.  All of the hardware must be
53
initialized to a quiescent state by this software before
54
initializing RTEMS.  When in quiescent state, devices do not
55
generate any interrupts or require any servicing by the
56
application.  Some of the hardware components may be initialized
57
in this code as well as any application initialization that does
58
not involve calls to RTEMS directives.
59
 
60
The processor's Interrupt Vector Table which will be
61
used by the application may need to be set to the required value
62
by the reset application initialization code.  Because
63
interrupts are enabled automatically by RTEMS as part of the
64
@code{@value{DIRPREFIX}initialize_executive} directive,
65
the Interrupt Vector Table MUST
66
be set before this directive is invoked to insure correct
67
interrupt vectoring.  The processor's Interrupt Vector Table
68
must be accessible by RTEMS as it will be modified by the
69
@code{@value{DIRPREFIX}interrupt_catch} directive.
70
On some CPUs, RTEMS installs it's
71
own Interrupt Vector Table as part of initialization and thus
72
these requirements are met automatically.  The reset code which
73
is executed before the call to @code{@value{DIRPREFIX}initialize_executive}
74
has the following requirements:
75
 
76
@itemize @bullet
77
@item Must not make any RTEMS directive calls.
78
 
79
@item If the processor supports multiple privilege levels,
80
must leave the processor in the most privileged, or supervisory,
81
state.
82
 
83
@item Must allocate a stack of at least @code{@value{RPREFIX}MINIMUM_STACK_SIZE}
84
bytes and initialize the stack pointer for the
85
@code{@value{DIRPREFIX}initialize_executive} directive.
86
 
87
@item Must initialize the processor's Interrupt Vector Table.
88
 
89
@item Must disable all maskable interrupts.
90
 
91
@item If the processor supports a separate interrupt stack,
92
must allocate the interrupt stack and initialize the interrupt
93
stack pointer.
94
@end itemize
95
 
96
The @code{@value{DIRPREFIX}initialize_executive} directive does not return to
97
the initialization code, but causes the highest priority
98
initialization task to begin execution.  Initialization tasks
99
are used to perform both local and global application
100
initialization which is dependent on RTEMS facilities.  The user
101
initialization task facility is typically used to create the
102
application's set of tasks.
103
 
104
@subsection Interrupt Stack Requirements
105
 
106
The worst-case stack usage by interrupt service
107
routines must be taken into account when designing an
108
application.  If the processor supports interrupt nesting, the
109
stack usage must include the deepest nest level.  The worst-case
110
stack usage must account for the following requirements:
111
 
112
@itemize @bullet
113
@item Processor's interrupt stack frame
114
 
115
@item Processor's subroutine call stack frame
116
 
117
@item RTEMS system calls
118
 
119
@item Registers saved on stack
120
 
121
@item Application subroutine calls
122
@end itemize
123
 
124
The size of the interrupt stack must be greater than
125
or equal to the constant @code{@value{RPREFIX}MINIMUM_STACK_SIZE}.
126
 
127
@subsection Processors with a Separate Interrupt Stack
128
 
129
Some processors support a separate stack for
130
interrupts.  When an interrupt is vectored and the interrupt is
131
not nested, the processor will automatically switch from the
132
current stack to the interrupt stack.  The size of this stack is
133
based solely on the worst-case stack usage by interrupt service
134
routines.
135
 
136
The dedicated interrupt stack for the entire
137
application is supplied and initialized by the reset and
138
initialization code of the user's board support package.  Since
139
all ISRs use this stack, the stack size must take into account
140
the worst case stack usage by any combination of nested ISRs.
141
 
142
@subsection Processors without a Separate Interrupt Stack
143
 
144
Some processors do not support a separate stack for
145
interrupts.  In this case, without special assistance every
146
task's stack must include enough space to handle the task's
147
worst-case stack usage as well as the worst-case interrupt stack
148
usage.  This is necessary because the worst-case interrupt
149
nesting could occur while any task is executing.
150
 
151
On many processors without dedicated hardware managed
152
interrupt stacks, RTEMS manages a dedicated interrupt stack in
153
software.  If this capability is supported on a CPU, then it is
154
logically equivalent to the processor supporting a separate
155
interrupt stack in hardware.
156
 
157
@section Device Drivers
158
 
159
Device drivers consist of control software for
160
special peripheral devices and provide a logical interface for
161
the application developer.  The RTEMS I/O manager provides
162
directives which allow applications to access these device
163
drivers in a consistent fashion.  A Board Support Package may
164
include device drivers to access the hardware on the target
165
platform.  These devices typically include serial and parallel
166
ports, counter/timer peripherals, real-time clocks, disk
167
interfaces, and network controllers.
168
 
169
For more information on device drivers, refer to the
170
I/O Manager chapter.
171
 
172
@subsection Clock Tick Device Driver
173
 
174
Most RTEMS applications will include a clock tick
175
device driver which invokes the @code{@value{DIRPREFIX}clock_tick}
176
directive at regular intervals.  The clock tick is necessary if
177
the application is to utilize timeslicing, the clock manager, the
178
timer manager, the rate monotonic manager, or the timeout option on blocking
179
directives.
180
 
181
The clock tick is usually provided as an interrupt
182
from a counter/timer or a real-time clock device.  When a
183
counter/timer is used to provide the clock tick, the device is
184
typically programmed to operate in continuous mode.  This mode
185
selection causes the device to automatically reload the initial
186
count and continue the countdown without programmer
187
intervention.  This reduces the overhead required to manipulate
188
the counter/timer in the clock tick ISR and increases the
189
accuracy of tick occurrences.  The initial count can be based on
190
the microseconds_per_tick field in the RTEMS Configuration
191
Table.  An alternate approach is to set the initial count for a
192
fixed time period (such as one millisecond) and have the ISR
193
invoke @code{@value{DIRPREFIX}clock_tick}
194
on the microseconds_per_tick boundaries.
195
Obviously, this can induce some error if the configured
196
microseconds_per_tick is not evenly divisible by the chosen
197
clock interrupt quantum.
198
 
199
It is important to note that the interval between
200
clock ticks directly impacts the granularity of RTEMS timing
201
operations.  In addition, the frequency of clock ticks is an
202
important factor in the overall level of system overhead.  A
203
high clock tick frequency results in less processor time being
204
available for task execution due to the increased number of
205
clock tick ISRs.
206
 
207
@section User Extensions
208
 
209
RTEMS allows the application developer to augment
210
selected features by invoking user-supplied extension routines
211
when the following system events occur:
212
 
213
@itemize @bullet
214
@item Task creation
215
@item Task initiation
216
@item Task reinitiation
217
@item Task deletion
218
@item Task context switch
219
@item Post task context switch
220
@item Task begin
221
@item Task exits
222
@item Fatal error detection
223
@end itemize
224
 
225
User extensions can be used to implement a wide variety of
226
functions including execution profiling, non-standard
227
coprocessor support, debug support, and error detection and
228
recovery.  For example, the context of a non-standard numeric
229
coprocessor may be maintained via the user extensions.  In this
230
example, the task creation and deletion extensions are
231
responsible for allocating and deallocating the context area,
232
the task initiation and reinitiation extensions would be
233
responsible for priming the context area, and the task context
234
switch extension would save and restore the context of the
235
device.
236
 
237
For more information on user extensions, refer to the
238
User Extensions chapter.
239
 
240
@section Multiprocessor Communications Interface (MPCI)
241
 
242
RTEMS requires that an MPCI layer be provided when a
243
multiple node application is developed.  This MPCI layer must
244
provide an efficient and reliable communications mechanism
245
between the multiple nodes.  Tasks on different nodes
246
communicate and synchronize with one another via the MPCI.  Each
247
MPCI layer must be tailored to support the architecture of the
248
target platform.
249
 
250
For more information on the MPCI, refer to the
251
Multiprocessing Manager chapter.
252
 
253
@subsection Tightly-Coupled Systems
254
 
255
A tightly-coupled system is a multiprocessor
256
configuration in which the processors communicate solely via
257
shared global memory.  The MPCI can simply place the RTEMS
258
packets in the shared memory space.  The two primary
259
considerations when designing an MPCI for a tightly-coupled
260
system are data consistency and informing another node of a
261
packet.
262
 
263
The data consistency problem may be solved using
264
atomic "test and set" operations to provide a "lock" in the
265
shared memory.  It is important to minimize the length of time
266
any particular processor locks a shared data structure.
267
 
268
The problem of informing another node of a packet can
269
be addressed using one of two techniques.  The first technique
270
is to use an interprocessor interrupt capability to cause an
271
interrupt on the receiving node.  This technique requires that
272
special support hardware be provided by either the processor
273
itself or the target platform.  The second technique is to have
274
a node poll for arrival of packets.  The drawback to this
275
technique is the overhead associated with polling.
276
 
277
@subsection Loosely-Coupled Systems
278
 
279
A loosely-coupled system is a multiprocessor
280
configuration in which the processors communicate via some type
281
of communications link which is not shared global memory.  The
282
MPCI sends the RTEMS packets across the communications link to
283
the destination node.  The characteristics of the communications
284
link vary widely and have a significant impact on the MPCI
285
layer.  For example, the bandwidth of the communications link
286
has an obvious impact on the maximum MPCI throughput.
287
 
288
The characteristics of a shared network, such as
289
Ethernet, lend themselves to supporting an MPCI layer.  These
290
networks provide both the point-to-point and broadcast
291
capabilities which are expected by RTEMS.
292
 
293
@subsection Systems with Mixed Coupling
294
 
295
A mixed-coupling system is a multiprocessor
296
configuration in which the processors communicate via both
297
shared memory and communications links.  A unique characteristic
298
of mixed-coupling systems is that a node may not have access to
299
all communication methods.  There may be multiple shared memory
300
areas and communication links.  Therefore, one of the primary
301
functions of the MPCI layer is to efficiently route RTEMS
302
packets between nodes.  This routing may be based on numerous
303
algorithms. In addition, the router may provide alternate
304
communications paths in the event of an overload or a partial
305
failure.
306
 
307
@subsection Heterogeneous Systems
308
 
309
Designing an MPCI layer for a heterogeneous system
310
requires special considerations by the developer.  RTEMS is
311
designed to eliminate many of the problems associated with
312
sharing data in a heterogeneous environment.  The MPCI layer
313
need only address the representation of thirty-two (32) bit
314
unsigned quantities.
315
 
316
For more information on supporting a heterogeneous
317
system, refer the Supporting Heterogeneous Environments in the
318
Multiprocessing Manager chapter.

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.