1 | .. SPDX-License-Identifier: CC-BY-SA-4.0 |
---|
2 | |
---|
3 | .. Copyright (C) 1988, 2002 On-Line Applications Research Corporation (OAR) |
---|
4 | |
---|
5 | CPU Initialization |
---|
6 | ################## |
---|
7 | |
---|
8 | This section describes the general CPU and system initialization sequence |
---|
9 | as it pertains to the CPU dependent code. |
---|
10 | |
---|
11 | Introduction |
---|
12 | ============ |
---|
13 | |
---|
14 | XXX general startup sequence description rewritten to make it more |
---|
15 | applicable to CPU depdent code in executive |
---|
16 | |
---|
17 | Initializing the CPU |
---|
18 | ==================== |
---|
19 | |
---|
20 | The _CPU_Initialize routine performs processor dependent initialization. |
---|
21 | |
---|
22 | .. code-block:: c |
---|
23 | |
---|
24 | void _CPU_Initialize( |
---|
25 | void (*thread_dispatch) /* may be ignored */ |
---|
26 | ) |
---|
27 | |
---|
28 | The thread_dispatch argument is the address of the entry point for the |
---|
29 | routine called at the end of an ISR once it has been decided a context |
---|
30 | switch is necessary. On some compilation systems it is difficult to call |
---|
31 | a high-level language routine from assembly. Providing the address of the |
---|
32 | _Thread_ISR_Dispatch routine allows the porter an easy way to obtain this |
---|
33 | critical address and thus provides an easy way to work around this |
---|
34 | limitation on these systems. |
---|
35 | |
---|
36 | If you encounter this problem save the entry point in a CPU dependent |
---|
37 | variable as shown below: |
---|
38 | |
---|
39 | .. code-block:: c |
---|
40 | |
---|
41 | _CPU_Thread_dispatch_pointer = thread_dispatch; |
---|
42 | |
---|
43 | During the initialization of the context for tasks with floating point, |
---|
44 | the CPU dependent code is responsible for initializing the floating point |
---|
45 | context. If there is not an easy way to initialize the FP context during |
---|
46 | Context_Initialize, then it is usually easier to save an "uninitialized" |
---|
47 | FP context here and copy it to the task's during Context_Initialize. If |
---|
48 | this technique is used to initialize the FP contexts, then it is important |
---|
49 | to ensure that the state of the floating point unit is in a coherent, |
---|
50 | initialized state. |
---|