天嵌 ARM开发社区

 找回密码
 注册
查看: 2025|回复: 4

关于ubuntu程序编译……

[复制链接]
westfantasy 发表于 2010-4-11 20:14:12 | 显示全部楼层 |阅读模式
弄了个简单的SPI程序:
#include "def.h"
#include "option.h"
#include "2440addr.h"
#include "2440lib.h"
#include "cc2420.h"

void spi_poll_done(void);

char RXdata[],TXdata[],test=0;
extern char RX[4];
/************SPI的初始化程序*************
    GPG2-----nSS0     GPE11-----MISO   
    GPE12----MOSI     GPE13-----SPICLK
    GPG0-----VREG_EN  GPG6------RSTn
    GPG10-----SFD     GPG7------CCA     
    GPG11----FIFO     GPG5-----FIFO_P  
    GPG1-----CSn
*****************************************/
void Init_SPI(void)
………………

编译后出现如下错误

2440spi.c:1:17: error: def.h: No such file or directory
2440spi.c:2:20: error: option.h: No such file or directory
2440spi.c:3:22: error: 2440addr.h: No such file or directory
2440spi.c:4:21: error: 2440lib.h: No such file or directory
2440spi.c:5:20: error: cc2420.h: No such file or directory
2440spi.c:6:22: error: mach/spi.h: No such file or directory
2440spi.c:7:27: error: linux/spi/spi.h: No such file or directory
2440spi.c: In function 'Init_SPI':
2440spi.c:25: error: 'rGPECON' undeclared (first use in this function)
2440spi.c:25: error: (Each undeclared identifier is reported only once
2440spi.c:25: error: for each function it appears in.)
2440spi.c:27: error: 'rGPGCON' undeclared (first use in this function)
2440spi.c:30: error: 'rGPGUP' undeclared (first use in this function)
2440spi.c:31: error: 'rGPEUP' undeclared (first use in this function)
2440spi.c:34: error: 'rSPPRE0' undeclared (first use in this function)
2440spi.c:35: error: 'rCLKCON' undeclared (first use in this function)
2440spi.c:36: error: 'rSPCON0' undeclared (first use in this function)
2440spi.c:37: error: 'rSPPIN0' undeclared (first use in this function)
2440spi.c:39: error: 'rSPTDAT0' undeclared (first use in this function)
2440spi.c: In function 'WRITE_SPI':
2440spi.c:46: error: 'rSPTDAT0' undeclared (first use in this function)
2440spi.c: In function 'spi_poll_done':
2440spi.c:52: error: 'rSPSTA0' undeclared (first use in this function)
2440spi.c: In function 'Read_SPI':
2440spi.c:58: error: 'rSPRDAT0' undeclared (first use in this function)
make: *** [proexe] Error 1

朋友说是在工程文件夹下,除了应用程序2440spi和makefile以外,还需要一个定义各个头文件的文件,但是查了很多资料都没有说是怎么写的……求各位高人指点,要再加一个什么文件,名字是什么?内容是什么?多谢,多谢!
亚瑟王 发表于 2010-4-12 10:59:40 | 显示全部楼层
你自己在源码中添加了哪些头文件你不知道吗?错误信息前面部分显示很多头文件找不到;后面部分显示变量找不到。
 楼主| westfantasy 发表于 2010-4-12 15:26:08 | 显示全部楼层
2# 亚瑟王
多谢回答,不好意思。我基础不是很好,现在就是不明白这些:
#include "def.h"
#include "option.h"
#include "2440addr.h"
#include "2440lib.h"
#include "cc2420.h"
还有这些:
/************SPI的初始化程序*************
    GPG2-----nSS0     GPE11-----MISO   
    GPE12----MOSI     GPE13-----SPICLK
    GPG0-----VREG_EN  GPG6------RSTn
    GPG10-----SFD     GPG7------CCA     
    GPG11----FIFO     GPG5-----FIFO_P  
    GPG1-----CSn
*****************************************/
这些算不算是添加在源码里了?有人说,用了#include "def.h"就要把def.h文件放到当前文件夹下,是这样吗?
亚瑟王 发表于 2010-4-12 17:59:30 | 显示全部楼层
你的说法是正确的,问题是处在你的源码中是否存在这个def.h文件。当然还有那些rCLKCON的变量。
 楼主| westfantasy 发表于 2010-4-12 19:28:14 | 显示全部楼层
Thank you!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

i.MX8系列ARM cortex A53 M4 工控板上一条 /1 下一条

Archiver|手机版|小黑屋|天嵌 嵌入式开发社区 ( 粤ICP备11094220号 )

GMT+8, 2024-5-18 14:47 , Processed in 1.015625 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表