stm32 IAR 环境 printf 函数调用
(2012-07-27 15:16:57)
转 载 ▼
标签:
杂谈
分类: STM32
在串口都配置好的情况下,在 main.c 文件中加入
#include <stdio.h>
#ifdef __GNUC__
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
#else
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
#endif
PUTCHAR_PROTOTYPE
{
USART_SendData(EVAL_COM1, (uint8_t) ch);
while (USART_GetFlagStatus(EVAL_COM1, USART_FLAG_TC) == RESET)
{}
return ch;
}
#ifdef USE_FULL_ASSERT
之后如若编译出现 identifier "FILE" is undefined,即将
Options->GeneralOptions->Library Configuation 中的 Library 选为 full 即可
评论0