ARM笔记: GPIO口LED程序
扫描二维码
随时随地手机看文章
leds.bin:crt0.Sleds.c
arm-linux-gcc -g -c -o crt0.o crt0.S
arm-linux-gcc -g -c -o leds.o leds.c
arm-linux-ld -Ttext 0x00000000 -g crt0.o leds.o -o leds_elf
arm-linux-objcopy -O binary -S leds_elf leds.bin
arm-linux-objdump -D -m arm leds_elf>leds.dis
clean:
rm -f leds.dis leds.bin leds_elf *.o
.text
.global _start
_start:
ldr r0,=0x56000010
movr1,#0x0
strr1,[r0]
ldrsp,=1024*4
blmain
halt_loop:
b halt_loop;
#define GPFCON(*(volatile unsigned long *)0x56000050)
#define GPFDAT(*(volatile unsigned long *)0x56000054)
#define GPF4_OUT(1<<(4*2))//dfjlf
#define GPF5_OUT(1<<(5*2))
#define GPF6_OUT(1<<(6*2))
void Delay(volatile unsigned long dly)
{
for(;dly>0;dly--);
}
int main(void)
{
unsigned long i=4;
GPFCON=GPF4_OUT|GPF5_OUT|GPF6_OUT;
GPFDAT=0x11111111;
while(1)
{
GPFDAT=~(1<Delay(10000);
i++;
if(i==7)
i=4;
}
return 0;
}