调试uIP出现死机问题
生活随笔
收集整理的這篇文章主要介紹了
调试uIP出现死机问题
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
在調(diào)試uIP,加入http功能時(shí),調(diào)試出現(xiàn)死循環(huán)
原因是所加入的http文件中含有printf等輸出函數(shù),遇到這種情況,有2種解決方法:
1.Keil中勾選“Use MicroLIB”
2.
//加入以下代碼,支持printf函數(shù),而不需要選擇Use MicroLIB
#if 1
#pragma import(__use_no_semihosting)
//標(biāo)準(zhǔn)庫(kù)需要支持的函數(shù)
struct __FILE
{ int handle;
};
FILE __stdout;
//定義_sys_exit()以避免使用半主機(jī)模式
_sys_exit(int x)
{ x = x;
}
//重定義fputc函數(shù)
int fputc(int ch, FILE *f)
{ while((USART1->SR&0X40)==0);//循環(huán)發(fā)送,直到發(fā)送完畢USART1->DR = (u8) ch; return ch;
}
#endif
轉(zhuǎn)載于:https://www.cnblogs.com/season-peng/p/6713510.html
總結(jié)
以上是生活随笔為你收集整理的调试uIP出现死机问题的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 大家有人知道“日不落酒店”这部电影吗
- 下一篇: url中去掉index.php,方便re