.text
.global _start
_start:
@1.RCC时钟使能GPIOE RCC_MP_AHB4ENSETR[4]->1
LDR r0,=0x50000A28
LDR r1,[r0]
ORR r1,r1,#(0x1<<4)
STR r1,[r0]
@RCC时钟使能GPIOF RCC_MP_AHB4ENSETR[5]->1
LDR r0,=0x50000A28
LDR r1,[r0]
ORR r1,r1,#(0x1<<5)
STR r1,[r0]
LDR r0,=0x50000A28
LDR r1,[r0]
ORR r1,r1,#(0x1<<1)
STR r1,[r0]
@2.设置PE10为输出模式 GPIOE_MODER[21:20]->01
LDR r0,=0x50006000
LDR r1,[r0]
BIC r1,r1,#(0x3<<20)
ORR r1,r1,#(0x1<<20)
STR r1,[r0]
LDR r0,=0x50007000
LDR r1,[r0]
BIC r1,r1,#(0x3<<12)
ORR r1,r1,#(0x1<<12)
STR r1,[r0]
LDR r0,=0x50003000
LDR r1,[r0]
BIC r1,r1,#(0x3<<12)
ORR r1,r1,#(0x1<<12)
STR r1,[r0]
@3.设置PE10为推挽输出 GPIOE_OTYPER[10]->0
LDR r0,=0x50006004
LDR r1,[r0]
BIC r1,r1,#(0x1<<10)
STR r1,[r0]
LDR r0,=0x50007004
LDR r1,[r0]
BIC r1,r1,#(0x1<<6)
STR r1,[r0]
LDR r0,=0x50003004
LDR r1,[r0]
BIC r1,r1,#(0x1<<6)
STR r1,[r0]
@4.设置PE10为低速输出 GPIOE_OSPEEDR[21:20]->00
LDR r0,=0x50006008
LDR r1,[r0]
BIC r1,r1,#(0x3<<20)
STR r1,[r0]
LDR r0,=0x50007008
LDR r1,[r0]
BIC r1,r1,#(0x3<<12)
STR r1,[r0]
LDR r0,=0x50003008
LDR r1,[r0]
BIC r1,r1,#(0x3<<12)
STR r1,[r0]
@5.设置PE10输出无上拉下拉 GPIOE_PUPDR[21:20]->00
LDR r0,=0x5000600C
LDR r1,[r0]
BIC r1,r1,#(0x3<<20)
STR r1,[r0]
LDR r0,=0x5000700C
LDR r1,[r0]
BIC r1,r1,#(0x3<<12)
STR r1,[r0]
LDR r0,=0x5000300C
LDR r1,[r0]
BIC r1,r1,#(0x3<<12)
STR r1,[r0]
loop:
@LED1灯亮
bl led1_on
@bl tim4_ch1_on
bl delay
@LED1灯灭
bl led1_off
bl delay
bl led2_on
bl delay
bl led2_off
bl delay
@bl tim4_ch1_off
b loop
led1_on:
LDR r0,=0x50006014
LDR r1,[r0]
ORR r1,r1,#(0x1<<10)
STR r1,[r0]
MOV pc,lr
led1_off:
LDR r0,=0x50006014
LDR r1,[r0]
BIC r1,r1,#(0x1<<10)
STR r1,[r0]
MOV pc,lr
led2_on:
LDR r0,=0x50007014
LDR r1,[r0]
ORR r1,r1,#(0x1<<6)
STR r1,[r0]
MOV pc,lr
led2_off:
LDR r0,=0x50007014
LDR r1,[r0]
BIC r1,r1,#(0x1<<6)
STR r1,[r0]
MOV pc,lr
tim4_ch1_on:
LDR r0,=0x50003014
LDR r1,[r0]
ORR r1,r1,#(0x1<<6)
STR r1,[r0]
MOV pc,lr
tim4_ch1_off:
LDR r0,=0x50003014
LDR r1,[r0]
BIC r1,r1,#(0x1<<6)
STR r1,[r0]
MOV pc,lr
delay:
LDR R1,=0X10000000
mm:
cmp R1,#0
SUBNE R1,R1,#1
BNE mm
mov pc,lr
.end