aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios/os/common/startup/e200/devices/SPC560Dxx/boot_cw.s
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios/os/common/startup/e200/devices/SPC560Dxx/boot_cw.s')
-rw-r--r--lib/chibios/os/common/startup/e200/devices/SPC560Dxx/boot_cw.s200
1 files changed, 200 insertions, 0 deletions
diff --git a/lib/chibios/os/common/startup/e200/devices/SPC560Dxx/boot_cw.s b/lib/chibios/os/common/startup/e200/devices/SPC560Dxx/boot_cw.s
new file mode 100644
index 000000000..499fc7189
--- /dev/null
+++ b/lib/chibios/os/common/startup/e200/devices/SPC560Dxx/boot_cw.s
@@ -0,0 +1,200 @@
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 SPC560Dxx/boot.s
19 * @brief SPC560Dxx boot-related code.
20 *
21 * @addtogroup PPC_BOOT
22 * @{
23 */
24
25#include "boot.h"
26
27#if !defined(__DOXYGEN__)
28
29 .extern _boot_address
30 .extern __ram_start__
31 .extern __ram_end__
32 .extern __ivpr_base__
33
34 .extern _IVOR0, _IVOR1, _IVOR2, _IVOR3, _IVOR4, _IVOR5
35 .extern _IVOR6, _IVOR7, _IVOR8, _IVOR9, _IVOR10, _IVOR11
36 .extern _IVOR12, _IVOR13, _IVOR14, _IVOR15
37
38 /* BAM record.*/
39 .section .boot, 16
40
41 .long 0x015A0000
42 .long _reset_address
43
44 .align 4
45 .globl _reset_address
46 .type _reset_address, @function
47_reset_address:
48#if BOOT_PERFORM_CORE_INIT
49 se_bl _coreinit
50#endif
51 se_bl _ivinit
52
53#if BOOT_RELOCATE_IN_RAM
54 /*
55 * Image relocation in RAM.
56 */
57 e_lis r4, __ram_reloc_start__@h
58 e_or2i r4, r4, __ram_reloc_start__@l
59 e_lis r5, __ram_reloc_dest__@h
60 e_or2i r5, r5, __ram_reloc_dest__@l
61 e_lis r6, __ram_reloc_end__@h
62 e_or2i r6, r6, __ram_reloc_end__@l
63.relloop:
64 se_cmpl r4, r6
65 se_bge .relend
66 se_lwz r7, 0(r4)
67 se_addi r4, 4
68 se_stw r7, 0(r5)
69 se_addi r5, 4
70 se_b .relloop
71.relend:
72 e_lis r3, _boot_address@h
73 e_or2i r3, _boot_address@l
74 mtctr r3
75 se_bctrl
76#else
77 e_b _boot_address
78#endif
79
80#if BOOT_PERFORM_CORE_INIT
81 .align 4
82_coreinit:
83 /*
84 * RAM clearing, this device requires a write to all RAM location in
85 * order to initialize the ECC detection hardware, this is going to
86 * slow down the startup but there is no way around.
87 */
88 xor r0, r0, r0
89 xor r1, r1, r1
90 xor r2, r2, r2
91 xor r3, r3, r3
92 xor r4, r4, r4
93 xor r5, r5, r5
94 xor r6, r6, r6
95 xor r7, r7, r7
96 xor r8, r8, r8
97 xor r9, r9, r9
98 xor r10, r10, r10
99 xor r11, r11, r11
100 xor r12, r12, r12
101 xor r13, r13, r13
102 xor r14, r14, r14
103 xor r15, r15, r15
104 xor r16, r16, r16
105 xor r17, r17, r17
106 xor r18, r18, r18
107 xor r19, r19, r19
108 xor r20, r20, r20
109 xor r21, r21, r21
110 xor r22, r22, r22
111 xor r23, r23, r23
112 xor r24, r24, r24
113 xor r25, r25, r25
114 xor r26, r26, r26
115 xor r27, r27, r27
116 xor r28, r28, r28
117 xor r29, r29, r29
118 xor r30, r30, r30
119 xor r31, r31, r31
120 e_lis r4, __ram_start__@h
121 e_or2i r4, __ram_start__@l
122 e_lis r5, __ram_end__@h
123 e_or2i r5, __ram_end__@l
124.cleareccloop:
125 se_cmpl r4, r5
126 se_bge .cleareccend
127 e_stmw r16, 0(r4)
128 e_addi r4, r4, 64
129 se_b .cleareccloop
130.cleareccend:
131
132 /*
133 * Branch prediction enabled.
134 */
135 e_li r3, BOOT_BUCSR_DEFAULT
136 mtspr 1013, r3 /* BUCSR */
137
138 se_blr
139#endif /* BOOT_PERFORM_CORE_INIT */
140
141 /*
142 * Exception vectors initialization.
143 */
144 .align 4
145_ivinit:
146 /* MSR initialization.*/
147 e_lis r3, BOOT_MSR_DEFAULT@h
148 e_ori r3, r3, BOOT_MSR_DEFAULT@l
149 mtMSR r3
150
151 /* IVPR initialization.*/
152 e_lis r3, __ivpr_base__@h
153 e_or2i r3, __ivpr_base__@l
154 mtIVPR r3
155
156 se_blr
157
158 .section .ivors, text_vle
159 .align 16
160 .globl IVORS
161IVORS:
162 e_b _IVOR0
163 .align 16
164 e_b _IVOR1
165 .align 16
166 e_b _IVOR2
167 .align 16
168 e_b _IVOR3
169 .align 16
170 e_b _IVOR4
171 .align 16
172 e_b _IVOR5
173 .align 16
174 e_b _IVOR6
175 .align 16
176 e_b _IVOR7
177 .align 16
178 e_b _IVOR8
179 .align 16
180 e_b _IVOR9
181 .align 16
182 e_b _IVOR10
183 .align 16
184 e_b _IVOR11
185 .align 16
186 e_b _IVOR12
187 .align 16
188 e_b _IVOR13
189 .align 16
190 e_b _IVOR14
191 .align 16
192 e_b _IVOR15
193
194 .section .handlers, text_vle
195 .align 16
196
197
198#endif /* !defined(__DOXYGEN__) */
199
200/** @} */