diff options
Diffstat (limited to 'lib/chibios/os/common/startup/e200/devices/SPC563Mxx/boot.S')
-rw-r--r-- | lib/chibios/os/common/startup/e200/devices/SPC563Mxx/boot.S | 192 |
1 files changed, 192 insertions, 0 deletions
diff --git a/lib/chibios/os/common/startup/e200/devices/SPC563Mxx/boot.S b/lib/chibios/os/common/startup/e200/devices/SPC563Mxx/boot.S new file mode 100644 index 000000000..c59fc095b --- /dev/null +++ b/lib/chibios/os/common/startup/e200/devices/SPC563Mxx/boot.S | |||
@@ -0,0 +1,192 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | /** | ||
18 | * @file SPC563Mxx/boot.s | ||
19 | * @brief SPC563Mxx boot-related code. | ||
20 | * | ||
21 | * @addtogroup PPC_BOOT | ||
22 | * @{ | ||
23 | */ | ||
24 | |||
25 | #include "boot.h" | ||
26 | |||
27 | #if defined(__HIGHTEC__) | ||
28 | #define se_bge bge | ||
29 | #endif | ||
30 | |||
31 | #if !defined(__DOXYGEN__) | ||
32 | |||
33 | /* BAM record.*/ | ||
34 | .section .boot, "ax" | ||
35 | |||
36 | #if BOOT_USE_VLE | ||
37 | .long 0x015A0000 | ||
38 | #else | ||
39 | .long 0x005A0000 | ||
40 | #endif | ||
41 | .long _reset_address | ||
42 | |||
43 | .align 2 | ||
44 | .globl _reset_address | ||
45 | .type _reset_address, @function | ||
46 | _reset_address: | ||
47 | #if BOOT_PERFORM_CORE_INIT | ||
48 | e_bl _coreinit | ||
49 | #endif | ||
50 | e_bl _ivinit | ||
51 | |||
52 | #if BOOT_RELOCATE_IN_RAM | ||
53 | /* | ||
54 | * Image relocation in RAM. | ||
55 | */ | ||
56 | e_lis r4, __ram_reloc_start__@h | ||
57 | e_or2i r4, __ram_reloc_start__@l | ||
58 | e_lis r5, __ram_reloc_dest__@h | ||
59 | e_or2i r5, __ram_reloc_dest__@l | ||
60 | e_lis r6, __ram_reloc_end__@h | ||
61 | e_or2i r6, r6, __ram_reloc_end__@l | ||
62 | .relloop: | ||
63 | se_cmpl r4, r6 | ||
64 | se_bge .relend | ||
65 | se_lwz r7, 0(r4) | ||
66 | se_addi r4, 4 | ||
67 | se_stw r7, 0(r5) | ||
68 | se_addi r5, 4 | ||
69 | se_b .relloop | ||
70 | .relend: | ||
71 | e_lis r3, _boot_address@h | ||
72 | e_or2i r3, _boot_address@l | ||
73 | mtctr r3 | ||
74 | se_bctrl | ||
75 | #else | ||
76 | e_b _boot_address | ||
77 | #endif | ||
78 | |||
79 | #if BOOT_PERFORM_CORE_INIT | ||
80 | .align 2 | ||
81 | _coreinit: | ||
82 | /* | ||
83 | * RAM clearing, this device requires a write to all RAM location in | ||
84 | * order to initialize the ECC detection hardware, this is going to | ||
85 | * slow down the startup but there is no way around. | ||
86 | */ | ||
87 | xor r0, r0, r0 | ||
88 | xor r1, r1, r1 | ||
89 | xor r2, r2, r2 | ||
90 | xor r3, r3, r3 | ||
91 | xor r4, r4, r4 | ||
92 | xor r5, r5, r5 | ||
93 | xor r6, r6, r6 | ||
94 | xor r7, r7, r7 | ||
95 | xor r8, r8, r8 | ||
96 | xor r9, r9, r9 | ||
97 | xor r10, r10, r10 | ||
98 | xor r11, r11, r11 | ||
99 | xor r12, r12, r12 | ||
100 | xor r13, r13, r13 | ||
101 | xor r14, r14, r14 | ||
102 | xor r15, r15, r15 | ||
103 | xor r16, r16, r16 | ||
104 | xor r17, r17, r17 | ||
105 | xor r18, r18, r18 | ||
106 | xor r19, r19, r19 | ||
107 | xor r20, r20, r20 | ||
108 | xor r21, r21, r21 | ||
109 | xor r22, r22, r22 | ||
110 | xor r23, r23, r23 | ||
111 | xor r24, r24, r24 | ||
112 | xor r25, r25, r25 | ||
113 | xor r26, r26, r26 | ||
114 | xor r27, r27, r27 | ||
115 | xor r28, r28, r28 | ||
116 | xor r29, r29, r29 | ||
117 | xor r30, r30, r30 | ||
118 | xor r31, r31, r31 | ||
119 | e_lis r4, __ram_start__@h | ||
120 | e_or2i r4, __ram_start__@l | ||
121 | e_lis r5, __ram_end__@h | ||
122 | e_or2i r5, __ram_end__@l | ||
123 | .cleareccloop: | ||
124 | se_cmpl r4, r5 | ||
125 | se_bge .cleareccend | ||
126 | e_stmw r16, 0(r4) | ||
127 | e_addi r4, r4, 64 | ||
128 | se_b .cleareccloop | ||
129 | .cleareccend: | ||
130 | |||
131 | /* | ||
132 | * Branch prediction enabled. | ||
133 | */ | ||
134 | e_li r3, BOOT_BUCSR_DEFAULT | ||
135 | mtspr 1013, r3 /* BUCSR */ | ||
136 | |||
137 | se_blr | ||
138 | #endif /* BOOT_PERFORM_CORE_INIT */ | ||
139 | |||
140 | /* | ||
141 | * Exception vectors initialization. | ||
142 | */ | ||
143 | _ivinit: | ||
144 | /* MSR initialization.*/ | ||
145 | e_lis r3, BOOT_MSR_DEFAULT@h | ||
146 | e_or2i r3, BOOT_MSR_DEFAULT@l | ||
147 | mtMSR r3 | ||
148 | |||
149 | /* IVPR initialization.*/ | ||
150 | e_lis r3, __ivpr_base__@h | ||
151 | e_or2i r3, __ivpr_base__@l | ||
152 | mtIVPR r3 | ||
153 | |||
154 | /* IVORs initialization.*/ | ||
155 | e_lis r3, _unhandled_exception@h | ||
156 | e_or2i r3, _unhandled_exception@l | ||
157 | |||
158 | mtspr 400, r3 /* IVOR0-15 */ | ||
159 | mtspr 401, r3 | ||
160 | mtspr 402, r3 | ||
161 | mtspr 403, r3 | ||
162 | mtspr 404, r3 | ||
163 | mtspr 405, r3 | ||
164 | mtspr 406, r3 | ||
165 | mtspr 407, r3 | ||
166 | mtspr 408, r3 | ||
167 | mtspr 409, r3 | ||
168 | mtspr 410, r3 | ||
169 | mtspr 411, r3 | ||
170 | mtspr 412, r3 | ||
171 | mtspr 413, r3 | ||
172 | mtspr 414, r3 | ||
173 | mtspr 415, r3 | ||
174 | mtspr 528, r3 /* IVOR32-34 */ | ||
175 | mtspr 529, r3 | ||
176 | mtspr 530, r3 | ||
177 | |||
178 | se_blr | ||
179 | |||
180 | .section .handlers, "ax" | ||
181 | |||
182 | /* | ||
183 | * Unhandled exceptions handler. | ||
184 | */ | ||
185 | .weak _unhandled_exception | ||
186 | .type _unhandled_exception, @function | ||
187 | _unhandled_exception: | ||
188 | se_b _unhandled_exception | ||
189 | |||
190 | #endif /* !defined(__DOXYGEN__) */ | ||
191 | |||
192 | /** @} */ | ||