arm汇编循环延时输出

test1.S

.text
.global test1
@global可以让其他程序调用
test1:
	mov r9,lr
	mov r6,#10
loop:	
	ldr r0,=fmt1
	bl printf
	bl delay 

	sub r6,r6,#1
	cmp r6,#0
	beq return_start
	@这里如果不等就往下执行b loop,否则执行beq后的
	b loop
	
delay:
	mov r5,#0x1000000
temp:
	sub r5,r5,#1
	cmp r5,#0
	bne temp
	bx lr 	
@这里像是退出子程序,返回上一层那样,然后继续回到loop,往下运行sub r6,r6,#1

return_start:
	mov lr,r9
	bx lr 
@这里退出程序,返回上一层是到bootcmd界面
fmt1:
	.asciz "yesterday is another day\n\r"

.end

makefile

all:start.bin clean
start.bin:start.o test1.o  uart.o libc.a 
	arm-linux-ld -Ttext=0x40000000 start.o test1.o uart.o libc.a  -o start.elf 
	arm-linux-objcopy -O binary -S start.elf start.bin 
	arm-linux-objdump -d start.elf > debug

start.o:start.S
	arm-linux-gcc -c -nostdlib -nostdinc start.S -o start.o 
test1.o:test1.S
	arm-linux-gcc -c -nostdlib -nostdinc test1.S -o test1.o 
clean:
	rm -rf start.o start.elf test1.o
注意其中还需要其他的文件

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值