-
Notifications
You must be signed in to change notification settings - Fork 0
/
basic.asm
229 lines (210 loc) · 3.07 KB
/
basic.asm
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
.thumb
.syntax unified
.section .interrupt_vector
.align 4
.word __stack_top
.word reset_handler
.word nmi_handler
.word hardfault_handler
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0 /* svcall_handler */
.word 0
.word 0
.word 0 /* pendingsv */
.word 0 /* systick_handler */
.word 0 /* irq0_handler */
.word 0 /* irq1_handler */
.word 0 /* irq2_handler */
.word 0 /* irq3_handler */
.word 0 /* irq4_handler */
.word 0 /* irq5_handler */
.word 0 /* irq6_handler */
.word 0 /* irq7_handler */
.word 0 /* irq8_handler */
.word 0 /* irq9_handler */
.word 0 /* irq10_handler */
.word 0 /* irq11_handler */
.word 0 /* irq12_handler */
.word 0 /* irq13_handler */
.word 0 /* irq14_handler */
.word 0 /* irq15_handler */
.word 0 /* irq16_handler */
.word 0 /* irq17_handler */
.word 0 /* irq18_handler */
.word 0 /* irq19_handler */
.word 0 /* irq20_handler */
.word 0 /* irq21_handler */
.word 0 /* irq22_handler */
.word 0 /* irq23_handler */
.word 0 /* irq24_handler */
.word 0 /* irq25_handler */
.word 0 /* irq26_handler */
.word 0 /* irq27_handler */
.text
.align 4
.global reset_handler
reset_handler:
.func reset_handler, reset_handler
.type reset_handler, %function
.thumb_func
init_gpio_pin:
ldr r1, =(1 << 17)
ldr r2, =port_dir_set
str r1, [r2]
set_led_on:
ldr r2, =port_out_set
str r1, [r2]
ldr r3, =(1 << 18)
wait_one_sec_on:
subs r3, #1
bne wait_one_sec_on
set_led_off:
ldr r2, =port_out_clear
str r1, [r2]
ldr r3, =(1 << 18)
wait_one_sec_off:
subs r3, #1
bne wait_one_sec_off
b set_led_on
.endfunc
nmi_handler:
.func nmi_handler, nmi_handler
.type nmi_handler, %function
.thumb_func
nop
.endfunc
hardfault_handler:
.func hardfault_handler, hardfault_handler
.type hardfault_handler, %function
.thumb_func
nop
.endfunc
.data
.align 4
__stack_top:
.section .port_table
port_dir:
.word 0
port_dir_clear:
.word 0
port_dir_set:
.word 0
port_dir_toggle:
.word 0
port_out:
.word 0
port_out_clear:
.word 0
port_out_set:
.word 0
port_out_toggle:
.word 0
port_in:
.word 0
port_ctrl:
.word 0
port_wrconfig:
.word 0
.word 0 /* reserved */
port_pmux0:
.byte 0
port_pmux1:
.byte 0
port_pmux2:
.byte 0
port_pmux3:
.byte 0
port_pmux4:
.byte 0
port_pmux5:
.byte 0
port_pmux6:
.byte 0
port_pmux7:
.byte 0
port_pmux8:
.byte 0
port_pmux9:
.byte 0
port_pmux10:
.byte 0
port_pmux11:
.byte 0
port_pmux12:
.byte 0
port_pmux13:
.byte 0
port_pmux14:
.byte 0
port_pmux15:
.byte 0
port_pincfg0:
.byte 0
port_pincfg1:
.byte 0
port_pincfg2:
.byte 0
port_pincfg3:
.byte 0
port_pincfg4:
.byte 0
port_pincfg5:
.byte 0
port_pincfg6:
.byte 0
port_pincfg7:
.byte 0
port_pincfg8:
.byte 0
port_pincfg9:
.byte 0
port_pincfg10:
.byte 0
port_pincfg11:
.byte 0
port_pincfg12:
.byte 0
port_pincfg13:
.byte 0
port_pincfg14:
.byte 0
port_pincfg15:
.byte 0
port_pincfg16:
.byte 0
port_pincfg17:
.byte 0
port_pincfg18:
.byte 0
port_pincfg19:
.byte 0
port_pincfg20:
.byte 0
port_pincfg21:
.byte 0
port_pincfg22:
.byte 0
port_pincfg23:
.byte 0
port_pincfg24:
.byte 0
port_pincfg25:
.byte 0
port_pincfg26:
.byte 0
port_pincfg27:
.byte 0
port_pincfg28:
.byte 0
port_pincfg29:
.byte 0
port_pincfg30:
.byte 0
port_pincfg31:
.byte 0