思维导图
代码
.text
.global _start
_start:
@灯1
@gpio时钟使能 [4]->1 0x5000A28
LDR R0,=0x50000A28 @指定寄存器地址
LDR R1,[R0]@将寄存器取出放到R1
ORR R1,R1,#(0x1<<4)@将第四位设置为1
STR R1,[R0]@读取R0寄存器到R1
@PE10为输出 [21:20]->01 0x50006000
LDR R0,=0X50006000
LDR R1,[R0]
BIC R1,R1,#(0x3<<20)
ORR R1,R1,#(0x1<<20)
STR R1,[R0]
@PE10为推挽输出[10]->0 0x50006004
LDR R0,=0X50006004
LDR R1,[R0]
BIC R1,R1,#(0x1<<10)
STR R1,[R0]
@PE10为低速输出 [21:20]->00 0x5006008
LDR R0,=0X50006008
LDR R1,[R0]
BIC R1,R1,#(0x3<<20)
STR R1,[R0]
@PE10为无上下拉电阻 [21:20]->00 0x500600c
LDR R0,=0X5000600c
LDR R1,[R0]
BIC R1,R1,#(0x3<<20)
STR R1,[R0]
@灯2
@gpio时钟使能 [4]->1 0x5000A28
LDR R0,=0x50000A28 @指定寄存器地址
LDR R1,[R0]@将寄存器取出放到R1
ORR R1,R1,#(0x1<<5)@将第五位设置为1
STR R1,[R0]@读取R0寄存器到R1
@PE10为输出 [21:20]->01 0x50007000
LDR R0,=0X50007000
LDR R1,[R0]
BIC R1,R1,#(0x3<<20)
ORR R1,R1,#(0x1<<20)
STR R1,[R0]
@PE10为推挽输出[10]->0 0x50007004
LDR R0,=0X50007004
LDR R1,[R0]
BIC R1,R1,#(0x1<<10)
STR R1,[R0]
@PE10为低速输出 [21:20]->00 0x5007008
LDR R0,=0X50007008
LDR R1,[R0]
BIC R1,R1,#(0x3<<20)
STR R1,[R0]
@PE10为无上下拉电阻 [21:20]->00 0x500700c
LDR R0,=0X5000700c
LDR R1,[R0]
BIC R1,R1,#(0x3<<20)
STR R1,[R0]
@灯3
@gpio时钟使能 [4]->1 0x5000A28
LDR R0,=0x50000A28 @指定寄存器地址
LDR R1,[R0]@将寄存器取出放到R1
ORR R1,R1,#(0x1<<4)@将第四位设置为1
STR R1,[R0]@读取R0寄存器到R1
@PE10为输出 [17:16]->01 0x50006000
LDR R0,=0X50006000
LDR R1,[R0]
BIC R1,R1,#(0x3<<16)
ORR R1,R1,#(0x1<<16)
STR R1,[R0]
@PE10为推挽输出[8]->0 0x50006004
LDR R0,=0X50006004
LDR R1,[R0]
BIC R1,R1,#(0x1<<8)
STR R1,[R0]
@PE10为低速输出 [17:16]->00 0x5006008
LDR R0,=0X50006008
LDR R1,[R0]
BIC R1,R1,#(0x3<<16)
STR R1,[R0]
@PE10为无上下拉电阻 [17:16]->00 0x500600c
LDR R0,=0X5000600c
LDR R1,[R0]
BIC R1,R1,#(0x3<<16)
STR R1,[R0]
flash:
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 led1_on
bl led2_on
bl led3_on
bl delay
bl led1_off
bl led2_off
bl led3_off
bl delay
b flash
@led1
led1_on:
@gpio[10]->1 0x50006014
LDR R0,=0X50006014
LDR R1,[R0]
ORR R1,R1,#(0x1<<10)
STR R1,[R0]
MOV PC,LR
led1_off:
@gpio[10]->0 0x50006014
LDR R0,=0X50006014
LDR R1,[R0]
BIC R1,R1,#(0x1<<10)
STR R1,[R0]
MOV PC,LR
@led2
led2_on:
@gpio[10]->1 0x50007014
LDR R0,=0X50007014
LDR R1,[R0]
ORR R1,R1,#(0x1<<10)
STR R1,[R0]
MOV PC,LR
led2_off:
@gpio[10]->0 0x50007014
LDR R0,=0X50007014
LDR R1,[R0]
BIC R1,R1,#(0x1<<10)
STR R1,[R0]
MOV PC,LR
@led3
led3_on:
@gpio[10]->1 0x50006014
LDR R0,=0X50006014
LDR R1,[R0]
ORR R1,R1,#(0x1<<8)
STR R1,[R0]
MOV PC,LR
led3_off:
@gpio[10]->0 0x50006014
LDR R0,=0X50006014
LDR R1,[R0]
BIC R1,R1,#(0x1<<8)
STR R1,[R0]
MOV PC,LR
delay:
LDR R3,=0X10000000
mm:
cmp r3,#0
subne r3,r3,#1
bne mm
mov pc,lr
.end