stvd 4.3.9编译stm8s工程报如下错误:
Compiling sx1276.c...
cxstm8 +modsl +debug -pxp -no +split -pp -l -istm8s_stdperiph_driver\inc -i"C:\Program Files (x86)\COSMIC\CXSTM8\Hstm8" -i"C:\Program Files (x86)\STMicroelectronics\st_toolset\include" -clDebug\ -coDebug\ sx1276.c
#error cpstm8 sx1276.c:70(35) missing prototype
#error cpstm8 sx1276.c:276(53) missing prototype
sx1276.c:
The command: "cxstm8 +modsl +debug -pxp -no +split -pp -l -istm8s_stdperiph_driver\inc -i"C:\Program Files (x86)\COSMIC\CXSTM8\Hstm8" -i"C:\Program Files (x86)\STMicroelectronics\st_toolset\include" -clDebug\ -coDebug\ sx1276.c" has failed, the returned value is: 1
exit code=1.
问题原因:
Compiling sx1276.c...
cxstm8 +modsl +debug -pxp -no +split -pp -l -istm8s_stdperiph_driver\inc -i"C:\Program Files (x86)\COSMIC\CXSTM8\Hstm8" -i"C:\Program Files (x86)\STMicroelectronics\st_toolset\include" -clDebug\ -coDebug\ sx1276.c
#error cpstm8 sx1276.c:70(35) missing prototype
#error cpstm8 sx1276.c:276(53) missing prototype
sx1276.c:
The command: "cxstm8 +modsl +debug -pxp -no +split -pp -l -istm8s_stdperiph_driver\inc -i"C:\Program Files (x86)\COSMIC\CXSTM8\Hstm8" -i"C:\Program Files (x86)\STMicroelectronics\st_toolset\include" -clDebug\ -coDebug\ sx1276.c" has failed, the returned value is: 1
exit code=1.
问题原因:
sx1276.c:70行调用函数:Value = lpTypefunc.lpByteReadfunc(); lpByteReadfunc()函数没有形参,需要加上void。
修改为:
修改为:
点击(此处)折叠或打开
- typedef struct {
-
- void (*lpByteWritefunc)(unsigned char src);
- unsigned char (*lpByteReadfunc)();
- void (*lpSwitchEnStatus)(cmdEntype_t cmd);
- void (*paSwitchCmdfunc)(cmdpaType_t cmd);
- void (*lpRecvDataTousr)(unsigned char *lpbuf,unsigned short length);
-
- } lpCtrlTypefunc_t;
- typedef struct {
-
- void (*lpByteWritefunc)(unsigned char src);
- unsigned char (*lpByteReadfunc)(void); /* 加上void */
- void (*lpSwitchEnStatus)(cmdEntype_t cmd);
- void (*paSwitchCmdfunc)(cmdpaType_t cmd);
- void (*lpRecvDataTousr)(unsigned char *lpbuf,unsigned short length);
-
- } lpCtrlTypefunc_t;
- unsigned char RF_SPI_READ_BYTE()
- {
- unsigned char j;
- unsigned char i;
- j=0;
- for (i = 0; i < 8; i++){
- RF_CKL_H;
- j = (j << 1); // shift 1 place to the left or shift in 0 //
- if( SX1278_SDO ) // check to see if bit is high //
- j = j | 0x01; // if high, make bit high //
- // toggle clock high //
- RF_CKL_L; // toggle clock low //
- }
-
- return j; // toggle clock low //
- }
- unsigned char RF_SPI_READ_BYTE(void) /* 加上void */
- {
- unsigned char j;
- unsigned char i;
- j=0;
- for (i = 0; i < 8; i++){
- RF_CKL_H;
- j = (j << 1); // shift 1 place to the left or shift in 0 //
- if( SX1278_SDO ) // check to see if bit is high //
- j = j | 0x01; // if high, make bit high //
- // toggle clock high //
- RF_CKL_L; // toggle clock low //
- }
-
- return j; // toggle clock low //
- }