Printf debugging
AN4989
70/118
AN4989 Rev 3
Figure 49. USART2 setting with STM32CubeMX
Retargeting printf to UART depends on the toolchain.
For IAR™ EWARM and Keil
®
MDK-Arm µVISION this is done by overriding the stdio fputc
function
#include "stdio.h"
int fputc(int ch, FILE *f)
{
HAL_UART_Transmit(&UartHandle, (uint8_t *)&ch, 1, 0xFFFF);
return ch;
}
For GCC based toolset like STM32CubeIDE, two cases can be met.
With syscall.c integrated to the project:
#include "stdio.h"
int __io_putchar(int ch)
{
Содержание STM32 Series
Страница 46: ...Connecting to the board AN4989 46 118 AN4989 Rev 3 Figure 30 Keil hotplug step2 ...
Страница 91: ...AN4989 Rev 3 91 118 AN4989 Debug through hardware exploration 117 Figure 69 STM32F4 F7 dual MCO capabilities ...
Страница 103: ...AN4989 Rev 3 103 118 AN4989 Managing DBGMCU registers 117 Figure 78 Generator Options debug MCU in STM32CubeIDE ...