Hello Anna, we have been giving the C file in the PFLAGS of the Makefile:
PFLAGS+=hello.c Without any previous compilation by $(CC). Possibly the include should be specified as well: PFLAGS+=-I. Sometimes it's also necessary to add: __attribute__ @spontaneous() @C() Hope this helps, Markus > Hello all, > > I know that this question has been asked several times, but unfortunately > all of the proposed solutions do not work for me. I also tried to use some > examples from the tinyos apps/ folder, but that failed too. So, here is > the standard question: > > I want to have an external C function, declared in hello.h and defined in > hello.c. Then, I want to include the header file into my tinyos app and to > use the function from inside the tinyos code. The makefile I prepared > looks like this (I got it from an example in this mailing list) > > COMPONENT=BlinkAppC > LDFLAGS = hello.o > hello.c: hello.h > $(CC) -o hello.o hello.c > include $(MAKERULES) > > The cryptic error, which tiynos gives me is: > > anna@ubuntu:~/tinyos/apps/Blink$ make telosb > mkdir -p build/telosb > compiling BlinkAppC to a telosb binary > ncc -o build/telosb/main.exe -Os -O -mdisable-hwmul -fnesc-separator=__ > -Wall -Wshadow -Wnesc-all -target=telosb -fnesc-cfile=build/telosb/app.c > -board= -DDEFINED_TOS_AM_GROUP=0x22 -DIDENT_APPNAME=\"BlinkAppC\" > -DIDENT_USERNAME=\"anna\" -DIDENT_HOSTNAME=\"ubuntu\" > -DIDENT_USERHASH=0xf53e043cL -DIDENT_TIMESTAMP=0x4e9fd666L > -DIDENT_UIDHASH=0x6d89c825L -DCC2420_NO_ACKNOWLEDGEMENTS BlinkAppC.nc -lm > In file included from BlinkAppC.nc:45: > In component `BlinkC': > BlinkC.nc:52: two or more data types in declaration of `Boot.booted' > BlinkC.nc:53: conflicting types for `Boot.booted' > /opt/tinyos-2.1.1/tos/interfaces/Boot.nc:49: previous declaration of > `Boot.booted' BlinkC.nc: In function `Timer0.fired': > BlinkC.nc:61: implicit declaration of function `hello' > make: *** [exe0] Error 1 > > What is happening? How to solve this issue? > > Thanks a lot, > Anna > > > > -- > Dr. Anna Förster > PostDoctoral Researcher > Networking Laboratory, SUPSI > Via Cantonale, Galleria 2 > Manno, Switzerland > Tel. + 41 58 666 6597 > http://www.dti.supsi.ch/~afoerste/ > > > _______________________________________________ > Tinyos-help mailing list > [email protected] > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help ------------------------------------------------ | Dipl.-Ing. Markus Becker | Communication Networks | TZI - Center for Computing Technologies | University Bremen | Germany ------------------------------------------------ | web: http://www.comnets.uni-bremen.de/~mab/ | mailto: [email protected] | telephone: +49 421 218 62379 | building: NW1 room: N2260 ------------------------------------------------ _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
