How to avoid usage of library functions?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to avoid usage of library functions?

1,692件の閲覧回数
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 件の賞賛
返信
2 返答(返信)

1,249件の閲覧回数
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 件の賞賛
返信

1,248件の閲覧回数
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 件の賞賛
返信