2012-05-01 06:04 PM
#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__ */
Can some one explain to me; what's the relationship between __io_putchar and fputc? are they from stand C library? and how it is related to printf() that is used in USART comunications? thanks a lot.
2012-05-01 07:03 PM
Consider that the tool chain can't support serial output on every board with every UART combination. You have to provide a routine for your own board. The GNU and Keil/IAR compilers have different ways of doing it with their libraries, in the former case you're going to do this with a specific library, and a specific function, __io_putchar(). printf() then utilizes the character output routine to get the formatted string out the serial port.