diff options
Diffstat (limited to 'firmware/target/sh/crt0.S')
-rw-r--r-- | firmware/target/sh/crt0.S | 219 |
1 files changed, 0 insertions, 219 deletions
diff --git a/firmware/target/sh/crt0.S b/firmware/target/sh/crt0.S deleted file mode 100644 index 0e8bbfdd68..0000000000 --- a/firmware/target/sh/crt0.S +++ /dev/null | |||
@@ -1,219 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Linus Nielsen Feltzing | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #include "config.h" | ||
22 | #include "cpu.h" | ||
23 | |||
24 | .section .init.text,"ax",@progbits | ||
25 | |||
26 | .global start | ||
27 | start: | ||
28 | |||
29 | mov.l .vbr_k,r1 | ||
30 | #ifdef DEBUG | ||
31 | /* If we have built our code to be loaded via the standalone GDB | ||
32 | * stub, we will have out VBR at some other location than 0x9000000. | ||
33 | * We must copy the trap vectors for the GDB stub to our vector table. */ | ||
34 | mov.l .orig_vbr_k,r2 | ||
35 | |||
36 | /* Move the invalid instruction vector (4) */ | ||
37 | mov #4,r0 | ||
38 | shll2 r0 | ||
39 | mov.l @(r0,r2),r3 | ||
40 | mov.l r3,@(r0,r1) | ||
41 | |||
42 | /* Move the invalid slot vector (6) */ | ||
43 | mov #6,r0 | ||
44 | shll2 r0 | ||
45 | mov.l @(r0,r2),r3 | ||
46 | mov.l r3,@(r0,r1) | ||
47 | |||
48 | /* Move the bus error vector (9) */ | ||
49 | mov #9,r0 | ||
50 | shll2 r0 | ||
51 | mov.l @(r0,r2),r3 | ||
52 | mov.l r3,@(r0,r1) | ||
53 | |||
54 | /* Move the DMA bus error vector (10) */ | ||
55 | mov #10,r0 | ||
56 | shll2 r0 | ||
57 | mov.l @(r0,r2),r3 | ||
58 | mov.l r3,@(r0,r1) | ||
59 | |||
60 | /* Move the NMI vector as well (11) */ | ||
61 | mov #11,r0 | ||
62 | shll2 r0 | ||
63 | mov.l @(r0,r2),r3 | ||
64 | mov.l r3,@(r0,r1) | ||
65 | |||
66 | /* Move the UserBreak vector as well (12) */ | ||
67 | mov #12,r0 | ||
68 | shll2 r0 | ||
69 | mov.l @(r0,r2),r3 | ||
70 | mov.l r3,@(r0,r1) | ||
71 | |||
72 | /* Move the breakpoint trap vector (32) */ | ||
73 | mov #32,r0 | ||
74 | shll2 r0 | ||
75 | mov.l @(r0,r2),r3 | ||
76 | mov.l r3,@(r0,r1) | ||
77 | |||
78 | /* Move the IO trap vector (33) */ | ||
79 | mov #33,r0 | ||
80 | shll2 r0 | ||
81 | mov.l @(r0,r2),r3 | ||
82 | mov.l r3,@(r0,r1) | ||
83 | |||
84 | /* Move the serial Rx interrupt vector (105) */ | ||
85 | mov #105,r0 | ||
86 | shll2 r0 | ||
87 | mov.l @(r0,r2),r3 | ||
88 | mov.l r3,@(r0,r1) | ||
89 | |||
90 | /* Move the single step trap vector (127) */ | ||
91 | mov #127,r0 | ||
92 | shll2 r0 | ||
93 | mov.l @(r0,r2),r3 | ||
94 | mov.l r3,@(r0,r1) | ||
95 | #endif /* DEBUG */ | ||
96 | ldc r1,vbr | ||
97 | |||
98 | mov #0,r0 | ||
99 | ldc r0,gbr | ||
100 | |||
101 | /* .iram copy is done first since it is reclaimed for other | ||
102 | * uninitialized sections */ | ||
103 | |||
104 | /* copy the .iram section */ | ||
105 | mov.l .iramcopy_k,r0 | ||
106 | mov.l .iram_k,r1 | ||
107 | mov.l .iramend_k,r2 | ||
108 | /* Note: We cannot put a PC relative load into the delay slot of a 'bra' | ||
109 | instruction (the offset would be wrong), but there is nothing else to | ||
110 | do before the loop, so the delay slot would be 'nop'. The cmp / bf | ||
111 | sequence is the same length, but more efficient. */ | ||
112 | cmp/hi r1,r2 | ||
113 | bf .noiramcopy | ||
114 | .iramloop: | ||
115 | mov.l @r0+,r3 | ||
116 | mov.l r3,@r1 | ||
117 | add #4,r1 | ||
118 | cmp/hi r1,r2 | ||
119 | bt .iramloop | ||
120 | .noiramcopy: | ||
121 | |||
122 | /* zero out .ibss */ | ||
123 | mov.l .iedata_k,r0 | ||
124 | mov.l .iend_k,r1 | ||
125 | bra .iedatastart | ||
126 | mov #0,r2 | ||
127 | .iedataloop: /* backwards is faster and shorter */ | ||
128 | mov.l r2,@-r1 | ||
129 | .iedatastart: | ||
130 | cmp/hi r0,r1 | ||
131 | bt .iedataloop | ||
132 | |||
133 | /* zero out bss */ | ||
134 | mov.l .edata_k,r0 | ||
135 | mov.l .end_k,r1 | ||
136 | bra .edatastart | ||
137 | mov #0,r2 | ||
138 | .edataloop: /* backwards is faster and shorter */ | ||
139 | mov.l r2,@-r1 | ||
140 | .edatastart: | ||
141 | cmp/hi r0,r1 | ||
142 | bt .edataloop | ||
143 | |||
144 | /* copy the .data section, for rombased execution */ | ||
145 | mov.l .datacopy_k,r0 | ||
146 | mov.l .data_k,r1 | ||
147 | cmp/eq r0,r1 | ||
148 | bt .nodatacopy /* Don't copy if src and dest are equal */ | ||
149 | mov.l .dataend_k,r2 | ||
150 | cmp/hi r1,r2 | ||
151 | bf .nodatacopy | ||
152 | .dataloop: | ||
153 | mov.l @r0+,r3 | ||
154 | mov.l r3,@r1 | ||
155 | add #4,r1 | ||
156 | cmp/hi r1,r2 | ||
157 | bt .dataloop | ||
158 | .nodatacopy: | ||
159 | |||
160 | /* Munge the main thread stack */ | ||
161 | mov.l .stackbegin_k,r0 | ||
162 | mov.l .stackend_k,r1 | ||
163 | mov r1,r15 | ||
164 | mov.l .deadbeef_k,r2 | ||
165 | .mungeloop: /* backwards is faster and shorter */ | ||
166 | mov.l r2,@-r1 | ||
167 | cmp/hi r0,r1 | ||
168 | bt .mungeloop | ||
169 | |||
170 | /* call the mainline */ | ||
171 | mov.l .main_k,r0 | ||
172 | jsr @r0 | ||
173 | nop | ||
174 | .hoo: | ||
175 | bra .hoo | ||
176 | nop | ||
177 | |||
178 | .align 2 | ||
179 | .vbr_k: | ||
180 | .long vectors | ||
181 | #ifdef DEBUG | ||
182 | .orig_vbr_k: | ||
183 | .long 0x09000000 | ||
184 | #endif | ||
185 | .iedata_k: | ||
186 | .long _iedata | ||
187 | .iend_k: | ||
188 | .long _iend | ||
189 | .iramcopy_k: | ||
190 | .long _iramcopy | ||
191 | .iram_k: | ||
192 | .long _iramstart | ||
193 | .iramend_k: | ||
194 | .long _iramend | ||
195 | .edata_k: | ||
196 | .long _edata | ||
197 | .end_k: | ||
198 | .long _end | ||
199 | .datacopy_k: | ||
200 | .long _datacopy | ||
201 | .data_k: | ||
202 | .long _datastart | ||
203 | .dataend_k: | ||
204 | .long _dataend | ||
205 | .stackbegin_k: | ||
206 | .long _stackbegin | ||
207 | .stackend_k: | ||
208 | .long _stackend | ||
209 | .deadbeef_k: | ||
210 | .long 0xdeadbeef | ||
211 | .main_k: | ||
212 | .long _main | ||
213 | |||
214 | .section .resetvectors | ||
215 | vectors: | ||
216 | .long start | ||
217 | .long _stackend | ||
218 | .long start | ||
219 | .long _stackend | ||