Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training


linker error: multiple definition of `putchar

Posted by Andriy Korud on June 4, 2009
I'm trying to compile FreeRTOS 5.3.0 STM32 Primer example (unmodified). RIDE and development environment is fresh and clear:

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 I have no idea how to prevent linker from linking libc putchar, any ideas?


RE: linker error: multiple definition of `put

Posted by Richard on June 4, 2009
The error is telling you where to two definitions are. One is in the libc library, and the other in STM32F10X_IO_putchar.c - so you need to either remove the .c file from the build or not use the library. I suspect this is a compiler or link option setting problem and must be caused by a different Ride version to the one used to create the demo.


RE: linker error: multiple definition of `putchar

Posted by Andriy Korud on June 4, 2009
Thanks, it's exactly I supposed.
The problem that I have no idea how to avoid linking libc - it's linked automatically. And worse, I want libc - there are many useful function there. And the goal is to use both - putchar from STM32F10X_IO_putchar.c and libc for the rest.
Any ideas? Maybe I'm wrong somewhere?


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists