printf打印
有朋友知道FM33LG026怎么用printf打印信息吗1、重写fputc
#if 1
#pragma import(__use_no_semihosting)
struct __FILE
{
int handle;
};
FILE __stdout;
//_sys_exit()
void _sys_exit(int x)
{
x = x;
}
//fputc
int fputc(int ch, FILE *f)
{
FL_UART_WriteTXBuff(UART0, ch);
while(FL_SET!= FL_UART_IsActiveFlag_TXBuffEmpty(UART0));
return ch;
}
#endif
2、初始化uart0
可参考例程
就可以从uart0 输出了。
要换其他uart口也 可以
页:
[1]