高级会员

- 积分
- 782
- 金钱
- 782
- 注册时间
- 2012-6-14
- 在线时间
- 206 小时
|

楼主 |
发表于 2012-6-14 11:31:50
|
显示全部楼层
回复【3楼】a4615800:
---------------------------------
恩,我找到了正点原子的代码了,当时还没有怎么注意,谢谢你的提醒,呵呵
代码:
//////////////////////////////////////////////////////////////////
//加入以下代码,支持printf函数,而不需要选择use MicroLIB
#if 1
#pragma import(__use_no_semihosting)
//标准库需要的支持函数
struct __FILE
{
int handle;
/* Whatever you require here. If the only file you are using is */
/* standard output using printf() for debugging, no file handling */
/* is required. */
};
/* FILE is typedef’ d in stdio.h. */
FILE __stdout;
//定义_sys_exit()以避免使用半主机模式
_sys_exit(int x)
{
x = x;
}
//重定义fputc函数
int fputc(int ch, FILE *f)
{
while((USART1->SR&0X40)==0);//循环发送,直到发送完毕
USART1->DR = (u8) ch;
return ch;
}
#endif
//end
////////////////////////////////////////////////////////////////// |
|