0
点赞
收藏
分享

微信扫一扫

cortex-A8汇编指令练习一

.text
.extern uart_init
.extern printf .global _start
_start:
mov r5,lr @ 保存子程序链接寄存器 bl uart_init @ 初始化异步串口

@ 循环打印10次
mov r11,#10
loop:
ldr r0,=fmt @ 将fmt的内容加载到r0寄存器
@ 再作为第一参数传进printf
bl printf @ 跳转到printf程序
bl delay @ 跳转到delay程序 sub r11,r11,#1
cmp r11,#0
bne loop @ 寄存器r11减一直到其值等于零 mov lr,r5
bx lr @ 打印完毕,返回u-boot

@ 延时子程序
delay:
mov r12,#0x1000000
loop1:
sub r12,r12,#1
cmp r12,#0
bne loop1
bx lr @ printf函数的第一参数
fmt:
asciz ">>>>>>>> gec210 <<<<<<<<\n".end

举报

相关推荐

0 条评论