source: rtems/doc/porting/cpuinit.t @ ebd21dc
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
2@c  COPYRIGHT (c) 1988-1998.
3@c  On-Line Applications Research Corporation (OAR).
4@c  All rights reserved.
6@c  $Id$
9@chapter CPU Initialization
11This section describes the general CPU and system initialization sequence
12as it pertains to the CPU dependent code.
14@section Introduction
16XXX general startup sequence description rewritten to make it more
17applicable to CPU depdent code in executive
19@section CPU Dependent Configuration Table
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.
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 */
44  unsigned32   some_other_cpu_dependent_info;
45@}   rtems_cpu_table;
46@end example
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
105@end table
107@section Initializing the CPU
109The _CPU_Initialize routine performs processor dependent initialization.
112void _CPU_Initialize(
113  rtems_cpu_table  *cpu_table,
114  void            (*thread_dispatch)  /* may be ignored */
116@end example
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.
126If you encounter this problem save the entry point in a CPU dependent
127variable as shown below:
130_CPU_Thread_dispatch_pointer = thread_dispatch;
131@end example
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.
143Finally, this routine is responsible for copying the application's CPU
144Table into a locally accessible and modifiable area.  This is shown below:
147_CPU_Table = *cpu_table;
148@end example
Note: See TracBrowser for help on using the repository browser.