source: rtems/doc/user/bsp.t @ ae68ff0

4.104.114.84.95
Last change on this file since ae68ff0 was ae68ff0, checked in by Joel Sherrill <joel.sherrill@…>, on 05/27/97 at 12:40:11

Initial revision

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