2020-06-10 08:31 AM
Hi,
I use my own printf(printf, snprintf...) in STM32 since many years.
In atollic I added -fno-builtin-fprintf -fno-builtin-printf -fno-builtin-sprintf in the compiler option.
Now with Cube IDE I do the same but the linker tells me that there are two definitions of some functions related to printf.
I checked with multiple options without success.
I'm using C and C++ because I'm working with touchGFX.
Any idea?
Thank you
Pierre
2020-06-10 08:37 AM
Scan the libraries it is pulling and where the printf() comes from, then use a librarian tool to remove the unwanted functions if you can't otherwise eliminate the library or object in question.
2020-06-10 09:41 AM
Maybe the little known GNU linker trick with "wrapped" functions can help.
Add options -Xlinker --wrap=printf -Xlinker --wrap=sprintf
and #define printf __wrap_printf
--pa
2020-06-11 01:47 AM
Thank you for yours answers.
Finally I renamed all the functions in my printf file with "Trace_" prefix.
Because I call it via a macro (to enable/disable debug console), I had only one line to change.
It stays clean.
Pierre