大家好!请教个问题:
xc8编译器,pic16f1825 单片机 串口发送程序编译不过.代码如下:
/串口发送一串字符
void EUSART_SendString(const unsigned char *pData)
{
di(); //GIE = 0 //disable all interrupts
TXIE =0; //屏闭EUSART 发送中断
int len = strlen(pData);
unsigned char *str= malloc(len);
if(str !=NULL){
strcpy(str,pData);
while(*str!='\0')
{
TXREG = *str++;
while(TXSTAbits.TRMT==0);//TRMT=1时,TSR为空,否则不为空
}
free(str);
}
}
编译错误 如下:
:: warning: (1273) Omniscient Code Generation not available in Free mode
mcu_wifi.c:108: advisory: (1510) non-reentrant function "_EUSART_SendString" appears in multiple call graphs and has been duplicated by the compiler
C:\Program Files\Microchip\xc8\v1.42\sources\common\strcpy.c:8: advisory: (1510) non-reentrant function "_strcpy" appears in multiple call graphs and has been duplicated by the compiler
C:\Program Files\Microchip\xc8\v1.42\sources\common\strlen.c:4: advisory: (1510) non-reentrant function "_strlen" appears in multiple call graphs and has been duplicated by the compiler
uart_comm.c:9: warning: (520) function "_calc_checksum" is never called
:0: error: (500) undefined symbols:
_free(dist/default/production\mcu_wifi.X.production.obj) _malloc(dist/default/production\mcu_wifi.X.production.obj)
(908) exit status = 1
nbproject/Makefile-default.mk:147: recipe for target 'dist/default/production/mcu_wifi.X.production.hex' failed
make[2]: Leaving directory 'D:/VM/share/AbleCloud/mcu_firmware/mcu_wifi/mcu_wifi.X'
nbproject/Makefile-default.mk:90: recipe for target '.build-conf' failed
make[1]: Leaving directory 'D:/VM/share/AbleCloud/mcu_firmware/mcu_wifi/mcu_wifi.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make[2]: *** [dist/default/production/mcu_wifi.X.production.hex] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
编译已失败 (退出值2, 总时间: 2s)
各位大牛,请帮我看下是什么问题!! |