libprintf_flt.a library doc?

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Where can I find a document which describes which routines are in the

libprintf_flt.a 

library?

 

I had it linked to my project for years, but I removed it and I saved 2300 bytes and all still compiles without issue.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

split63 wrote:
Where can I find a document which describes which routines are in the libprintf_flt.a library?
http://www.nongnu.org/avr-libc/user-manual/group__avr__stdio.html

It does not provide any additional functions, but additional functionality.

 

split63 wrote:
all still compiles without issue.
Yes, but does it run without issue?

If you are using any printf function together with floats, you will now get only question marks as output.

 

 

Stefan Ernst

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As Stefan says the manual tells you about libprintf_flt.a:

 

http://www.nongnu.org/avr-libc/u...

 

but to answer your specific question:

split63 wrote:
which routines are in the

you don't really need a "document" for that. The .a file is self documenting:

 

 

The T there shows exported function(s). In this case just one function - vfprintf(). This is exactly what the documentation in the stdio.h manual suggests. The core of all printf() and sprintf() functions is vfprintf(). It's also the same reason why you use -Wl,-u,vfprintf (again from the manual) to say to the linker - forget the instance of that function you saw from libc.a, search instead in the additional library I am specifying"

 

What the above also show is that vfprintf() itself makes calls to __prologue_saves__(), __epilogue_restores__(), __ftoa_engine(), __ultoa_invert(), fputc(), strlen() and strlen_p() so when any form of printf() that invokes vfprintf() is used it will also pull in those function too.

 

If you run avr-nm on libc.a then for that you see:

 

 

So it invokes most of those functions too (but not __ftoa_engine()) but its version of vfprintf() is clearly smaller and less complex too.

 

So your additional bytes are in the "extra bits" of the larger vfprintf() and the __ftoa_engine(). __ftoa_engine() itself can also be found in libc.a:

 

 

If you want to know even more about it:

 

 

So of your 2300 bytes, 682 of them are coming form ftoa_engine.o and if you want to know what's in those then:

 

http://svn.savannah.gnu.org/view...

 

But like Stefan says, you can revert from the vfprintf() in libprintf_flt.a to the standard one in libc.a but now anywhere you have used any form of "%f" you are going to see just "?" in the displayed output and not the floating point value you hoped for because of the code at line 543 in this file:

 

http://svn.savannah.gnu.org/view...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No where is my source files are the strings "printf" or "%f".   I could not really follow what's in the ftoa_engine.

I guess I will need to test it to know for sure, but its a lot of older code and it will not be trivial.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Could well be that float printing was just a debug thing in early development