cstartup_pre.S
2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# 1 "cstartup.S"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "cstartup.S"
# 39 "cstartup.S"
# 1 "project.h" 1
# 44 "project.h"
# 1 "include/AT91SAM9263-EK.h" 1
# 45 "project.h" 2
# 1 "include/AT91SAM9263.h" 1
# 46 "project.h" 2
# 40 "cstartup.S" 2
# 55 "cstartup.S"
.globl reset_handler
.align 4
.section .vectors
.arm
_exception_vectors:
reset_vector:
ldr pc, =reset_handler
undef_vector:
b undef_vector
swi_vector:
b swi_vector
pabt_vector:
ldr pc, =pabt_handler
dabt_vector:
ldr pc, =dabt_handler
rsvd_vector:
b rsvd_vector
irq_vector:
b irq_handler
fiq_vector:
fiq_handler:
b fiq_handler
irq_handler:
sub lr, lr, #4
stmfd sp!, {lr}
mrs r14, SPSR
stmfd sp!, {r0,r14}
ldr r14, =( 0xFFFFF000)
ldr r0 , [r14, #( 0x00000100)]
str r14, [r14, #( 0x00000100)]
msr CPSR_c, #0x13
stmfd sp!, {r1-r3, r12, r14}
mov r14, pc
bx r0
ldmia sp!, {r1-r3, r12, r14}
msr CPSR_c, #0x12 | 0x80
ldr r14, =( 0xFFFFF000)
str r14, [r14, #( 0x00000130)]
ldmia sp!, {r0,r14}
msr SPSR_cxsf, r14
ldmia sp!, {pc}^
.section .text
reset_handler:
ldr pc, =_low_level_init
_low_level_init:
ldr r2, =_lp_ll_init
ldmia r2, {r0, r1}
mov sp, r1
mov lr, pc
bx r0
_stack_init:
ldr r2, =_lp_stack_init
ldmia r2, {r0, r1, r2}
msr CPSR_c, #0x17 | 0x80 | 0x40
mov sp, r0
sub r0, r0, r1
msr CPSR_c, #0x12 | 0x80 | 0x40
mov sp, r0
sub r0, r0, r2
msr CPSR_c, #0x13 | 0x40
mov sp, r0
_init_data:
ldr r2, =_lp_data
ldmia r2, {r1, r3, r4}
1:
cmp r3, r4
ldrcc r2, [r1], #4
strcc r2, [r3], #4
bcc 1b
_init_bss:
ldr r2, =_lp_bss
ldmia r2, {r3, r4}
mov r2, #0
1:
cmp r3, r4
strcc r2, [r3], #4
bcc 1b
_branch_main:
ldr r0, =main
mov lr, pc
bx r0
_lp_ll_init:
.word lowlevel_init
.word ((0x00300000) + (0x00014000))
_lp_stack_init:
.word ((0x00300000) + (0x00014000))
.word 8*3*4
.word 8*3*4
_lp_bss:
.word _sbss
.word _ebss
_lp_data:
.word _etext
.word _sdata
.word _edata