我用的DM9000网卡芯片,在http.c中添加代码后在stm32f10x.h中报错?
static unsigned int once=0;
void
dm9000x_inital(void)
{
uip_listen(HTONS(1234)); //此处使用1024及其以上 的端口号
}
/////////////////////////////////////////////////////////////////延时
static dm9000x_delay(u32 delay)//微秒级延时
{
while (delay--);
}
void delay_ms(uint32_t z)//延时函数 毫秒级
{
u32 x,y;
for(x=z;x>0;x--)
for(y=7000;y>0;y--);
}
/////////////////////////////////////////////////////////////////
/*-----------------------------------------------------------------------------------*/
void
UIP_APPCALL(void)
{
if(uip_connected()&&(once==0))
{
once=1;
uip_send("ok,已连接!",10);
}
switch(uip_conn->lport) {
case HTONS(1234):
break;
/* This is the web server: */
default:
/* Should never happen. */
uip_abort();
break;
}
if(uip_timedout()||uip_closed()||uip_aborted())//重发确认超时,客户机关闭连接,客户机中断连接
{
return ;
}
}模仿uip中的代码。出现这样的错误
..\..\Libraries\CMSIS\Core\CM3\stm32f10x.h(312): error: #256: invalid redeclaration of type name "s32" (declared at line 23 of "C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h")
..\..\Libraries\CMSIS\Core\CM3\stm32f10x.h: typedef int32_t s32;
..\..\Libraries\CMSIS\Core\CM3\stm32f10x.h: ^
..\..\Libraries\CMSIS\Core\CM3\stm32f10x.h(316): error: #256: invalid redeclaration of type name "sc32" (declared at line 27 of "C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h")
..\..\Libraries\CMSIS\Core\CM3\stm32f10x.h: typedef const int32_t sc32; /*!< Read Only */
..\..\Libraries\CMSIS\Core\CM3\stm32f10x.h: ^
..\..\Libraries\CMSIS\Core\CM3\stm32f10x.h(320): error: #256: invalid redeclaration of type name "vs32" (declared at line 31 of "C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h")
..\..\Libraries\CMSIS\Core\CM3\stm32f10x.h: typedef __IO int32_t vs32;
..\..\Libraries\CMSIS\Core\CM3\stm32f10x.h: ^
..\..\Libraries\CMSIS\Core\CM3\stm32f10x.h(324): error: #256: invalid redeclaration of type name "vsc32" (declared at line 35 of "C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h")
..\..\Libraries\CMSIS\Core\CM3\stm32f10x.h: typedef __I int32_t vsc32; /*!< Read Only */
..\..\Libraries\CMSIS\Core\CM3\stm32f10x.h: ^
..\..\Libraries\CMSIS\Core\CM3\stm32f10x.h(328): error: #256: invalid redeclaration of type name "u32" (declared at line 39 of "C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h")
..\..\Libraries\CMSIS\Core\CM3\stm32f10x.h: typedef uint32_t u32;
..\..\Libraries\CMSIS\Core\CM3\stm32f10x.h: ^
..\..\Libraries\CMSIS\Core\CM3\stm32f10x.h(332): error: #256: invalid redeclaration of type name "uc32" (declared at line 43 of "C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h")
..\..\Libraries\CMSIS\Core\CM3\stm32f10x.h: typedef const uint32_t uc32; /*!< Read Only */
..\..\Libraries\CMSIS\Core\CM3\stm32f10x.h: ^
[解决办法]
头文件引用错了,当前工程目录下找不到文件,就会从C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h"查找
自己修改下就行了