用于stm32f4-eval2板的keil打印

Printf in keil for stm32f4-eval2 board

本文关键字:打印 keil 板的 stm32f4-eval2 用于      更新时间:2023-10-16

是否有c++或c代码可以帮助我在keil vision 5中为stm32f4-eval2板使用printf ?我知道你必须重新定位零件和零件,但即使有我在网上找到的网站的帮助,我也无法做到这一点而没有错误。

我希望能够使用调试打印查看器。

我尝试了以下链接,但没有工作:http://www.keil.com/support/man/docs/ulinkpro/ulinkpro_trace_itm_viewer.htm

如果您想通过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());
}

确保在Target->Target

选项中勾选"Use MicroLib"选项