Monday, January 30, 2012

Printf in tinyos


To see the output generated by the Printf tutorial application you need to start the PrintfClient by running
the following command:


java net.tinyos.tools.PrintfClient -comm serial@/dev/ttyUSBXXX:telosb


A few points are worthy of note before jumping in and writing your own applications that use the functionality
provided by the printf library.
1. In order to use the printf library, the tos/lib/printf directory must be in your include path. The
easiest way to include it is by adding the following line directly within the Makefile of your top level
application:
CFLAGS += -I$(TOSDIR)/lib/printf
2. Remember that changing the printf buffer size is done similarly:
CFLAGS += -DPRINTF_BUFFER_SIZE=XXX3. You MUST be sure to #include "printf.h" header file in every component in which you would like to
call the printf() command. Failure to do so will result in obscure error messages making it difficult to
identify the problem

3 comments:

Anonymous said...

sir, i was trying to work on tinysec and using printf, but there is a error showing undefined reference to printfflush, i have tried to resolve it, but the same problem arises.

Donny said...

Try upgrade your tinyos to 2.1.2, then execute the printf again.

Unknown said...

hello there,

how to I redirect my output printed on the terminal to a file so that it will act as log file for any output printed on the terminal?

thanks.