The alternate implementation I mentioned in the first email makes
using printf alot easier than it currently is. By just including
PFLAGS += tos/lib/printf in your makefile your ready to go. Just
#include "printf.h" in any files where you want to call printf() .
Whenever 3*TOSH_DATA_LENGTH characters have been collected via calls
to printf, the buffer is flushed out over the serial line. The buffer
can also be explicity fllushed by including a PrintfC component and
calling flush() on its PrintfFlush interface.
Kevin
On 9/21/07, Michael Schippling <[EMAIL PROTECTED]> wrote:
> What will they think of next...
>
> If you believe that the newline _always_ triggers an implicit fflush()
> I'm perfectly happy to join your club. But that's kinda hidden symantics.
> My memory is rather faulty but I'm reasonably sure that didn't happen on
> the VAX under BSD in 1983...I remember staying up all night waiting for
> my first debug message to poot out because I didn't flush it.
>
> Probably the more interesting issues are how to make the TOS debug printf()
> as transparent as possible, and how to swap it out when it's no longer needed.
> Someone mentioned that it would be nice to not have to wire it (I think it
> would be nice to not have to wire...well...anything...but that's just me).
> But maybe we could have a null implementation to use to wire-it-out?
>
> MS
>
> Philip Levis wrote:
> > On Sep 21, 2007, at 5:56 PM, Michael Schippling wrote:
> >
> >> Does 'regular' printf() guarantee that now?
> >> I remember having to do fflush() if I really wanted to see something.
> >
> > C stdlib printf(3) does not always block. But it can block, and you can
> > make it block on flushing the buffer.[1] This might seem like a little
> > nit, but it can bite you. E.g.:
> >
> > call Foo.x();
> > printf("Got past Foo.x()\n");
> > call Foo.y();
> > printf("Got past Foo.y()\n");
> >
> > Phil
> >
> > [1]
> > http://books.google.com/books?id=iRa-3L4jLhEC&pg=PA84&lpg=PA84&dq=printf+flush+newline+buffer&source=web&ots=dWntcq9i9J&sig=_r66dlfabrAEkJ8ltMzuRLysKj4
> >
>
> --
> Platform: WinXP/Cygwin
> TinyOS version: 1.x, Boomerang
> Programmer: MIB510
> Device(s): Mica2, MicaZ, Tmote
> Sensor board: homebrew
>
>
--
~Kevin
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help