2023-11-19 06:49 AM
hi i would like to use uart1_printf_debug debugging on a serial terminal but error message "undefine reference to "uart1_printf_debug" what file to include except stdio.h?
2023-11-19 07:02 AM - edited 2023-11-19 07:03 AM
you need something like this in main.c :
/* USER CODE BEGIN 4 */
/**
* @brief Retargets the C library printf function to the USART.
* None
* @retval None
*/
int __io_putchar(int ch)
{
HAL_UART_Transmit(&huart1, (uint8_t *)&ch, 1, 0xFFFF);
return (ch);
}
then just use printf(...);