.text
.global _start
_start:
@1.RCC时钟使能GPIOE RCC_MP_AHB4ENSETR[4]->1
LDR R0,=0x50000a28
LDR R1,[R0]
ORR R1,R1,#(0x3<<4)
ORR R1,R1,#(0x1<<1)
STR R1,[R0]
@2.设置PE10为输出模式 GPIOE_MODER[21:20]->01
@先清0
LDR R0,=0x50006000
LDR R1,[R0]
BIC R1,R1,#(0x3<<20)
@再置位
ORR R1,R1,#(0x1<<20)
BIC R1,R1,#(0x3<<16)
ORR R1,R1,#(0x1<<16)
STR R1,[R0]
LDR R0,=0x50007000
LDR R1,[R0]
BIC R1,R1,#[0X3<<20]
ORR R1,R1,#[0X1<<20]
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)
BIC R1,R1,#(0X1<<8)
STR R1,[R0]
LDR R0,=0x50007004
LDR R1,[R0]
BIC R1,R1,#[0X1<<10]
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)
BIC R1,R1,#(0x3<<16)
STR R1,[R0]
LDR R0,=0x50007008
LDR R1,[R0]
BIC R1,R1,#[0X3<<20]
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<<20]
STR R1,[R0]
LDR R0,=0x5000300C
LDR R1,[R0]
BIC R1,R1,#[0X3<<12]
STR R1,[R0]
@LED闪烁
loop:
BL led1_on
bl delay
BL led1_off
bl delay
BL led2_on
bl delay
BL led2_off
bl delay
BL led3_on
bl delay
BL led3_off
bl delay
BL bee_on
bl delay
BL bee_off
bl delay
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<<10)
str r1,[r0]
mov pc,lr
led2_off:
ldr r0,=0x50007014
ldr r1,[r0]
bic r1,r1,#(0x1<<10)
str r1,[r0]
mov pc,lr
led3_on:
ldr r0,=0x50006014
ldr r1,[r0]
orr r1,r1,#(0x1<<8)
str r1,[r0]
mov pc,lr
led3_off:
ldr r0,=0x50006014
ldr r1,[r0]
bic r1,r1,#(0x1<<8)
str r1,[r0]
mov pc,lr
bee_on:
ldr r0,=0x50003014
ldr r1,[r0]
orr r1,r1,#(0x1<<6)
str r1,[r0]
mov pc,lr
bee_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