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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [doc/] [bsp_howto/] [support.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  support.t,v 1.4 2002/01/17 21:47:44 joel Exp
7
@c
8
 
9
@chapter Miscellaneous Support Files
10
 
11
@section GCC Compiler Specifications File
12
 
13
The file @code{bsp_specs} defines the start files and libraries
14
that are always used with this BSP.  The format of this file
15
is admittedly cryptic and this document will make no attempt
16
to explain it completely.  Below is the @code{bsp_specs}
17
file from the PowerPC psim BSP:
18
 
19
@example
20
@group
21
%rename cpp old_cpp
22
%rename lib old_lib
23
%rename endfile old_endfile
24
%rename startfile old_startfile
25
%rename link old_link
26
 
27
*cpp:
28
%(old_cpp) %@{qrtems: -D__embedded__@} -Asystem(embedded)
29
 
30
*lib:
31
%@{!qrtems: %(old_lib)@} %@{qrtems: --start-group \
32
%@{!qrtems_debug: -lrtemsall@} %@{qrtems_debug: -lrtemsall_g@} \
33
-lc -lgcc --end-group  ecrtn%O%s \
34
%@{!qnolinkcmds: -T linkcmds%s@}@}
35
 
36
*startfile:
37
%@{!qrtems: %(old_startfile)@} %@{qrtems:  ecrti%O%s \
38
%@{!qrtems_debug: startsim.o%s@} \
39
%@{qrtems_debug: startsim_g.o%s@}@}
40
 
41
*link:
42
%@{!qrtems: %(old_link)@} %@{qrtems: -Qy -dp -Bstatic \
43
-T linkcmds%s -e _start -u __vectors@}
44
@end group
45
@end example
46
 
47
The first section of this file renames the built-in definition of
48
some specification variables so they can be augmented without
49
embedded their original definition.  The subsequent sections
50
specify what behavior is expected when the @code{-qrtems} or
51
@code{-qrtems_debug} option is specified.
52
 
53
The @code{*cpp} definition specifies that when @code{-qrtems}
54
is specified, predefine the preprocessor symbol @code{__embedded__}.
55
 
56
The @code{*lib} section insures that the RTEMS library, BSP specific
57
linker script, gcc support library, and the EABI specific @code{ecrtn}
58
file are used.
59
 
60
The @code{*startfile} section specifies that the BSP specific file
61
@code{startsim.o} will be used instead of @code{crt0.o}.  In addition,
62
the EABI specific file @code{ecrti.o} will be linked in with the
63
executable.
64
 
65
The @code{*link} section specifies the arguments that will be passed to
66
the linker.
67
 
68
The format of this file is specific to the GNU Compiler Suite.  The
69
argument used to override and extend the compiler built-in specifications
70
is relatively new to the toolset.  The @code{-specs} option is present
71
in all @code{egcs} distributions and @code{gcc} distributions starting
72
with version 2.8.0.
73
 
74
@section README Files
75
 
76
Most BSPs provide one or more @code{README} files.  Generally, there
77
is a @code{README} file at the top of the BSP source.  This file
78
describes the board and its hardware configuration, provides vendor
79
information, local configuration information, information on downloading
80
code to the board, debugging, etc..  The intent of this
81
file is to help someone begin to use the BSP faster.
82
 
83
A @code{README} file in a BSP subdirectory typically explains something
84
about the contents of that subdirectory in greater detail.  For example,
85
it may list the documentation available for a particular peripheral
86
controller and how to obtain that documentation.  It may also explain some
87
particularly cryptic part of the software in that directory or provide
88
rationale on the implementation.
89
 
90
@section times
91
 
92
This file contains the results of the RTEMS Timing Test Suite.  It is
93
in a standard format so that results from one BSP can be easily compared
94
with those of another target board.
95
 
96
If a BSP supports multiple variants, then there may be multiple @code{times}
97
files.  Usually these are named @code{times.VARIANTn}.
98
 
99
@section Tools Subdirectory
100
 
101
Some BSPs provide additional tools that aid in using the target board.
102
These tools run on the development host and are built as part of building
103
the BSP.  Most common is a script to automate running the RTEMS Test Suites
104
on the BSP.  Examples of this include:
105
 
106
@itemize @bullet
107
 
108
@item @code{powerpc/psim} includes scripts to ease use of the simulator
109
 
110
@item @code{m68k/mvme162} includes a utility to download across the
111
VMEbus into target memory if the host is a VMEbus board in the same
112
chasis.
113
 
114
@item @code{unix/posix} includes scripts to run the tests automatically
115
on this BSP.
116
 
117
@end itemize
118
 
119
@section bsp.h Include File
120
 
121
The file @code{include/bsp.h} contains prototypes and definitions
122
specific to this board.  Every BSP is required to provide a @code{bsp.h}.
123
The best approach to writing a @code{bsp.h} is copying an existing one
124
as a starting point.
125
 
126
Many @code{bsp.h} files provide prototypes of variables defined
127
in the linker script (@code{linkcmds}).
128
 
129
There are a number of fields in this file that are used only by the
130
RTEMS Test Suites.  The following is a list of these:
131
 
132
@itemize @bullet
133
@item @code{MAX_LONG_TEST_DURATION} - the longest length of time a
134
"long running" test should run.
135
 
136
@item @code{MAX_SHORT_TEST_DURATION} - the longest length of time a
137
"short running" test should run.
138
 
139
@item @code{MUST_WAIT_FOR_INTERRUPT} - modifies behavior of @code{tm27}.
140
 
141
@item @code{Install_tm27_vector} - installs the interrupt service
142
routine for the Interrupt Benchmark Test (@code{tm27}).
143
 
144
@item @code{Cause_tm27_intr} - generates the interrupt source
145
used in the Interrupt Benchmark Test (@code{tm27}).
146
 
147
@item @code{Clear_tm27_intr} - clears the interrupt source
148
used in the Interrupt Benchmark Test (@code{tm27}).
149
 
150
@item @code{Lower_tm27_intr} - lowers the interrupt mask so the
151
interrupt source used in the Interrupt Benchmark Test (@code{tm27})
152
can generate a nested interrupt.
153
 
154
@end itemize
155
 
156
@section Calling Overhead File
157
 
158
The file @code{include/coverhd.h} contains the overhead associated
159
with invoking each directive.  This overhead consists of the execution
160
time required to package the parameters as well as to execute the "jump to
161
subroutine" and "return from subroutine" sequence.  The intent of this
162
file is to help separate the calling overhead from the actual execution
163
time of a directive.  This file is only used by the tests in the
164
RTEMS Timing Test Suite.
165
 
166
The numbers in this file are obtained by running the "Timer Overhead"
167
@code{tmoverhd} test.  The numbers in this file may be 0 and no
168
overhead is subtracted from the directive execution times reported by
169
the Timing Suite.
170
 
171
@section sbrk() Implementation
172
 
173
If the BSP wants to dynamically extend the heap used by the
174
C Library memory allocation routines (i.e. @code{malloc} family),
175
then this routine must be functional.  The following is the
176
prototype for this routine:
177
 
178
@example
179
void * sbrk(size_t increment)
180
@end example
181
 
182
The @code{increment} amount is based upon the @code{sbrk_amount}
183
parameter passed to the @code{RTEMS_Malloc_Initialize} during system
184
initialization.
185
See @ref{Initialization Code RTEMS Pretasking Callback} for more
186
information.
187
 
188
There is a default implementation which returns an error to indicate
189
that the heap can not be extended.  This implementation can be
190
found in @code{c/src/lib/libbsp/shared/sbrk.c}.  Many of the BSPs
191
use this shared implementation.  In order to use this implementation,
192
the file @code{Makefile.in} in the BSP's @code{startup} directory
193
must be modified so that the @code{$VPATH} variable searches
194
both the @code{startup} directory and the shared directory.  The following
195
illustates the @code{VPATH} setting in the PowerPC psim BSP's
196
@code{startup/Makefile.in}:
197
 
198
@example
199
VPATH = @@srcdir@@:@@srcdir@@/../../../shared
200
@end example
201
 
202
This instructs make to look in all of the directories in the @code{VPATH}
203
for the source files.  The directories will be examined in the order
204
they are specified.
205
 
206
@section bsp_cleanup() - Cleanup the Hardware
207
 
208
The @code{bsp_cleanup()} is the last C code invoked.  Most of the BSPs
209
use the same shared version of @code{bsp_cleanup()} that does nothing.
210
This implementation is located in the following file:
211
 
212
@example
213
c/src/lib/libbsp/shared/bspclean.c
214
@end example
215
 
216
The @code{bsp_cleanup()} routine can be used to return to a ROM monitor,
217
insure that interrupt sources are disabled, etc..  This routine is the
218
last place to insure a clean shutdown of the hardware.
219
 
220
@section set_vector() - Install an Interrupt Vector
221
 
222
The @code{set_vector} routine is responsible for installing an interrupt
223
vector.  It invokes the support routines necessary to install an
224
interrupt handler as either a "raw" or an RTEMS interrupt handler.  Raw
225
handlers bypass the RTEMS interrupt structure and are responsible for
226
saving and restoring all their own registers.  Raw handlers are useful
227
for handling traps, debug vectors, etc..
228
 
229
The @code{set_vector} routine is a central place to perform
230
interrupt controller manipulation and encapsulate that information.
231
It is usually implemented as follows:
232
 
233
@example
234
@group
235
rtems_isr_entry set_vector(                     /* returns old vector */
236
  rtems_isr_entry     handler,                  /* isr routine        */
237
  rtems_vector_number vector,                   /* vector number      */
238
  int                 type                      /* RTEMS or RAW intr  */
239
)
240
@{
241
  if the type is RAW
242
    install the raw vector
243
  else
244
    use rtems_interrupt_catch to install the vector
245
 
246
  perform any interrupt controller necessary to unmask
247
    the interrupt source
248
 
249
  return the previous handler
250
@}
251
@end group
252
@end example
253
 
254
 
255
@b{NOTE:}  @code{set_vector} is provided by the majority of BSPs but
256
not all.  In particular, the i386 BSPs use a different scheme.
257
 

powered by: WebSVN 2.1.0

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