有没有c++或c代码可以帮助我在stm32f4-eval2板上使用keil uvision5中的printf?我知道你必须重定向uarts和usarts,但即使在我在线找到的网站的帮助下,我也无法做到这一点而没有错误。
我希望能够使用debug printf查看器。
我尝试了以下链接,但不起作用:http://www.keil.com/support/man/docs/ulinkpro/ulinkpro_trace_itm_viewer.htm
发布于 2014-07-08 19:57:37
如果您想要通过UART打印或想要通过ITM调试通道打印,您并不是非常具体。对于ITM来说,这非常简单。创建一个包含以下内容的文件,并确保在调试连接上启用了SWO跟踪:
#include <stdio.h>
/* Replace next line: Include the device system header file here */
#error "device include file missing"
/* e.g.: #include "STM32F4xx.h" */
#pragma import(__use_no_semihosting_swi)
volatile int ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* CMSIS Debug Input */
int fputc(int c, FILE *f) {
return (ITM_SendChar(c));
}
int fgetc(FILE *f) {
while (ITM_CheckChar() != 1) __NOP();
return (ITM_ReceiveChar());
}确保在目标->目标的选项中勾选了"Use MicroLib“选项
https://stackoverflow.com/questions/24605244
复制相似问题