source: rtems/doc/bsp_howto/target.t @ 183369d

4.104.114.84.95
Last change on this file since 183369d was 183369d, checked in by Joel Sherrill <joel.sherrill@…>, on 12/17/98 at 18:15:39

Incorporated Jeff's suggestions.

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