免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 995 | 回复: 0

Led_on_c [复制链接]

论坛徽章:
0
发表于 2011-12-23 01:27 |显示全部楼层
会有3个led灯亮起
 
crt0.S
  1. .text
  2. .global _start
  3. _start:
  4.     ldr r0,=0x53000000
  5.     mov r1,#0x0
  6.     str r1,[r0]
  7.     ldr sp,=1024*4
  8.     bl main
  9. halt_loop:
  10.     b halt_loop

关闭看门狗,设置堆栈

led_on_c.c

  1. #define GPBCON (*(volatile unsigned long *)0x56000010)
  2. #define GPBDAT (*(volatile unsigned long *)0x56000014)

  3. int main()
  4. {
  5.     GPBCON = 0x00005400;
  6.     GPBDAT = 0x00000000;

  7.     return 0;
  8. }

 

Makefile

  1. led_on_c.bin:crt0.S led_on_c.c
  2.     arm-linux-gcc -g -c -o crt0.o crt0.S
  3.     arm-linux-gcc -g -c -o led_on_c.o led_on_c.c
  4.     arm-linux-ld -Ttext 0x00000000 -g crt0.o led_on_c.o -o led_on_c_elf
  5.     arm-linux-objcopy -O binary -S led_on_c_elf led_on_c.bin
  6.     arm-linux-objdump -D -m arm led_on_c_elf > led_on_c.dis
  7. clean:
  8.     rm -rf led_on_c.dis led_on_c.bin led_on_c_elf *.o
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP