Topic : UART0 putchar

Forum : ARM

Original Post
Post Information Post
January 25, 2012 - 4:28pm

I want to compile my project with UART0 putchar = NO
When is YES program compiles ok.
Because I dont use this function I changed it to NO, but I see errors:

C:\Program Files (x86)\Raisonance\Ride\Lib\ARM\smallprintf_thumb.a(_SP_puts.o): In function `_SMALL_PRINTF_puts':
_SP_puts.c:(.text+0x4a): undefined reference to `__io_putchar'
C:\Program Files (x86)\Raisonance\Ride\Lib\ARM\smallprintf_thumb.a(_SP_puts.o): In function `puts':
_SP_puts.c:(.text+0x74): undefined reference to `__io_putchar'
collect2: ld returned 1 exit status

what is wrong ?

And one more question: is

Post Information Post
January 26, 2012 - 9:56am
Raisonance Support Team


The thing is that printf() knows what to do when you have a console attached. On embedded applications it does not know where to emit the characters to print. So what the small printf does is that is calls a __io_putchar() function which is responsible for the emission of the characters to print. This function can send characters to USART, to USB, to a LCD display, whatever you like... but you must provide it.

Check out the example in "C:\Program Files\Raisonance\Ride\lib\ARM\io_putchar", which shows how to write your own __io_putchar().

Best Regards,