Topic : linker error: multiple definition of `putchar'

Forum : ARM

Original Post
Post Information Post
June 3, 2009 - 5:04pm
Guest

Hi,
I'm trying to compile FreeRTOS Primer example (unmodified). RIDE and development environment is fresh and clear:
Ride7 7.20.09.0139
Rkit-ARM 1.20.09.0153

Everything compile fine, except linking:

Running: LD 
 \"C:\Raisonance\Ride\arm-gcc\bin\arm-none-eabi-gcc.exe" -mcpu=cortex-m3 -mthumb -Wl,-T -Xlinker "C:\work\FreeRTOS\Demo\CORTEX_STM32F103_Primer_GCC\RTOSDemo.elf.ld" -u _start -Wl,-static -Wl,--gc-sections -nostartfiles -Wl,-Map -Xlinker "C:\work\FreeRTOS\Demo\CORTEX_STM32F103_Primer_GCC\RTOSDemo.map"   
 C:\Raisonance\Ride\Lib\ARM\STM32x_io_putchar_thumb.a(STM32F10X_IO_putchar.o): In function `putchar':  
 STM32F10X_IO_putchar.c:(.text.putchar+0x0): multiple definition of `putchar'  
 c:/raisonance/ride/arm-gcc/bin/../lib/gcc/arm-none-eabi/4.3.2/../../../../arm-none-eabi/lib/thumb2\libc.a(lib_a-putchar.o):putchar.c:(.text+0x0): first defined here  
 collect2: ld returned 1 exit status 

The following options are selected:

ST library: Yes
UART0 Putchar: Yes
Small printf: Yes
Small no-float printf: Yes

Any idea how to prevent ld from linking libc putchar? Or any solution for this problem?

Thanks in advance,
Andriy

Replies
Post Information Post
+1
0
-1
June 9, 2009 - 2:58pm
Guest

It seems that putchar is also defined into FreeRtos. Did you try:
UART0 Putchar: No
?

+1
0
-1
June 9, 2009 - 3:14pm
Guest

Francis Lamotte wrote:
It seems that putchar is also defined into FreeRtos. Did you try:
UART0 Putchar: No
?

Yes, I've discovered that putchar is also defined in FreeRtos code. Removing it from here and using libc putchar compiles fine but hang during execution.
The solution that works for me is to use sprintf for formatting into buffer and then sending buffer to UART "manually".