cortex-A8汇编指令练习一

来源:互联网 发布:淘宝网秒杀系统异常 编辑:程序博客网 时间:2024/06/05 06:37


.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 0