Delay Delay - 1 month ago 27
C Question

How to retarget printf() on an STM32F10x?

I use this code for retarget

printf()
, but it does not work

#ifdef __GNUC__
/* With GCC/RAISONANCE, small printf (option LD Linker->Libraries->Small printf
set to 'Yes') calls __io_putchar() */
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
#else
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
#endif /* __GNUC__ */

PUTCHAR_PROTOTYPE
{
/* Place your implementation of fputc here */
/* e.g. write a character to the LCD */
lcd_Data_Write((u8)ch);

return ch;
}


I use STM32F103RBT6

compiler : GCC with emBitz editor

Answer

Tank you Bence Kaulics

I use tinyprintf library and it worked quite well : github link

Comments