[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-libc-dev] Re: [avr-gcc-list] c library with stdio?
From: |
Joerg Wunsch |
Subject: |
Re: [avr-libc-dev] Re: [avr-gcc-list] c library with stdio? |
Date: |
Wed, 28 Aug 2002 21:59:46 +0200 |
User-agent: |
Mutt/1.2.5i |
As E. Weddington wrote:
> I agree that printf() is too impractical to do.
It's not completely out of the question, but it needs a good design
so it could be useful, and applications could stuff their actual
IO functions (for UART, LCD, whatever) into it.
> Any ideas about implementing at least sprintf() / snprintf(), with
> caveats about the amount of space it will take up (i.e. use it only
> on the bigger AVRs)?
See my mail to the avr-gcc list, there used to be some sample
implementation shipping with Marek's early avr-libc releases.
Maybe this could be a starting point (although the copyright looks
fairly messy ;-), it has both a BSD and a GPL copyright header).
> If not sprintf(), then how about an ftoa() to fill in the gaps (since
> there's already itoa(), utoa(), ltoa(), etc.)?
There's a dtostre() and dtostrf() already. However, i've been using
dtostre() in one of my applications, and it sometimes emits `funny'
results (like colons in places where a digit should normally appear),
and i even accuse it of totally crashing my program for some
out-of-bound input (like a NaN maybe). So i wouldn't consider this
to be really stable yet... Haven't found the time so far to isolate
the cases with the funny results so i could debug them. That's
probably something that could be better done with the simulator
though.
> If not both than how about a FAQ as to why it's not implemented since
> this question keeps popping up. I've seen this question (about having
> printf()) also on the forums at avrfreaks.net.
Would you mind writing up a paragraph or two?
--
J"org Wunsch Unix support engineer
address@hidden http://www.interface-systems.de/~j/