How to avoid usage of library functions?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to avoid usage of library functions?

1,053 Views
JPE
Contributor III

Hi there!

I am using PE from CW 10.6 with the GCC.

The target is a Kinetis KE02, handling some basic I/O and serial communication.

The PE components used in my project are ADC, IntFLASH, BitIO, TimerInt, AsynchroSerial, WatchDog and PWM.

When looking at the .map file, I have noticed, that the linker includes some quite big library functions from "libc.a" like "pformatter", "strtoul" and "sformatter", which I can't relate to any functionality of my code, nor the included PE components (no calls to "printf" or "scanf" in my code).

I have tried to disable the usage of the "default libraries" in the general Linker settings, which gives me the following error from the linker:

C:/MyProject/Project_Settings/Linker_Files/ProcessorExpert.ld:219: undefined symbol `__pformatter_' referenced in expression

mingw32-make: *** [MyProject.elf] Error 1

Line 219 is the last (and empty) line of the linker command file, which PE generates automatically, but I can't find any usage of the library functions in that file.

Does anyone know, why these library functions are included and if there is a way to avoid their inclusion in the project?

Kind regards

Joern

0 Kudos
2 Replies

610 Views
marek_neuzil
NXP Employee
NXP Employee

Hello Joern,

This issue has been addressed in the document on MCU on Eclipse pages. See the page http://mcuoneclipse.com/2012/11/11/optimizing-the-kinetis-gcc-startup/ - chapter "Linker and Libraries". There is described how to remove "pformatter".

Best Regards,

Marek Neuzil

0 Kudos

609 Views
JPE
Contributor III

Hello Marek,

I actually had a look at Erich Stygers brilliant site already, but the linker flags that he describes are not in my project.

However, on that page you refer to, there was also another link (Reducing Code Size with gcc and EWL | MCU on Eclipse), which showed how to use another library model ("ewl_noio") instead of the default one ("ewl"). This removed the pformatter code and reduced my code size with more than 4000 bytes!

So thanks for the hint!

Kind regards

Jörn

0 Kudos