1. 因为我的工程用AC6是因为要跑自己的C 和 TensorFlow lite micro. 所以是C,C++混合的工程,但是一直没法打印,所以写一个总结。
基本说明: micro_lib这种情况不要选,因为存在C++文件
第一个坑:
第二个坑:网上大部分教程的重定向printf代码是
__ASM(".global __use_no_semihosting");
//??HAL????,?????????bug
//??????????,???????????????,??
int _ttywrch(int ch)
{
ch=ch;
return ch;
}
//??????????
//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 __stdout;
//??_sys_exit()??????????
void _sys_exit(int x)
{
x = x;
}
int fputc(int ch, FILE *f){
// usart_data_transmit(USART0, (