summaryrefslogtreecommitdiff
path: root/tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_ARM_MICRO/vector_functions.s
blob: 462eb73c100c460c38372e128577ce0523a55617 (plain)
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
;/* mbed Microcontroller Library - InterruptIn
; * Copyright (c) 2006-2009 ARM Limited. All rights reserved.
; */
 
#line 1 "vector_functions.s"
;
;
;

#line 1 "vector_defns.h"



 



 

#line 21 "vector_defns.h"


















#line 47 "vector_defns.h"


#line 58 "vector_defns.h"


















#line 6 "vector_functions.s"


        AREA    VECFUNCS, CODE, READONLY
        ARM
        PRESERVE8





        EXPORT __mbed_fiq [WEAK]
        EXPORT __mbed_undef [WEAK]
        EXPORT __mbed_prefetch_abort [WEAK]
        EXPORT __mbed_data_abort [WEAK]
        EXPORT __mbed_irq [WEAK]
        EXPORT __mbed_swi [WEAK]
        EXPORT __mbed_dcc_irq [WEAK]
        EXPORT __mbed_reset [WEAK]
        IMPORT __mbed_init_realmonitor

;
;
__mbed_fiq
        B       __mbed_fiq

;
;
__mbed_undef
        LDR     PC, =0x7fffffa0

;
;
__mbed_prefetch_abort
        LDR     PC, =0x7fffffb0

;
;
__mbed_data_abort
        LDR     PC, =0x7fffffc0

;
;
;
;
;
;
;
;
;
__mbed_irq
        ;
        MSR     CPSR_c, #0x1F:OR:0x80:OR:0x40
                
        ;
        STMDB   sp!, {r0-r3,r12,lr}    

        ;
        MOV	r0, #0xFFFFFF00
        LDR	r0, [r0]	

        ;
        MOV     lr, pc       
        BX      r0           
			    				
        ;
        MOV	r0, #0xFFFFFF00
        STR	r0, [r0]			;
				
        ;
        LDMFD   sp!,{r0-r3,r12,lr}

        ;
        MSR     CPSR_c, #0x12:OR:0x80:OR:0x40

        ;
        SUBS    pc, lr, #4 

;
;
;
;
__mbed_swi
        ;
        ;
        STMFD   sp!, {a4, r4, ip, lr}

        ;
        LDR     r4, =0x40000040

        ;
        ;
        LDR     a4, =0x00940000
        LDR	PC, =0x7ffff820				

;
;
;
;
__mbed_dcc_irq

        ;
			
        ;
        LDMFD    sp!,{r0-r3,r12,lr}

        ;
        MSR     CPSR_c, #0x12:OR:0x80:OR:0x40

        ;
				
        ;
        SUB     lr, lr, #4              ;
        STMFD   sp!, {ip,lr}            ;
			
        ;
        LDR     LR, =0xfffff000
        STR     LR, [LR, #0xf00]
			
        ;
        ;
        ;
        ;
        LDR     PC, =0x7fffffe0			 

;
; __mbed_reset is called after reset
; we setup the stacks and realmonitor, then call Reset_Handler like on M3

; Reset Handler

Reset_Handler   PROC
                EXPORT  Reset_Handler             [WEAK]
                IMPORT  SystemInit
                IMPORT  __main
                LDR     R0, =SystemInit
                MOV     LR, PC       
                BX      R0
                LDR     R0, =__main
                BX      R0
                ENDP

__mbed_reset

        ;

        LDR     R0, =(0x40000000 + 0x8000)

        ;
        MSR     CPSR_c, #0x1B:OR:0x80:OR:0x40
        MOV     SP, R0
        SUB     R0, R0, #0x00000040

        ;
        MSR     CPSR_c, #0x17:OR:0x80:OR:0x40
        MOV     SP, R0
        SUB     R0, R0, #0x00000040

        ;
        MSR     CPSR_c, #0x11:OR:0x80:OR:0x40
        MOV     SP, R0
        SUB     R0, R0, #0x00000000

        ;
        MSR     CPSR_c, #0x12:OR:0x80:OR:0x40
        MOV     SP, R0
        SUB     R0, R0, #0x00000040

        ;
        MSR     CPSR_c, #0x13:OR:0x80:OR:0x40
        MOV     SP, R0
        SUB     R0, R0, #0x00000040

        ;
        MSR     CPSR_c, #0x10
        MOV     SP, R0

        ;
        LDR     R0, =__mbed_init_realmonitor
        MOV     LR, PC       
        BX      R0           
        
        ;
        LDR     R0, =Reset_Handler
        BX      R0

        
        END