source: rtems/doc/porting/cpuinit.t @ ebd21dc

4.104.114.84.95
Last change on this file since ebd21dc was ebd21dc, checked in by Joel Sherrill <joel.sherrill@…>, on 10/07/99 at 22:32:44

Filled in descriptions for required fields in CPU Configuration Table.

  • Property mode set to 100644
File size: 5.3 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 CPU Initialization
10
11This section describes the general CPU and system initialization sequence
12as it pertains to the CPU dependent code.
13
14@section Introduction
15
16XXX general startup sequence description rewritten to make it more
17applicable to CPU depdent code in executive
18
19@section CPU Dependent Configuration Table
20
21The CPU Dependent Configuration Table contains information which tailors
22the behavior of RTEMS base Some of the fields in this table are required
23to be present in all ports of RTEMS.  These fields appear at the beginning
24of the data structure.  Fields past this point may be CPU family and CPU
25model dependent.  For example, a port may add a field to specify the
26default value for an interrupt mask register on the CPU.  This table is
27initialized by the Board Support Package and passed to the
28rtems_initialize_executive or rtems_initialize_executive_early directive.
29
30@example
31typedef struct @{
32  void       (*pretasking_hook)( void );
33  void       (*predriver_hook)( void );
34  void       (*postdriver_hook)( void );
35  void       (*idle_task)( void );
36  boolean      do_zero_of_workspace;
37  unsigned32   idle_task_stack_size;
38  unsigned32   interrupt_stack_size;
39  unsigned32   extra_mpci_receive_server_stack;
40  void *     (*stack_allocate_hook)( unsigned32 );
41  void       (*stack_free_hook)( void* );
42  /* end of fields required on all CPUs */
43
44  unsigned32   some_other_cpu_dependent_info;
45@}   rtems_cpu_table;
46@end example
47
48@table @code
49@item pretasking_hook
50is the address of the user provided routine which is invoked
51once RTEMS APIs are initialized.  This routine will be invoked
52before any system tasks are created.  Interrupts are disabled.
53This field may be NULL to indicate that the hook is not utilized.
54
55@item predriver_hook
56is the address of the user provided
57routine that is invoked immediately before the
58the device drivers and MPCI are initialized. RTEMS
59initialization is complete but interrupts and tasking are disabled.
60This field may be NULL to indicate that the hook is not utilized.
61
62@item postdriver_hook
63is the address of the user provided
64routine that is invoked immediately after the
65the device drivers and MPCI are initialized. RTEMS
66initialization is complete but interrupts and tasking are disabled.
67This field may be NULL to indicate that the hook is not utilized.
68
69@item idle_task
70is the address of the optional user
71provided routine which is used as the system's IDLE task.  If
72this field is not NULL, then the RTEMS default IDLE task is not
73used.  This field may be NULL to indicate that the default IDLE
74is to be used.
75
76@item do_zero_of_workspace
77indicates whether RTEMS should
78zero the Workspace as part of its initialization.  If set to
79TRUE, the Workspace is zeroed.  Otherwise, it is not.
80
81@item idle_task_stack_size
82is the size of the RTEMS idle task stack in bytes.
83If this number is less than MINIMUM_STACK_SIZE, then the
84idle task's stack will be MINIMUM_STACK_SIZE in byte.
85
86@item interrupt_stack_size
87is the size of the RTEMS allocated interrupt stack in bytes.
88This value must be at least as large as MINIMUM_STACK_SIZE.
89
90@item extra_mpci_receive_server_stack
91is the extra stack space allocated for the RTEMS MPCI receive server task
92in bytes.  The MPCI receive server may invoke nearly all directives and
93may require extra stack space on some targets.
94
95@item stack_allocate_hook
96is the address of the optional user provided routine which allocates
97memory for task stacks.  If this hook is not NULL, then a stack_free_hook
98must be provided as well.
99
100@item stack_free_hook
101is the address of the optional user provided routine which frees
102memory for task stacks.  If this hook is not NULL, then a stack_allocate_hook
103must be provided as well.
104
105@end table
106
107@section Initializing the CPU
108
109The _CPU_Initialize routine performs processor dependent initialization.
110
111@example
112void _CPU_Initialize(
113  rtems_cpu_table  *cpu_table,
114  void            (*thread_dispatch)  /* may be ignored */
115)
116@end example
117
118The thread_dispatch argument is the address of the entry point for the
119routine called at the end of an ISR once it has been decided a context
120switch is necessary.  On some compilation systems it is difficult to call
121a high-level language routine from assembly.  Providing the address of the
122_Thread_ISR_Dispatch routine allows the porter an easy way to obtain this
123critical address and thus provides an easy way to work around this
124limitation on these systems.
125
126If you encounter this problem save the entry point in a CPU dependent
127variable as shown below:
128
129@example
130_CPU_Thread_dispatch_pointer = thread_dispatch;
131@end example
132
133
134During the initialization of the context for tasks with floating point,
135the CPU dependent code is responsible for initializing the floating point
136context.  If there is not an easy way to initialize the FP context during
137Context_Initialize, then it is usually easier to save an "uninitialized"
138FP context here and copy it to the task's during Context_Initialize.  If
139this technique is used to initialize the FP contexts, then it is important
140to ensure that the state of the floating point unit is in a coherent,
141initialized state.
142
143Finally, this routine is responsible for copying the application's CPU
144Table into a locally accessible and modifiable area.  This is shown below:
145
146@example
147_CPU_Table = *cpu_table;
148@end example
149
150
Note: See TracBrowser for help on using the repository browser.