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.9 2002/01/17 21:47:47 joel Exp
|
7 |
|
|
@c
|
8 |
|
|
|
9 |
|
|
@chapter Board Support Packages
|
10 |
|
|
|
11 |
|
|
@section Introduction
|
12 |
|
|
|
13 |
|
|
An RTEMS Board Support Package (BSP) must be designed
|
14 |
|
|
to support a particular processor and target board combination.
|
15 |
|
|
This chapter presents a discussion of SPARC specific BSP issues.
|
16 |
|
|
For more information on developing a BSP, refer to the chapter
|
17 |
|
|
titled Board Support Packages in the RTEMS
|
18 |
|
|
Applications User's Guide.
|
19 |
|
|
|
20 |
|
|
@section System Reset
|
21 |
|
|
|
22 |
|
|
An RTEMS based application is initiated or
|
23 |
|
|
re-initiated when the SPARC processor is reset. When the SPARC
|
24 |
|
|
is reset, the processor performs the following actions:
|
25 |
|
|
|
26 |
|
|
@itemize @bullet
|
27 |
|
|
@item the enable trap (ET) of the psr is set to 0 to disable
|
28 |
|
|
traps,
|
29 |
|
|
|
30 |
|
|
@item the supervisor bit (S) of the psr is set to 1 to enter
|
31 |
|
|
supervisor mode, and
|
32 |
|
|
|
33 |
|
|
@item the PC is set 0 and the nPC is set to 4.
|
34 |
|
|
@end itemize
|
35 |
|
|
|
36 |
|
|
The processor then begins to execute the code at
|
37 |
|
|
location 0. It is important to note that all fields in the psr
|
38 |
|
|
are not explicitly set by the above steps and all other
|
39 |
|
|
registers retain their value from the previous execution mode.
|
40 |
|
|
This is true even of the Trap Base Register (TBR) whose contents
|
41 |
|
|
reflect the last trap which occurred before the reset.
|
42 |
|
|
|
43 |
|
|
@section Processor Initialization
|
44 |
|
|
|
45 |
|
|
It is the responsibility of the application's
|
46 |
|
|
initialization code to initialize the TBR and install trap
|
47 |
|
|
handlers for at least the register window overflow and register
|
48 |
|
|
window underflow conditions. Traps should be enabled before
|
49 |
|
|
invoking any subroutines to allow for register window
|
50 |
|
|
management. However, interrupts should be disabled by setting
|
51 |
|
|
the Processor Interrupt Level (pil) field of the psr to 15.
|
52 |
|
|
RTEMS installs it's own Trap Table as part of initialization
|
53 |
|
|
which is initialized with the contents of the Trap Table in
|
54 |
|
|
place when the @code{rtems_initialize_executive} directive was invoked.
|
55 |
|
|
Upon completion of executive initialization, interrupts are
|
56 |
|
|
enabled.
|
57 |
|
|
|
58 |
|
|
If this SPARC implementation supports on-chip caching
|
59 |
|
|
and this is to be utilized, then it should be enabled during the
|
60 |
|
|
reset application initialization code.
|
61 |
|
|
|
62 |
|
|
In addition to the requirements described in the
|
63 |
|
|
Board Support Packages chapter of the @value{LANGUAGE}
|
64 |
|
|
Applications User's Manual for the reset code
|
65 |
|
|
which is executed before the call to
|
66 |
|
|
@code{rtems_initialize_executive}, the SPARC version has the following
|
67 |
|
|
specific requirements:
|
68 |
|
|
|
69 |
|
|
@itemize @bullet
|
70 |
|
|
@item Must leave the S bit of the status register set so that
|
71 |
|
|
the SPARC remains in the supervisor state.
|
72 |
|
|
|
73 |
|
|
@item Must set stack pointer (sp) such that a minimum stack
|
74 |
|
|
size of MINIMUM_STACK_SIZE bytes is provided for the
|
75 |
|
|
@code{rtems_initialize_executive} directive.
|
76 |
|
|
|
77 |
|
|
@item Must disable all external interrupts (i.e. set the pil
|
78 |
|
|
to 15).
|
79 |
|
|
|
80 |
|
|
@item Must enable traps so window overflow and underflow
|
81 |
|
|
conditions can be properly handled.
|
82 |
|
|
|
83 |
|
|
@item Must initialize the SPARC's initial trap table with at
|
84 |
|
|
least trap handlers for register window overflow and register
|
85 |
|
|
window underflow.
|
86 |
|
|
@end itemize
|
87 |
|
|
|