【查错】第一个包含头文件的led程序

1.源文件led_on5.c内容:

2.起始文件start.S内容:

3.自动化编译文件Makefile内容:

4.头文件s3c2440_soc.h内容:

编译过程中出现的问题:

问题1:

[email protected]:~/workbook/hardware/005_LED$ ls
led_on5.c  Makefile  s3c2440_soc.h  start.S
[email protected]:~/workbook/hardware/005_LED$ make
arm-linux-gcc -c -o led_on5.o led_on5.c
led_on5.c:10:25: s3c2440_soc.h: No such file or directory
led_on5.c: In function `main':
led_on5.c:19: error: `GPFCON' undeclared (first use in this function)
led_on5.c:19: error: (Each undeclared identifier is reported only once
led_on5.c:19: error: for each function it appears in.)
led_on5.c:25: error: `GPFDAT' undeclared (first use in this function)
Makefile:2: recipe for target 'all' failed
make: *** [all] Error 1
[email protected]:~/workbook/hardware/005_LED$

解决方法:led_on5.c文件中,【#include <s3c2440_soc.h>】改为【#include "s3c2440_soc.h"】

解析:#include <stdio.h> #include "mytest.h "

问题2:

[email protected]:~/workbook/hardware/005_LED$ make

arm-linux-gcc -c -o led_on5.o led_on5.c
In file included from led_on5.c:10:
s3c2440_soc.h:9:55: warning: no newline at end of file
s3c2440_soc.h:2:1: unterminated #ifndef
Makefile:2: recipe for target 'all' failed
make: *** [all] Error 1

[email protected]:~/workbook/hardware/005_LED$

解决方法:屏蔽语句//#ifndef _s3c2440_soc_H


问题3:

[email protected]:~/workbook/hardware/005_LED$ make

arm-linux-gcc -c -o led_on5.o led_on5.c
arm-linux-gcc -c -o start.o start.S
start.S:57:9: warning: no newline at end of file
arm-linux-ld -Ttext 0 start.o led_on5.o  -o led_on5.elf
arm-linux-objcopy -O binary -S led_on5.elf led_on5.bin
arm-linux-objdump -D led_on5.elf > led_on5.dis
[email protected]:~/workbook/hardware/005_LED$ ls

led_on5.bin  led_on5.c  led_on5.dis  led_on5.elf  led_on5.o  Makefile  s3c2440_soc.h  start.o  start.S

未解决

猜你喜欢

转载自blog.csdn.net/weixin_39420903/article/details/79823487