编写linux下跑马灯应用程序,01 arm11 led 跑马灯程序

.text

.globl _start

_start:

ldr r0, =0x70000000

orr r0, r0, #0x13

mcr p15, 0, r0, c15, c2, 4

ldr r0, =0x7e004000

mov r1, #0

str r1, [r0]

ldr sp, =8*1024

bl xxxx

b .

start.S文件代码;

void delay ()

{

int i;

for (i = 0; i < 100000; i++)

;

}

int xxxx (void)

{

volatile unsigned long *gpmcon = (volatile unsigned long *)0x7f008820;volatile unsigned long *gpmdat = (volatile unsigned long *)0x7f008824;

int i;

for (i = 1; i <= 4; i++){

if (1 == i){

*gpmcon &= ~0xffff;

*gpmcon |= 0x1;

}else if (2 == i){

*gpmcon &= ~0xffff;

*gpmcon |= 0x10;

}else if (3 == i){

*gpmcon &= ~0xffff;

*gpmcon |= 0x100;

}else if (4 == i){

*gpmcon &= ~0xffff;

*gpmcon |= 0x1000;

i = 0;

}

*gpmdat = 0;

delay();

}

return 0;

}

led.c 文件代码;

all:start.o led.o

arm-linux-ld -Ttext 0 -o led.elf start.o led.o

arm-linux-objcopy -O binary led.elf led.bin

arm-linux-objdump -D led.elf > led.dis

cp led.bin /tftpboot/led.bin

start.o:

arm-linux-gcc -c start.S -o start.o

led.o:

arm-linux-gcc -c -o led.o led.c

clean:

rm -rf *.o *.elf *.dis *.bin /tftpboot/*.bin

Makefile文件代码;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值