linux系统centos给smart210裸机开发板烧写流水led灯,通过SD卡

linux系统centos给smart210裸机开发板烧写流水led灯,通过SD卡

/*led.c源码*/
#define 	GPJ2CON 	(*(volatile unsigned long *) 0xE0200280)
#define 	GPJ2DAT		(*(volatile unsigned long *) 0xE0200284)
int main(void)					// LED闪烁
{
   int i,j;
   GPJ2CON = 0x00001111;				// 配置引脚
   while(1)							
   {
   	GPJ2DAT = 0xe;
   	for(i=0;i<100000;i++);	
   	for(j=0;j<4;j++){
   		GPJ2DAT =~(~GPJ2DAT<<1);	//LED off	
   		for(i=0;i<100000;i++);	
   	}
   }
   return 0;
}
/*start.S源码*/
.global _start
_start:
	// 调用c函数,LED闪烁
	bl	main							
halt:
	b halt
/*Makefile源码 注:交叉编译环境写自己的虚拟机中的地址*/
led.bin: start.o led.o
	/home/lsy/arm/opt/FriendlyARM/toolschain/4.4.3/bin/arm-linux-ld -Ttext 0xD0020010 -o led.elf $^
	/home/lsy/arm/opt/FriendlyARM/toolschain/4.4.3/bin/arm-linux-objcopy -O binary led.elf led.bin 

%.o : %.S
	/home/lsy/arm/opt/FriendlyARM/toolschain/4.4.3/bin/arm-linux-gcc -c -o $@ $<

%.o : %.c
	/home/lsy/arm/opt/FriendlyARM/toolschain/4.4.3/bin/arm-linux-gcc -c -o $@ $<
 
clean:
	rm *.o *.elf *.bin 

你可能感兴趣的:(arm开发板开发)