Dear friends, I am using tinyos 2.1. i was trying to create a library for sending debug messages on the UART just like the available printf library. I followed the printf tutorial.
i created a folder in /home/P09/tinyos-2.x/tos/lib/printdbg/ and created the files for sending messages to the UART. in the printdbg.h header file i have declared the function printdbg, the function that is used in the library files to send messages. void printdbg(char* buf, uint8_t msgint); in my makefile of the application i have written CFLAGS += -I$(TOSDIR)/lib/printdbg I tried to send some debug messages from the blink application. I included printdbg.h in each of the files of the blink application from where i m calling printdbg(..) function. everything works fine but i get a strange, possibly a linking error at compile time that can be seen at the end of the below long message. I tried adding -v to see the verbose output but all in vain. ERROR: compiling BlinkAppC to a amulet2 binary ncc -Os -finline-limit=100000 -Wall -Wshadow -Wnesc-all -target=amulet2 -conly -fnesc-cfile=build/amulet2/main_arm.c -fnesc-separator=__ -DDEFINED_TOS_AM_GROUP=0x22 -I/home/P09/agrawalg/mywork/tinyos-2.x/tos/lib/printdbg -DIDENT_APPNAME=\"BlinkAppC\" -DIDENT_USERNAME=\"agrawalg\" -DIDENT_HOSTNAME=\"pg024\" -DIDENT_USERHASH=0x1cab6c09L -DIDENT_TIMESTAMP=0x4c8040faL -DIDENT_UIDHASH=0x1259a713L BlinkAppC.nc /home/P09/agrawalg/mywork/tinyos-2.x/tos/lib/printdbg/DebugMsgSendP.nc:157:1: warning: "/*" within comment /home/P09/agrawalg/mywork/tinyos-2.x/tos/platforms/amulet2/hpl/HplC.nc:37: warning: call via function pointer /home/P09/agrawalg/mywork/tinyos-2.x/tos/platforms/amulet2/serial/PlatformSerialP.nc:33: warning: `Serial.WriteStream' called asynchronously from `UartStream.send' /home/P09/agrawalg/mywork/tinyos-2.x/tos/platforms/amulet2/led/PlatformLedsP.nc:19: warning: `Paralell.read' called asynchronously from `setState' /home/P09/agrawalg/mywork/tinyos-2.x/tos/platforms/amulet2/led/PlatformLedsP.nc:21: warning: `Paralell.write' called asynchronously from `setState' /home/P09/agrawalg/mywork/tinyos-2.x/tos/lib/serial/HdlcTranslateC.nc:103: warning: `lcd.GoTo' called asynchronously from `SerialFrameComm.putData' /home/P09/agrawalg/mywork/tinyos-2.x/tos/lib/serial/HdlcTranslateC.nc:118: warning: `lcd.GoTo' called asynchronously from `UartStream.sendDone' /home/P09/agrawalg/mywork/tinyos-2.x/tos/lib/serial/HdlcTranslateC.nc:104: warning: `lcd.WriteString' called asynchronously from `SerialFrameComm.putData' /home/P09/agrawalg/mywork/tinyos-2.x/tos/lib/serial/HdlcTranslateC.nc:119: warning: `lcd.WriteString' called asynchronously from `UartStream.sendDone' /home/P09/agrawalg/mywork/tinyos-2.x/tos/platforms/amulet2/timer/Amulet2TimerMilliP.nc:15: warning: non-atomic accesses to shared variable `currentTime': /home/P09/agrawalg/mywork/tinyos-2.x/tos/platforms/amulet2/timer/Amulet2TimerMilliP.nc:67: warning: non-atomic read /home/P09/agrawalg/mywork/tinyos-2.x/tos/lib/serial/SerialP.nc:146: warning: non-atomic accesses to shared variable `rxState': /home/P09/agrawalg/mywork/tinyos-2.x/tos/lib/serial/SerialP.nc:207: warning: non-atomic write /home/P09/agrawalg/mywork/tinyos-2.x/tos/lib/serial/SerialP.nc:165: warning: non-atomic accesses to shared variable `offPending': /home/P09/agrawalg/mywork/tinyos-2.x/tos/lib/serial/SerialP.nc:484: warning: non-atomic read /home/P09/agrawalg/mywork/tinyos-2.x/tos/lib/serial/SerialP.nc:150: warning: non-atomic accesses to shared variable `rxCRC': /home/P09/agrawalg/mywork/tinyos-2.x/tos/lib/serial/SerialP.nc:211mainly consisting of the warnings: warning: non-atomic write /home/P09/agrawalg/mywork/tinyos-2.x/tos/lib/serial/SerialP.nc:415: warning: non-atomic write /home/P09/agrawalg/mywork/tinyos-2.x/tos/platforms/amulet2/hpl/HplC.nc:10: warning: non-atomic accesses to shared variable `sleeping': /home/P09/agrawalg/mywork/tinyos-2.x/tos/platforms/amulet2/hpl/HplC.nc:52: warning: non-atomic read arm-elf-gcc -mcpu=arm6 -o build/amulet2/BlinkAppC build/amulet2/main_arm.c -lm /tmp/ccgJ4gnE.o(.text+0x18c8): In function `BlinkC__Boot__booted': : undefined reference to `printdbg' /tmp/ccgJ4gnE.o(.text+0x3bd4): In function `BlinkC__Timer0(float, int, long double,...)(double)': : undefined reference to `printdbg' collect2: ld returned 1 exit status make: *** [exe0] Error 1 I saw some previous archives discussing similar problem for the same error occurring while executing code in TOSSIM. the solution suggested was to add -shared option. but i am in confusion whether it will make any difference to me coz i m not simulating the code instead i m running the code on my amulet motes. please help friends i m desperate to solve this error. Thanks in advance Gaurav
_______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
