How to trim the fat (Floating point)

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

How to trim the fat (Floating point)

182 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by robert.palmer on Fri Apr 05 15:13:50 MST 2013
I'm trying to really trim down my code and I noticed in the map file that appears to indicate that, among other, fmul, fdiv, fsub, from float.o in libcr_eabihelpers.a are being linked in to my project.

Is there a way to prevent this?  I'm not using floating point, anywhere in my code.  I thought I had the correct library included to not link in printf, but maybe that's where it's coming from.  Or could it be from somewhere else?
0 Kudos
2 Replies

172 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Sat Apr 06 10:17:11 MST 2013
The map file should give you sufficient information to see exactly what is causing these functions to be pulled in.

If it is a printf family function, and you are using Redlib, then you could consider using the non-float version by defining the symbol CR_INTEGER_PRINTF for your project. For more information on this, see:

http://support.code-red-tech.com/CodeRedWiki/UsingPrintf

And for more information on C library issues, see the list of C library related FAQs at:

http://support.code-red-tech.com/CodeRedWiki/CodeRedFAQ#CLibrary

If you need more assistance here, I would suggest attaching your map file to the thread.

Regards,
CodeRedSupport
0 Kudos

172 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by frame on Sat Apr 06 09:41:20 MST 2013
Do you use any floating point functionality ?
Be warned, even floating point constants count, as casts are done via a library function call.

Otherwise, you might try to compile with
[FONT=Courier New]-ffunction-sections -fdata-sections
[/FONT]and link with
[FONT=Courier New]--gc-sections
[/FONT]to eliminate any unused code.
0 Kudos