哭泣的蒲公英 发表于 2012-6-20 21:37:19

sd卡编译过程出错,求指导

 
在编译sd卡程序是出现以下错误,错误程序如下,求各位大侠帮助解决以下,谢谢啦

//发命令到SD卡
void SdCommand(u8 command, u32 argument, u8 CRC)
{
SdWrite(command|0x40);
SdWrite(((unsigned char *)&argument));
SdWrite(((unsigned char *)&argument));
SdWrite(((unsigned char *)&argument));
SdWrite(((unsigned char *)&argument));
SdWrite(CRC);
}
User\SD.c(64): error: #79: expected a type specifier
User\SD.c: void SdCommand(u8 command, uc32 argument, u8 CRC)
User\SD.c: ^
User\SD.c(64): error: #90: function returning function is not allowed
User\SD.c: void SdCommand(u8 command, uc32 argument, u8 CRC)
User\SD.c: ^
User\SD.c(64): error: #141-D: unnamed prototyped parameters not allowed when body is present
User\SD.c: void SdCommand(u8 command, uc32 argument, u8 CRC)
User\SD.c: ^
User\SD.c(72): error: #167: argument of type "CRC_TypeDef *" is incompatible with parameter of type "unsigned char"
User\SD.c: SdWrite(CRC);
User\SD.c: ^
User\SD.c(88): error: #167: argument of type "int" is incompatible with parameter of type " (*)(CRC_TypeDef *)"
User\SD.c: SdCommand(0x00,0,0x95);
User\SD.c: ^
User\SD.c(103): error: #167: argument of type "int" is incompatible with parameter of type " (*)(CRC_TypeDef *)"
User\SD.c: SdCommand(0x01,0x00ffc000,0xff);
User\SD.c: ^
User\SD.c(78): warning: #177-D: variable "delay" was declared but never referenced
User\SD.c: int delay=0, trials=0;
User\SD.c: ^
User\SD.c(78): warning: #177-D: variable "trials" was declared but never referenced
User\SD.c: int delay=0, trials=0;
User\SD.c: ^
User\SD.c(122): error: #167: argument of type "int" is incompatible with parameter of type " (*)(CRC_TypeDef *)"
User\SD.c: SdCommand(0x18,address,0xff);
User\SD.c: ^
User\SD.c(170): error: #167: argument of type "int" is incompatible with parameter of type " (*)(CRC_TypeDef *)"
User\SD.c: SdCommand(0x11,address,0xff);

发表于 2012-6-21 11:08:54

RE:sd卡编译过程出错,求指导

有一些.H文件没有调用,你写的函数和外部声明的不一样,入口参数也不对。

wkuang 发表于 2012-6-28 21:12:33

RE:sd卡编译过程出错,求指导

1)"delay,trials这两个变量申明了,但是没有定义
2)"int" is incompatible with parameter of type " (*)(CRC_TypeDef *)",这个问题肯定是一个头文件没有包含,所以CRC_TypeDef *没有定义
3)90: function returning function is not allowed
User\SD.c: void SdCommand(u8 command, uc32 argument, u8 CRC)这个应该是函数中的return 有语法错误,函数申明为void类型的返回值

yjwpm 发表于 2012-6-28 23:02:40

RE:sd卡编译过程出错,求指导

User\SD.c(170): error: #167: argument of type "int" is incompatible with parameter of type " (*)(CRC_TypeDef *)"
这个错误是处在 SdWrite(((unsigned char *)&argument));这个函数中,好好检查一下就能找到。

蓝调街口-366393 发表于 2012-6-29 11:20:13

RE:sd卡编译过程出错,求指导

返回数据类型错误,"CRC_TypeDef *" 与"unsigned char"
等参数类型不相匹配,可以尝试强制转换或修改其中的数据类型以求一致:)

luweitang 发表于 2012-7-2 16:17:50

RE:sd卡编译过程出错,求指导

stm32 keil4 平台下 spi方式 sd卡读写程序 ,做一个demo
给你吧,参考一下,多想一点,有收获!
 
页: [1]
查看完整版本: sd卡编译过程出错,求指导