1 | @c |
---|
2 | @c COPYRIGHT (c) 1988-2002. |
---|
3 | @c On-Line Applications Research Corporation (OAR). |
---|
4 | @c All rights reserved. |
---|
5 | @c |
---|
6 | @c $Id$ |
---|
7 | @c |
---|
8 | |
---|
9 | @ifinfo |
---|
10 | @end ifinfo |
---|
11 | @chapter MIPS Specific Information |
---|
12 | |
---|
13 | The Real Time Executive for Multiprocessor Systems (RTEMS) |
---|
14 | is designed to be portable across multiple processor |
---|
15 | architectures. However, the nature of real-time systems makes |
---|
16 | it essential that the application designer understand certain |
---|
17 | processor dependent implementation details. These processor |
---|
18 | dependencies include calling convention, board support package |
---|
19 | issues, interrupt processing, exact RTEMS memory requirements, |
---|
20 | performance data, header files, and the assembly language |
---|
21 | interface to the executive. |
---|
22 | |
---|
23 | This document discusses the VENDOR XXX |
---|
24 | architecture dependencies in this port of RTEMS. The XXX |
---|
25 | family has a wide variety of CPU models within it. The part |
---|
26 | numbers ... |
---|
27 | |
---|
28 | XXX fill in some things here |
---|
29 | |
---|
30 | It is highly recommended that the XXX |
---|
31 | RTEMS application developer obtain and become familiar with the |
---|
32 | documentation for the processor being used as well as the |
---|
33 | documentation for the family as a whole. |
---|
34 | |
---|
35 | @subheading Architecture Documents |
---|
36 | |
---|
37 | IDT docs are online at http://www.idt.com/products/risc/Welcome.html |
---|
38 | |
---|
39 | For information on the XXX architecture, |
---|
40 | refer to the following documents available from VENDOR |
---|
41 | (@file{http//www.XXX.com/}): |
---|
42 | |
---|
43 | @itemize @bullet |
---|
44 | @item @cite{XXX Family Reference, VENDOR, PART NUMBER}. |
---|
45 | @end itemize |
---|
46 | |
---|
47 | @subheading MODEL SPECIFIC DOCUMENTS |
---|
48 | |
---|
49 | For information on specific processor models and |
---|
50 | their associated coprocessors, refer to the following documents: |
---|
51 | |
---|
52 | @itemize @bullet |
---|
53 | @item @cite{XXX MODEL Manual, VENDOR, PART NUMBER}. |
---|
54 | @item @cite{XXX MODEL Manual, VENDOR, PART NUMBER}. |
---|
55 | @end itemize |
---|
56 | |
---|
57 | @c |
---|
58 | @c COPYRIGHT (c) 1988-2002. |
---|
59 | @c On-Line Applications Research Corporation (OAR). |
---|
60 | @c All rights reserved. |
---|
61 | @c |
---|
62 | @c $Id$ |
---|
63 | @c |
---|
64 | |
---|
65 | @section CPU Model Dependent Features |
---|
66 | |
---|
67 | |
---|
68 | Microprocessors are generally classified into |
---|
69 | families with a variety of CPU models or implementations within |
---|
70 | that family. Within a processor family, there is a high level |
---|
71 | of binary compatibility. This family may be based on either an |
---|
72 | architectural specification or on maintaining compatibility with |
---|
73 | a popular processor. Recent microprocessor families such as the |
---|
74 | SPARC or PowerPC are based on an architectural specification |
---|
75 | which is independent or any particular CPU model or |
---|
76 | implementation. Older families such as the M68xxx and the iX86 |
---|
77 | evolved as the manufacturer strived to produce higher |
---|
78 | performance processor models which maintained binary |
---|
79 | compatibility with older models. |
---|
80 | |
---|
81 | RTEMS takes advantage of the similarity of the |
---|
82 | various models within a CPU family. Although the models do vary |
---|
83 | in significant ways, the high level of compatibility makes it |
---|
84 | possible to share the bulk of the CPU dependent executive code |
---|
85 | across the entire family. Each processor family supported by |
---|
86 | RTEMS has a list of features which vary between CPU models |
---|
87 | within a family. For example, the most common model dependent |
---|
88 | feature regardless of CPU family is the presence or absence of a |
---|
89 | floating point unit or coprocessor. When defining the list of |
---|
90 | features present on a particular CPU model, one simply notes |
---|
91 | that floating point hardware is or is not present and defines a |
---|
92 | single constant appropriately. Conditional compilation is |
---|
93 | utilized to include the appropriate source code for this CPU |
---|
94 | model's feature set. It is important to note that this means |
---|
95 | that RTEMS is thus compiled using the appropriate feature set |
---|
96 | and compilation flags optimal for this CPU model used. The |
---|
97 | alternative would be to generate a binary which would execute on |
---|
98 | all family members using only the features which were always |
---|
99 | present. |
---|
100 | |
---|
101 | This chapter presents the set of features which vary |
---|
102 | across SPARC implementations and are of importance to RTEMS. |
---|
103 | The set of CPU model feature macros are defined in the file |
---|
104 | cpukit/score/cpu/XXX/XXX.h based upon the particular CPU |
---|
105 | model defined on the compilation command line. |
---|
106 | |
---|
107 | @subsection CPU Model Name |
---|
108 | |
---|
109 | The macro CPU_MODEL_NAME is a string which designates |
---|
110 | the name of this CPU model. For example, for the MODEL |
---|
111 | processor, this macro is set to the string "XXX". |
---|
112 | |
---|
113 | @subsection Floating Point Unit |
---|
114 | |
---|
115 | The macro XXX_HAS_FPU is set to 1 to indicate that |
---|
116 | this CPU model has a hardware floating point unit and 0 |
---|
117 | otherwise. It does not matter whether the hardware floating |
---|
118 | point support is incorporated on-chip or is an external |
---|
119 | coprocessor. |
---|
120 | |
---|
121 | @subsection Another Optional Feature |
---|
122 | |
---|
123 | The macro XXX |
---|
124 | @c |
---|
125 | @c COPYRIGHT (c) 1988-2002. |
---|
126 | @c On-Line Applications Research Corporation (OAR). |
---|
127 | @c All rights reserved. |
---|
128 | @c |
---|
129 | @c $Id$ |
---|
130 | @c |
---|
131 | |
---|
132 | @section Calling Conventions |
---|
133 | |
---|
134 | |
---|
135 | Each high-level language compiler generates |
---|
136 | subroutine entry and exit code based upon a set of rules known |
---|
137 | as the compiler's calling convention. These rules address the |
---|
138 | following issues: |
---|
139 | |
---|
140 | @itemize @bullet |
---|
141 | @item register preservation and usage |
---|
142 | @item parameter passing |
---|
143 | @item call and return mechanism |
---|
144 | @end itemize |
---|
145 | |
---|
146 | A compiler's calling convention is of importance when |
---|
147 | interfacing to subroutines written in another language either |
---|
148 | assembly or high-level. Even when the high-level language and |
---|
149 | target processor are the same, different compilers may use |
---|
150 | different calling conventions. As a result, calling conventions |
---|
151 | are both processor and compiler dependent. |
---|
152 | |
---|
153 | @subsection Processor Background |
---|
154 | |
---|
155 | The MC68xxx architecture supports a simple yet |
---|
156 | effective call and return mechanism. A subroutine is invoked |
---|
157 | via the branch to subroutine (@code{XXX}) or the jump to subroutine |
---|
158 | (@code{XXX}) instructions. These instructions push the return address |
---|
159 | on the current stack. The return from subroutine (@code{XXX}) |
---|
160 | instruction pops the return address off the current stack and |
---|
161 | transfers control to that instruction. It is is important to |
---|
162 | note that the XXX call and return mechanism does not |
---|
163 | automatically save or restore any registers. It is the |
---|
164 | responsibility of the high-level language compiler to define the |
---|
165 | register preservation and usage convention. |
---|
166 | |
---|
167 | @subsection Calling Mechanism |
---|
168 | |
---|
169 | All RTEMS directives are invoked using either a @code{XXX} |
---|
170 | or @code{XXX} instruction and return to the user application via the |
---|
171 | @code{XXX} instruction. |
---|
172 | |
---|
173 | @subsection Register Usage |
---|
174 | |
---|
175 | As discussed above, the @code{XXX} and @code{XXX} instructions do |
---|
176 | not automatically save any registers. RTEMS uses the registers |
---|
177 | @b{D0}, @b{D1}, @b{A0}, and @b{A1} as scratch registers. These registers are |
---|
178 | not preserved by RTEMS directives therefore, the contents of |
---|
179 | these registers should not be assumed upon return from any RTEMS |
---|
180 | directive. |
---|
181 | |
---|
182 | @subsection Parameter Passing |
---|
183 | |
---|
184 | RTEMS assumes that arguments are placed on the |
---|
185 | current stack before the directive is invoked via the @code{XXX} or @code{XXX} |
---|
186 | instruction. The first argument is assumed to be closest to the |
---|
187 | return address on the stack. This means that the first argument |
---|
188 | of the C calling sequence is pushed last. The following |
---|
189 | pseudo-code illustrates the typical sequence used to call a |
---|
190 | RTEMS directive with three (3) arguments: |
---|
191 | |
---|
192 | @example |
---|
193 | @group |
---|
194 | push third argument |
---|
195 | push second argument |
---|
196 | push first argument |
---|
197 | invoke directive |
---|
198 | remove arguments from the stack |
---|
199 | @end group |
---|
200 | @end example |
---|
201 | |
---|
202 | The arguments to RTEMS are typically pushed onto the |
---|
203 | stack using a move instruction with a pre-decremented stack |
---|
204 | pointer as the destination. These arguments must be removed |
---|
205 | from the stack after control is returned to the caller. This |
---|
206 | removal is typically accomplished by adding the size of the |
---|
207 | argument list in bytes to the current stack pointer. |
---|
208 | |
---|
209 | @subsection User-Provided Routines |
---|
210 | |
---|
211 | All user-provided routines invoked by RTEMS, such as |
---|
212 | user extensions, device drivers, and MPCI routines, must also |
---|
213 | adhere to these calling conventions. |
---|
214 | |
---|
215 | @c |
---|
216 | @c COPYRIGHT (c) 1988-2002. |
---|
217 | @c On-Line Applications Research Corporation (OAR). |
---|
218 | @c All rights reserved. |
---|
219 | @c |
---|
220 | @c $Id$ |
---|
221 | @c |
---|
222 | |
---|
223 | @section Memory Model |
---|
224 | |
---|
225 | |
---|
226 | A processor may support any combination of memory |
---|
227 | models ranging from pure physical addressing to complex demand |
---|
228 | paged virtual memory systems. RTEMS supports a flat memory |
---|
229 | model which ranges contiguously over the processor's allowable |
---|
230 | address space. RTEMS does not support segmentation or virtual |
---|
231 | memory of any kind. The appropriate memory model for RTEMS |
---|
232 | provided by the targeted processor and related characteristics |
---|
233 | of that model are described in this chapter. |
---|
234 | |
---|
235 | @subsection Flat Memory Model |
---|
236 | |
---|
237 | The XXX family supports a flat 32-bit address |
---|
238 | space with addresses ranging from 0x00000000 to 0xFFFFFFFF (4 |
---|
239 | gigabytes). Each address is represented by a 32-bit value and |
---|
240 | is byte addressable. The address may be used to reference a |
---|
241 | single byte, word (2-bytes), or long word (4 bytes). Memory |
---|
242 | accesses within this address space are performed in big endian |
---|
243 | fashion by the processors in this family. |
---|
244 | |
---|
245 | Some of the XXX family members such as the |
---|
246 | XXX, XXX, and XXX support virtual memory and |
---|
247 | segmentation. The XXX requires external hardware support |
---|
248 | such as the XXX Paged Memory Management Unit coprocessor |
---|
249 | which is typically used to perform address translations for |
---|
250 | these systems. RTEMS does not support virtual memory or |
---|
251 | segmentation on any of the XXX family members. |
---|
252 | |
---|
253 | @c |
---|
254 | @c Interrupt Stack Frame Picture |
---|
255 | @c |
---|
256 | @c COPYRIGHT (c) 1988-2002. |
---|
257 | @c On-Line Applications Research Corporation (OAR). |
---|
258 | @c All rights reserved. |
---|
259 | @c |
---|
260 | @c $Id$ |
---|
261 | @c |
---|
262 | |
---|
263 | @section Interrupt Processing |
---|
264 | |
---|
265 | |
---|
266 | Different types of processors respond to the |
---|
267 | occurrence of an interrupt in its own unique fashion. In |
---|
268 | addition, each processor type provides a control mechanism to |
---|
269 | allow for the proper handling of an interrupt. The processor |
---|
270 | dependent response to the interrupt modifies the current |
---|
271 | execution state and results in a change in the execution stream. |
---|
272 | Most processors require that an interrupt handler utilize some |
---|
273 | special control mechanisms to return to the normal processing |
---|
274 | stream. Although RTEMS hides many of the processor dependent |
---|
275 | details of interrupt processing, it is important to understand |
---|
276 | how the RTEMS interrupt manager is mapped onto the processor's |
---|
277 | unique architecture. Discussed in this chapter are the XXX's |
---|
278 | interrupt response and control mechanisms as they pertain to |
---|
279 | RTEMS. |
---|
280 | |
---|
281 | @subsection Vectoring of an Interrupt Handler |
---|
282 | |
---|
283 | Depending on whether or not the particular CPU |
---|
284 | supports a separate interrupt stack, the XXX family has two |
---|
285 | different interrupt handling models. |
---|
286 | |
---|
287 | @subsubsection Models Without Separate Interrupt Stacks |
---|
288 | |
---|
289 | Upon receipt of an interrupt the XXX family |
---|
290 | members without separate interrupt stacks automatically perform |
---|
291 | the following actions: |
---|
292 | |
---|
293 | @itemize @bullet |
---|
294 | @item To Be Written |
---|
295 | @end itemize |
---|
296 | |
---|
297 | @subsubsection Models With Separate Interrupt Stacks |
---|
298 | |
---|
299 | Upon receipt of an interrupt the XXX family |
---|
300 | members with separate interrupt stacks automatically perform the |
---|
301 | following actions: |
---|
302 | |
---|
303 | @itemize @bullet |
---|
304 | @item saves the current status register (SR), |
---|
305 | |
---|
306 | @item clears the master/interrupt (M) bit of the SR to |
---|
307 | indicate the switch from master state to interrupt state, |
---|
308 | |
---|
309 | @item sets the privilege mode to supervisor, |
---|
310 | |
---|
311 | @item suppresses tracing, |
---|
312 | |
---|
313 | @item sets the interrupt mask level equal to the level of the |
---|
314 | interrupt being serviced, |
---|
315 | |
---|
316 | @item pushes an interrupt stack frame (ISF), which includes |
---|
317 | the program counter (PC), the status register (SR), and the |
---|
318 | format/exception vector offset (FVO) word, onto the supervisor |
---|
319 | and interrupt stacks, |
---|
320 | |
---|
321 | @item switches the current stack to the interrupt stack and |
---|
322 | vectors to an interrupt service routine (ISR). If the ISR was |
---|
323 | installed with the interrupt_catch directive, then the RTEMS |
---|
324 | interrupt handler will begin execution. The RTEMS interrupt |
---|
325 | handler saves all registers which are not preserved according to |
---|
326 | the calling conventions and invokes the application's ISR. |
---|
327 | @end itemize |
---|
328 | |
---|
329 | A nested interrupt is processed similarly by these |
---|
330 | CPU models with the exception that only a single ISF is placed |
---|
331 | on the interrupt stack and the current stack need not be |
---|
332 | switched. |
---|
333 | |
---|
334 | The FVO word in the Interrupt Stack Frame is examined |
---|
335 | by RTEMS to determine when an outer most interrupt is being |
---|
336 | exited. Since the FVO is used by RTEMS for this purpose, the |
---|
337 | user application code MUST NOT modify this field. |
---|
338 | |
---|
339 | The following shows the Interrupt Stack Frame for |
---|
340 | XXX CPU models with separate interrupt stacks: |
---|
341 | |
---|
342 | @ifset use-ascii |
---|
343 | @example |
---|
344 | @group |
---|
345 | +----------------------+ |
---|
346 | | Status Register | 0x0 |
---|
347 | +----------------------+ |
---|
348 | | Program Counter High | 0x2 |
---|
349 | +----------------------+ |
---|
350 | | Program Counter Low | 0x4 |
---|
351 | +----------------------+ |
---|
352 | | Format/Vector Offset | 0x6 |
---|
353 | +----------------------+ |
---|
354 | @end group |
---|
355 | @end example |
---|
356 | @end ifset |
---|
357 | |
---|
358 | @ifset use-tex |
---|
359 | @sp 1 |
---|
360 | @tex |
---|
361 | \centerline{\vbox{\offinterlineskip\halign{ |
---|
362 | \strut\vrule#& |
---|
363 | \hbox to 2.00in{\enskip\hfil#\hfil}& |
---|
364 | \vrule#& |
---|
365 | \hbox to 0.50in{\enskip\hfil#\hfil} |
---|
366 | \cr |
---|
367 | \multispan{3}\hrulefill\cr |
---|
368 | & Status Register && 0x0\cr |
---|
369 | \multispan{3}\hrulefill\cr |
---|
370 | & Program Counter High && 0x2\cr |
---|
371 | \multispan{3}\hrulefill\cr |
---|
372 | & Program Counter Low && 0x4\cr |
---|
373 | \multispan{3}\hrulefill\cr |
---|
374 | & Format/Vector Offset && 0x6\cr |
---|
375 | \multispan{3}\hrulefill\cr |
---|
376 | }}\hfil} |
---|
377 | @end tex |
---|
378 | @end ifset |
---|
379 | |
---|
380 | @ifset use-html |
---|
381 | @html |
---|
382 | <CENTER> |
---|
383 | <TABLE COLS=2 WIDTH="40%" BORDER=2> |
---|
384 | <TR><TD ALIGN=center><STRONG>Status Register</STRONG></TD> |
---|
385 | <TD ALIGN=center>0x0</TD></TR> |
---|
386 | <TR><TD ALIGN=center><STRONG>Program Counter High</STRONG></TD> |
---|
387 | <TD ALIGN=center>0x2</TD></TR> |
---|
388 | <TR><TD ALIGN=center><STRONG>Program Counter Low</STRONG></TD> |
---|
389 | <TD ALIGN=center>0x4</TD></TR> |
---|
390 | <TR><TD ALIGN=center><STRONG>Format/Vector Offset</STRONG></TD> |
---|
391 | <TD ALIGN=center>0x6</TD></TR> |
---|
392 | </TABLE> |
---|
393 | </CENTER> |
---|
394 | @end html |
---|
395 | @end ifset |
---|
396 | |
---|
397 | @subsection Interrupt Levels |
---|
398 | |
---|
399 | Eight levels (0-7) of interrupt priorities are |
---|
400 | supported by XXX family members with level seven (7) being |
---|
401 | the highest priority. Level zero (0) indicates that interrupts |
---|
402 | are fully enabled. Interrupt requests for interrupts with |
---|
403 | priorities less than or equal to the current interrupt mask |
---|
404 | level are ignored. |
---|
405 | |
---|
406 | Although RTEMS supports 256 interrupt levels, the |
---|
407 | XXX family only supports eight. RTEMS interrupt levels 0 |
---|
408 | through 7 directly correspond to XXX interrupt levels. All |
---|
409 | other RTEMS interrupt levels are undefined and their behavior is |
---|
410 | unpredictable. |
---|
411 | |
---|
412 | @subsection Disabling of Interrupts by RTEMS |
---|
413 | |
---|
414 | During the execution of directive calls, critical |
---|
415 | sections of code may be executed. When these sections are |
---|
416 | encountered, RTEMS disables interrupts to level seven (7) before |
---|
417 | the execution of this section and restores them to the previous |
---|
418 | level upon completion of the section. RTEMS has been optimized |
---|
419 | to insure that interrupts are disabled for less than |
---|
420 | RTEMS_MAXIMUM_DISABLE_PERIOD microseconds on a |
---|
421 | RTEMS_MAXIMUM_DISABLE_PERIOD_MHZ Mhz processor with |
---|
422 | zero wait states. These numbers will vary based the |
---|
423 | number of wait states and processor speed present on the target board. |
---|
424 | [NOTE: The maximum period with interrupts disabled is hand calculated. This |
---|
425 | calculation was last performed for Release |
---|
426 | RTEMS_RELEASE_FOR_MAXIMUM_DISABLE_PERIOD.] |
---|
427 | |
---|
428 | Non-maskable interrupts (NMI) cannot be disabled, and |
---|
429 | ISRs which execute at this level MUST NEVER issue RTEMS system |
---|
430 | calls. If a directive is invoked, unpredictable results may |
---|
431 | occur due to the inability of RTEMS to protect its critical |
---|
432 | sections. However, ISRs that make no system calls may safely |
---|
433 | execute as non-maskable interrupts. |
---|
434 | |
---|
435 | @subsection Interrupt Stack |
---|
436 | |
---|
437 | RTEMS allocates the interrupt stack from the |
---|
438 | Workspace Area. The amount of memory allocated for the |
---|
439 | interrupt stack is determined by the interrupt_stack_size field |
---|
440 | in the CPU Configuration Table. During the initialization |
---|
441 | process, RTEMS will install its interrupt stack. |
---|
442 | |
---|
443 | The mips port of RTEMS supports a software managed |
---|
444 | dedicated interrupt stack on those CPU models which do not |
---|
445 | support a separate interrupt stack in hardware. |
---|
446 | |
---|
447 | |
---|
448 | @c |
---|
449 | @c COPYRIGHT (c) 1988-2002. |
---|
450 | @c On-Line Applications Research Corporation (OAR). |
---|
451 | @c All rights reserved. |
---|
452 | @c |
---|
453 | @c $Id$ |
---|
454 | @c |
---|
455 | |
---|
456 | @section Default Fatal Error Processing |
---|
457 | |
---|
458 | |
---|
459 | Upon detection of a fatal error by either the |
---|
460 | application or RTEMS the fatal error manager is invoked. The |
---|
461 | fatal error manager will invoke the user-supplied fatal error |
---|
462 | handlers. If no user-supplied handlers are configured, the |
---|
463 | RTEMS provided default fatal error handler is invoked. If the |
---|
464 | user-supplied fatal error handlers return to the executive the |
---|
465 | default fatal error handler is then invoked. This chapter |
---|
466 | describes the precise operations of the default fatal error |
---|
467 | handler. |
---|
468 | |
---|
469 | @subsection Default Fatal Error Handler Operations |
---|
470 | |
---|
471 | The default fatal error handler which is invoked by |
---|
472 | the @code{rtems_fatal_error_occurred} directive when there is |
---|
473 | no user handler configured or the user handler returns control to |
---|
474 | RTEMS. The default fatal error handler disables processor interrupts, |
---|
475 | places the error code in @b{XXX}, and executes a @code{XXX} |
---|
476 | instruction to simulate a halt processor instruction. |
---|
477 | |
---|
478 | @c |
---|
479 | @c COPYRIGHT (c) 1988-2002. |
---|
480 | @c On-Line Applications Research Corporation (OAR). |
---|
481 | @c All rights reserved. |
---|
482 | @c |
---|
483 | @c $Id$ |
---|
484 | @c |
---|
485 | |
---|
486 | @section Board Support Packages |
---|
487 | |
---|
488 | |
---|
489 | An RTEMS Board Support Package (BSP) must be designed |
---|
490 | to support a particular processor and target board combination. |
---|
491 | This chapter presents a discussion of XXX specific BSP |
---|
492 | issues. For more information on developing a BSP, refer to the |
---|
493 | chapter titled Board Support Packages in the RTEMS |
---|
494 | Applications User's Guide. |
---|
495 | |
---|
496 | @subsection System Reset |
---|
497 | |
---|
498 | An RTEMS based application is initiated or |
---|
499 | re-initiated when the XXX processor is reset. When the |
---|
500 | XXX is reset, the processor performs the following actions: |
---|
501 | |
---|
502 | @itemize @bullet |
---|
503 | @item The tracing bits of the status register are cleared to |
---|
504 | disable tracing. |
---|
505 | |
---|
506 | @item The supervisor interrupt state is entered by setting the |
---|
507 | supervisor (S) bit and clearing the master/interrupt (M) bit of |
---|
508 | the status register. |
---|
509 | |
---|
510 | @item The interrupt mask of the status register is set to |
---|
511 | level 7 to effectively disable all maskable interrupts. |
---|
512 | |
---|
513 | @item The vector base register (VBR) is set to zero. |
---|
514 | |
---|
515 | @item The cache control register (CACR) is set to zero to |
---|
516 | disable and freeze the processor cache. |
---|
517 | |
---|
518 | @item The interrupt stack pointer (ISP) is set to the value |
---|
519 | stored at vector 0 (bytes 0-3) of the exception vector table |
---|
520 | (EVT). |
---|
521 | |
---|
522 | @item The program counter (PC) is set to the value stored at |
---|
523 | vector 1 (bytes 4-7) of the EVT. |
---|
524 | |
---|
525 | @item The processor begins execution at the address stored in |
---|
526 | the PC. |
---|
527 | @end itemize |
---|
528 | |
---|
529 | @subsection Processor Initialization |
---|
530 | |
---|
531 | The address of the application's initialization code |
---|
532 | should be stored in the first vector of the EVT which will allow |
---|
533 | the immediate vectoring to the application code. If the |
---|
534 | application requires that the VBR be some value besides zero, |
---|
535 | then it should be set to the required value at this point. All |
---|
536 | tasks share the same XXX's VBR value. Because interrupts |
---|
537 | are enabled automatically by RTEMS as part of the initialize |
---|
538 | executive directive, the VBR MUST be set before this directive |
---|
539 | is invoked to insure correct interrupt vectoring. If processor |
---|
540 | caching is to be utilized, then it should be enabled during the |
---|
541 | reset application initialization code. |
---|
542 | |
---|
543 | In addition to the requirements described in the |
---|
544 | Board Support Packages chapter of the Applications User's |
---|
545 | Manual for the reset code which is executed before the call to |
---|
546 | initialize executive, the XXX version has the following |
---|
547 | specific requirements: |
---|
548 | |
---|
549 | @itemize @bullet |
---|
550 | @item Must leave the S bit of the status register set so that |
---|
551 | the XXX remains in the supervisor state. |
---|
552 | |
---|
553 | @item Must set the M bit of the status register to remove the |
---|
554 | XXX from the interrupt state. |
---|
555 | |
---|
556 | @item Must set the master stack pointer (MSP) such that a |
---|
557 | minimum stack size of MINIMUM_STACK_SIZE bytes is provided for |
---|
558 | the initialize executive directive. |
---|
559 | |
---|
560 | @item Must initialize the XXX's vector table. |
---|
561 | @end itemize |
---|
562 | |
---|
563 | Note that the BSP is not responsible for allocating |
---|
564 | or installing the interrupt stack. RTEMS does this |
---|
565 | automatically as part of initialization. If the BSP does not |
---|
566 | install an interrupt stack and -- for whatever reason -- an |
---|
567 | interrupt occurs before initialize_executive is invoked, then |
---|
568 | the results are unpredictable. |
---|
569 | |
---|
570 | @c |
---|
571 | @c COPYRIGHT (c) 1988-2002. |
---|
572 | @c On-Line Applications Research Corporation (OAR). |
---|
573 | @c All rights reserved. |
---|
574 | @c |
---|
575 | @c $Id$ |
---|
576 | @c |
---|
577 | |
---|
578 | @section Processor Dependent Information Table |
---|
579 | |
---|
580 | |
---|
581 | Any highly processor dependent information required |
---|
582 | to describe a processor to RTEMS is provided in the CPU |
---|
583 | Dependent Information Table. This table is not required for all |
---|
584 | processors supported by RTEMS. This chapter describes the |
---|
585 | contents, if any, for a particular processor type. |
---|
586 | |
---|
587 | @subsection CPU Dependent Information Table |
---|
588 | |
---|
589 | The XXX version of the RTEMS CPU Dependent |
---|
590 | Information Table contains the information required to interface |
---|
591 | a Board Support Package and RTEMS on the XXX. This |
---|
592 | information is provided to allow RTEMS to interoperate |
---|
593 | effectively with the BSP. The C structure definition is given |
---|
594 | here: |
---|
595 | |
---|
596 | @example |
---|
597 | @group |
---|
598 | typedef struct @{ |
---|
599 | void (*pretasking_hook)( void ); |
---|
600 | void (*predriver_hook)( void ); |
---|
601 | void (*postdriver_hook)( void ); |
---|
602 | void (*idle_task)( void ); |
---|
603 | boolean do_zero_of_workspace; |
---|
604 | unsigned32 idle_task_stack_size; |
---|
605 | unsigned32 interrupt_stack_size; |
---|
606 | unsigned32 extra_mpci_receive_server_stack; |
---|
607 | void * (*stack_allocate_hook)( unsigned32 ); |
---|
608 | void (*stack_free_hook)( void* ); |
---|
609 | /* end of fields required on all CPUs */ |
---|
610 | |
---|
611 | /* XXX CPU family dependent stuff */ |
---|
612 | @} rtems_cpu_table; |
---|
613 | @end group |
---|
614 | @end example |
---|
615 | |
---|
616 | @table @code |
---|
617 | @item pretasking_hook |
---|
618 | is the address of the user provided routine which is invoked |
---|
619 | once RTEMS APIs are initialized. This routine will be invoked |
---|
620 | before any system tasks are created. Interrupts are disabled. |
---|
621 | This field may be NULL to indicate that the hook is not utilized. |
---|
622 | |
---|
623 | @item predriver_hook |
---|
624 | is the address of the user provided |
---|
625 | routine that is invoked immediately before the |
---|
626 | the device drivers and MPCI are initialized. RTEMS |
---|
627 | initialization is complete but interrupts and tasking are disabled. |
---|
628 | This field may be NULL to indicate that the hook is not utilized. |
---|
629 | |
---|
630 | @item postdriver_hook |
---|
631 | is the address of the user provided |
---|
632 | routine that is invoked immediately after the |
---|
633 | the device drivers and MPCI are initialized. RTEMS |
---|
634 | initialization is complete but interrupts and tasking are disabled. |
---|
635 | This field may be NULL to indicate that the hook is not utilized. |
---|
636 | |
---|
637 | @item idle_task |
---|
638 | is the address of the optional user |
---|
639 | provided routine which is used as the system's IDLE task. If |
---|
640 | this field is not NULL, then the RTEMS default IDLE task is not |
---|
641 | used. This field may be NULL to indicate that the default IDLE |
---|
642 | is to be used. |
---|
643 | |
---|
644 | @item do_zero_of_workspace |
---|
645 | indicates whether RTEMS should |
---|
646 | zero the Workspace as part of its initialization. If set to |
---|
647 | TRUE, the Workspace is zeroed. Otherwise, it is not. |
---|
648 | |
---|
649 | @item idle_task_stack_size |
---|
650 | is the size of the RTEMS idle task stack in bytes. |
---|
651 | If this number is less than MINIMUM_STACK_SIZE, then the |
---|
652 | idle task's stack will be MINIMUM_STACK_SIZE in byte. |
---|
653 | |
---|
654 | @item interrupt_stack_size |
---|
655 | is the size of the RTEMS |
---|
656 | allocated interrupt stack in bytes. This value must be at least |
---|
657 | as large as MINIMUM_STACK_SIZE. |
---|
658 | |
---|
659 | @item extra_mpci_receive_server_stack |
---|
660 | is the extra stack space allocated for the RTEMS MPCI receive server task |
---|
661 | in bytes. The MPCI receive server may invoke nearly all directives and |
---|
662 | may require extra stack space on some targets. |
---|
663 | |
---|
664 | @item stack_allocate_hook |
---|
665 | is the address of the optional user provided routine which allocates |
---|
666 | memory for task stacks. If this hook is not NULL, then a stack_free_hook |
---|
667 | must be provided as well. |
---|
668 | |
---|
669 | @item stack_free_hook |
---|
670 | is the address of the optional user provided routine which frees |
---|
671 | memory for task stacks. If this hook is not NULL, then a stack_allocate_hook |
---|
672 | must be provided as well. |
---|
673 | |
---|
674 | @item XXX |
---|
675 | is where the CPU family dependent stuff goes. |
---|
676 | |
---|
677 | @end table |
---|