1 | Target Dependent Files |
---|
2 | ###################### |
---|
3 | |
---|
4 | RTEMS has a multi-layered approach to portability. This is done to |
---|
5 | maximize the amount of software that can be reused. Much of the |
---|
6 | RTEMS source code can be reused on all RTEMS platforms. Other parts |
---|
7 | of the executive are specific to hardware in some sense. |
---|
8 | RTEMS classifies target dependent code based upon its dependencies |
---|
9 | into one of the following categories. |
---|
10 | |
---|
11 | - CPU dependent |
---|
12 | |
---|
13 | - Board dependent |
---|
14 | |
---|
15 | - Peripheral dependent |
---|
16 | |
---|
17 | CPU Dependent |
---|
18 | ============= |
---|
19 | |
---|
20 | This class of code includes the foundation |
---|
21 | routines for the executive proper such as the context switch and |
---|
22 | the interrupt subroutine implementations. Sources for the supported |
---|
23 | processor families can be found in ``cpukit/score/cpu``. |
---|
24 | A good starting point for a new family of processors is the``no_cpu`` directory, which holds both prototypes and |
---|
25 | descriptions of each needed CPU dependent function. |
---|
26 | |
---|
27 | CPU dependent code is further subcategorized if the implementation is |
---|
28 | dependent on a particular CPU model. For example, the MC68000 and MC68020 |
---|
29 | processors are both members of the m68k CPU family but there are significant |
---|
30 | differences between these CPU models which RTEMS must take into account. |
---|
31 | |
---|
32 | The source code found in the ``cpukit/score/cpu`` is required to |
---|
33 | only depend upon the CPU model variations that GCC distinguishes |
---|
34 | for the purposes of multilib'ing. Multilib is the term the GNU |
---|
35 | community uses to refer to building a single library source multiple |
---|
36 | times with different compiler options so the binary code generated |
---|
37 | is compatible. As an example, from GCC's perspective, many PowerPC |
---|
38 | CPU models are just a PPC603e. Remember that GCC only cares about |
---|
39 | the CPU code itself and need not be aware of any peripherals. In |
---|
40 | the embedded community, we are exposed to thousands of CPU models |
---|
41 | which are all based upon only a relative small number of CPU cores. |
---|
42 | |
---|
43 | Similarly for the SPARC/ERC32 BSP, the ``RTEMS_CPU`` is specified as``erc32`` which is the name of the CPU model and BSP for this SPARC V7 |
---|
44 | system on chip. But the multilib variant used is actually ``v7`` |
---|
45 | which indicates the ERC32 CPU core is a SPARC V7. |
---|
46 | |
---|
47 | Board Dependent |
---|
48 | =============== |
---|
49 | |
---|
50 | This class of code provides the most specific glue between RTEMS and |
---|
51 | a particular board. This code is represented by the Board Support Packages |
---|
52 | and associated Device Drivers. Sources for the BSPs included in the |
---|
53 | RTEMS distribution are located in the directory ``c/src/lib/libbsp``. |
---|
54 | The BSP source directory is further subdivided based on the CPU family |
---|
55 | and BSP. |
---|
56 | |
---|
57 | Some BSPs may support multiple board models within a single board family. |
---|
58 | This is necessary when the board supports multiple variants on a |
---|
59 | single base board. For example, the Motorola MVME162 board family has a |
---|
60 | fairly large number of variations based upon the particular CPU model |
---|
61 | and the peripherals actually placed on the board. |
---|
62 | |
---|
63 | Peripheral Dependent |
---|
64 | ==================== |
---|
65 | |
---|
66 | This class of code provides a reusable library of peripheral device |
---|
67 | drivers which can be tailored easily to a particular board. The |
---|
68 | libchip library is a collection of reusable software objects that |
---|
69 | correspond to standard controllers. Just as the hardware engineer |
---|
70 | chooses a standard controller when designing a board, the goal of |
---|
71 | this library is to let the software engineer do the same thing. |
---|
72 | |
---|
73 | The source code for the reusable peripheral driver library may be found |
---|
74 | in the directory ``c/src/lib/libchip``. The source code is further |
---|
75 | divided based upon the class of hardware. Example classes include serial |
---|
76 | communications controllers, real-time clocks, non-volatile memory, and |
---|
77 | network controllers. |
---|
78 | |
---|
79 | Questions to Ask |
---|
80 | ================ |
---|
81 | |
---|
82 | When evaluating what is required to support RTEMS applications on |
---|
83 | a particular target board, the following questions should be asked: |
---|
84 | |
---|
85 | - Does a BSP for this board exist? |
---|
86 | |
---|
87 | - Does a BSP for a similar board exists? |
---|
88 | |
---|
89 | - Is the board's CPU supported? |
---|
90 | |
---|
91 | If there is already a BSP for the board, then things may already be ready |
---|
92 | to start developing application software. All that remains is to verify |
---|
93 | that the existing BSP provides device drivers for all the peripherals |
---|
94 | on the board that the application will be using. For example, the application |
---|
95 | in question may require that the board's Ethernet controller be used and |
---|
96 | the existing BSP may not support this. |
---|
97 | |
---|
98 | If the BSP does not exist and the board's CPU model is supported, then |
---|
99 | examine the reusable chip library and existing BSPs for a close match. |
---|
100 | Other BSPs and libchip provide starting points for the development |
---|
101 | of a new BSP. It is often possible to copy existing components in |
---|
102 | the reusable chip library or device drivers from BSPs from different |
---|
103 | CPU families as the starting point for a new device driver. |
---|
104 | This will help reduce the development effort required. |
---|
105 | |
---|
106 | If the board's CPU family is supported but the particular CPU model on |
---|
107 | that board is not, then the RTEMS port to that CPU family will have to |
---|
108 | be augmented. After this is done, development of the new BSP can proceed. |
---|
109 | |
---|
110 | Otherwise both CPU dependent code and the BSP will have to be written. |
---|
111 | |
---|
112 | This type of development often requires specialized skills. If |
---|
113 | you need help in making these modifications to RTEMS, please |
---|
114 | consider using one of the RTEMS Service Providers. The current |
---|
115 | list of these is at http://www.rtems.org/support.html. |
---|
116 | |
---|
117 | CPU Dependent Executive Files |
---|
118 | ============================= |
---|
119 | |
---|
120 | The CPU dependent files in the RTEMS executive source code are found |
---|
121 | in the following directory: |
---|
122 | .. code:: c |
---|
123 | |
---|
124 | cpukit/score/cpu/*CPU* |
---|
125 | |
---|
126 | where *CPU* is replaced with the CPU family name. |
---|
127 | |
---|
128 | Within each CPU dependent directory inside the executive proper is a |
---|
129 | file named ``*CPU*.h`` which contains information about each of the |
---|
130 | supported CPU models within that family. |
---|
131 | |
---|
132 | CPU Dependent Support Files |
---|
133 | =========================== |
---|
134 | |
---|
135 | The CPU dependent support files contain routines which aid in the development |
---|
136 | of applications using that CPU family. For example, the support routines |
---|
137 | may contain standard trap handlers for alignment or floating point exceptions |
---|
138 | or device drivers for peripheral controllers found on the CPU itself. |
---|
139 | This class of code may be found in the following directory: |
---|
140 | |
---|
141 | .. code:: c |
---|
142 | |
---|
143 | c/src/lib/libcpu/*CPU* |
---|
144 | |
---|
145 | CPU model dependent support code is found in the following directory: |
---|
146 | |
---|
147 | .. code:: c |
---|
148 | |
---|
149 | c/src/lib/libcpu/*CPU*/*CPU_MODEL* |
---|
150 | |
---|
151 | *CPU_MODEL* may be a specific CPU model name or a name indicating a CPU |
---|
152 | core or a set of related CPU models. The file ``configure.ac`` in each ``c/src/lib/libcpu/*CPU*`` directory contains the logic which enables |
---|
153 | the appropriate subdirectories for the specific CPU model your BSP has. |
---|
154 | |
---|
155 | Board Support Package Structure |
---|
156 | =============================== |
---|
157 | |
---|
158 | The BSPs are all under the ``c/src/lib/libbsp`` directory. Below this |
---|
159 | directory, there is a subdirectory for each CPU family. Each BSP |
---|
160 | is found under the subdirectory for the appropriate processor |
---|
161 | family (m68k, powerpc, etc.). In addition, there is source code |
---|
162 | available which may be shared across all BSPs regardless of |
---|
163 | the CPU family or just across BSPs within a single CPU family. This |
---|
164 | results in a BSP using the following directories: |
---|
165 | .. code:: c |
---|
166 | |
---|
167 | c/src/lib/libbsp/shared |
---|
168 | c/src/lib/libbsp/*CPU*/shared |
---|
169 | c/src/lib/libbsp/*CPU*/*BSP* |
---|
170 | |
---|
171 | Under each BSP specific directory, there is a collection of |
---|
172 | subdirectories. For commonly provided functionality, the BSPs |
---|
173 | follow a convention on subdirectory naming. The following list |
---|
174 | describes the commonly found subdirectories under each BSP. |
---|
175 | |
---|
176 | - *console*: |
---|
177 | is technically the serial driver for the BSP rather |
---|
178 | than just a console driver, it deals with the board |
---|
179 | UARTs (i.e. serial devices). |
---|
180 | |
---|
181 | - *clock*: |
---|
182 | support for the clock tick - a regular time basis to the kernel. |
---|
183 | |
---|
184 | - *timer*: |
---|
185 | support of timer devices. |
---|
186 | |
---|
187 | - *rtc* or ``tod``: |
---|
188 | support for the hardware real-time clock. |
---|
189 | |
---|
190 | - *nvmem*: |
---|
191 | support for non-volatile memory such as EEPROM or Flash. |
---|
192 | |
---|
193 | - *network*: |
---|
194 | the Ethernet driver. |
---|
195 | |
---|
196 | - *shmsupp*: |
---|
197 | support of shared memory driver MPCI layer in a multiprocessor system, |
---|
198 | |
---|
199 | - *include*: |
---|
200 | include files for this BSP. |
---|
201 | |
---|
202 | - *gnatsupp*: |
---|
203 | BSP specific support for the GNU Ada run-time. Each BSP that wishes |
---|
204 | to have the possibility to map faults or exceptions into Ada language |
---|
205 | exceptions or hardware interrupts into Ada interrupt tasks must provide |
---|
206 | this support. |
---|
207 | |
---|
208 | There may be other directories in the BSP tree and the name should |
---|
209 | be indicative of the functionality of the code within that directory. |
---|
210 | |
---|
211 | The build order of the BSP is determined by the Makefile structure. |
---|
212 | This structure is discussed in more detail in the `Makefiles`_ |
---|
213 | chapter. |
---|
214 | |
---|
215 | *NOTE:* This manual refers to the gen68340 BSP for numerous concrete |
---|
216 | examples. You should have a copy of the gen68340 BSP available while |
---|
217 | reading this piece of documentation. This BSP is located in the |
---|
218 | following directory: |
---|
219 | .. code:: c |
---|
220 | |
---|
221 | c/src/lib/libbsp/m68k/gen68340 |
---|
222 | |
---|
223 | Later in this document, the $BSP340_ROOT label will be used |
---|
224 | to refer to this directory. |
---|
225 | |
---|
226 | .. COMMENT: COPYRIGHT (c) 1988-2008. |
---|
227 | |
---|
228 | .. COMMENT: On-Line Applications Research Corporation (OAR). |
---|
229 | |
---|
230 | .. COMMENT: All rights reserved. |
---|
231 | |
---|
232 | |
---|