.text
.global _start
_start:
@时钟使能
pb6 pf6 pe9
LDR r0,=0x50000A28
LDR r1,[r0]
ORR r1,r1,#(0x1<<4)
ORR r1,r1,#(0x1<<5)
ORR r1,r1,#(0x1<<1)
STR r1,[r0]
@配置GPIO模式
LDR r0,=0x50006000
LDR r1,[r0]
BIC r1,r1,#(0x2<<20)
ORR r1,r1,#(0x1<<20)
BIC r1,r1,#(0x2<<16)
ORR r1,r1,#(0x1<<16)
STR r1,[r0]
LDR r0,=0x50007000
LDR r1,[r0]
BIC r1,r1,#(0x2<<20)
ORR r1,r1,#(0x1<<20)
STR r1,[r0]
@配置GPIO推挽输出模式
LDR r0,=0x50006004
LDR r1,[r0]
BIC r1,r1,#(0x1<<10)
BIC r1,r1,#(0x1<<8)
STR r1,[r0]
LDR r0,=0x50007004
LDR r1,[r0]
BIC r1,r1,#(0x1<<10)
STR r1,[r0]
@配置GPIO为低速输出
LDR r0,=0x50006008
LDR r1,[r0]
BIC r1,r1,#(0x3<<20)
BIC r1,r1,#(0x3<<16)
STR r1,[r0]
LDR r0,=0x50007008
LDR r1,[r0]
BIC r1,r1,#(0x3<<20)
STR r1,[r0]
@设置PE10和PE8为无上下拉电阻
LDR r0,=0x5000600c
LDR r1,[r0]
BIC r1,r1,#(0x3<<20)
BIC r1,r1,#(0x3<<16)
STR r1,[r0]
LDR r0,=0x5000700c
LDR r1,[r0]
BIC r1,r1,#(0x3<<20)
STR r1,[r0]
loop:
bl led_on
bl delay
bl led_off
bl delay
b loop
led_on:
@设置小灯亮
LDR r0,=0x50006014
LDR r1,[r0]
ORR r1,r1,#(0x1<<10)
ORR r1,r1,#(0x1<<8)
STR r1,[r0]
LDR r0,=0x50007014
LDR r1,[r0]
ORR r1,r1,#(0x1<<10)
STR r1,[r0]
mov pc,lr
led_off:
@设置小灯灭
LDR r0,=0x50006014
LDR r1,[r0]
BIC r1,r1,#(0x1<<10)
BIC r1,r1,#(0x1<<8)
STR r1,[r0]
LDR r0,=0x50007014
LDR r1,[r0]
BIC r1,r1,#(0x1<<10)
STR r1,[r0]
mov pc,lr
delay:
LDR R3,=0x10000000
mm:
cmp r3,#0
subne r3,r3,#1
bne mm
mov pc,lr
.end
![](https://img-blog.csdnimg.cn/direct/7630870c810047ab846f0cf1a1b887b2.gif)