/****************************************************分割线*******************************************/
// 加入以下代码。支持printf函数,则不需要选择use MicroLIB
//添加头文件
#include <stdio.h>
//添加代码
#if 1
#pragma import(__use_no_semihosting)//标准库需要支持函数
struct __FILE
{
int handle;
};
FILE __stdout;
//定义_sys_exit()以避免使用半主机模式
_sys_exit(int x)
{
x = x;
}
int fputc(int ch, FILE *f)
{
/*将printf内容发往串口*/
USART_SendData(UART5,(uint8_t)ch);
while(USART_GetFlagStatus(UART5, USART_FLAG_TC) == RESET);
return ch;
}
#endif
/****************************************************分割线*******************************************/
_sys_exit()函数可能出现以下警告,不用理会。编译时不会出现警告