你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

查看: 8974|回复: 5

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

[复制链接]

4

主题

12

回帖

0

蝴蝶豆

初级会员

最后登录
2020-9-5
发表于 2012-6-20 21:37:19 | 显示全部楼层 |阅读模式
 
在编译sd卡程序是出现以下错误,错误程序如下,求各位大侠帮助解决以下,谢谢啦

//发命令到SD卡
void SdCommand(u8 command, u32 argument, u8 CRC)
{
SdWrite(command|0x40);
SdWrite(((unsigned char *)&argument)[0]);
SdWrite(((unsigned char *)&argument)[1]);
SdWrite(((unsigned char *)&argument)[2]);
SdWrite(((unsigned char *)&argument)[3]);
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);
回复

使用道具 举报

134

主题

4489

回帖

239

蝴蝶豆

版主

最后登录
2020-12-9
发表于 2012-6-21 11:08:54 | 显示全部楼层

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

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

使用道具 举报

4

主题

224

回帖

0

蝴蝶豆

初级会员

最后登录
2020-7-4
发表于 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类型的返回值
回复 支持 反对

使用道具 举报

2

主题

240

回帖

0

蝴蝶豆

中级会员

最后登录
2020-8-11
发表于 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)[0]);这个函数中,好好检查一下就能找到。
回复 支持 反对

使用道具 举报

7

主题

78

回帖

0

蝴蝶豆

新手上路

最后登录
1970-1-1
发表于 2012-6-29 11:20:13 | 显示全部楼层

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

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

使用道具 举报

1

主题

38

回帖

0

蝴蝶豆

新手上路

最后登录
1970-1-1
发表于 2012-7-2 16:17:50 | 显示全部楼层

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

stm32 keil4 平台下 spi方式 sd卡读写程序 ,做一个demo
给你吧,参考一下,多想一点,有收获!
 
SD_card.rar (201 KB, 下载次数: 9)
回复 支持 反对

使用道具 举报

关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
STM32N6 AI生态系统
STM32MCU,MPU高性能GUI
ST ACEPACK电源模块
意法半导体生物传感器
STM32Cube扩展软件包
关注我们
微信公众号二维码 微信公众号
手机版二维码 手机版