cancel
Showing results for 
Search instead for 
Did you mean: 

Another retarget.c issue

jamie23
Associate II
Posted on May 13, 2015 at 10:45

Hi All,

I've been working my way through all the retarget.c threads on here and Keil.com today, trying to resolve the old

Symbol __stdout multiply defined (by stdio_streams.o and retarget.o)

Symbol __stdin multiply defined (by stdio_streams.o and retarget.o)

...

linker errors.

I have had a retarget.c file in my project for the past 6 months, and everything has been fine. These errors have occurred since I changed the char-based strings in my application to wchar-based strings, and replaced strcpy with wcscpy etc.

Since this change I get the multiply-defined symbols, and using MicroLib is obviously not an option due to lack of wchar support.

If I remove the definitions from my retarget.c, I get the following error:

__use_no_semihosting_swi was requested, but _sys_open was referenced

and if I remove the #pragma import(__use_no_semihosting_swi) then I see the classic BKPT in _sys_open before main.

I have no idea what is causing _sys_open to be called because all printf's are removed, and there are no calls to fopen() or freopen().

I'm using Keil uVision for Cortex M3 (STM32F2XX), and at the moment I'm not even convinced which issue I should try to fix. As my retargetting has been working up until now I thought getting rid of the multiply defined symbol warnings would be the path of least resistance.

I just CAN NOT figure out where the stdio_streams.o definition is coming from, or even where an object file name of stdio_streams.o would come from. I'm presuming it is a component of a prebuilt lib somewhere, but then again I'm not explicitly linking any libs...

Does anyone have any tips to help track down this extra definition?

TIA.

4 REPLIES 4
Posted on May 13, 2015 at 13:58

Which version of Keil?

Have you used the define __ARM_WCHAR_NO_IO

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
jamie23
Associate II
Posted on May 13, 2015 at 14:16

Thanks for the reply clive1.

This is uVision V5.11.1.0

I've not seen that preproc def before, but I have added it now without success. I did get a lot more warnings though due to wprintf etc then being declared implicitly.

Did you think adding the definition would help.

Here was me thinking that switching over to wchars would be straightforward...

Posted on May 13, 2015 at 15:00

I'm trying to figure out the dependence tree that pulls in stdio_streams.o

The object is within the armlib, clib/stdio.c

C:\Keil474\ARM\ARMCC\lib\armlib

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
jamie23
Associate II
Posted on May 13, 2015 at 18:52

Unhelpfully, --verbose doesn't provide any verbose output.