Hi Srinivas, I have the same problem now myself. It seems that TinyOS doesn't support "extern" (can anyone comment on this statement?). How did you solve your problem?
Arik On Thu, Dec 24, 2009 at 01:08, Srinivas Hegde <[email protected]>wrote: > Hi, > Oh I didnt look at it from the C angle. Thanks for the reply. > > I had one more doubt: > > I have made changes to the PowerCycleP.nc file and add that variable as > extern in my app code, My app uses DefaultLpl that calls the PowerCycleP > module. I thought it may not be calling properly, So I inserted the same > time functionality in DefaultLpl module. But, when I do the make I get the > same error for both the modules: > > mkdir -p build/telosb > compiling CommAppC to a telosb binary > ncc -o build/telosb/main.exe -Os -O -mdisable-hwmul -Wall -Wshadow > -Wnesc-all - > target=telosb -fnesc-cfile=build/telosb/app.c -board= > -DDEFINED_TOS_AM_GROUP=0x2 > 2 "-DCC2420_DEF_RFPOWER=7" -DIDENT_APPNAME=\"CommAppC\" > -DIDENT_USERNAME=\"Srini > vas\" -DIDENT_HOSTNAME=\"Srinivas-PC\" -DIDENT_USERHASH=0x36fc963bL > -DIDENT_TIME > STAMP=0x4b32a109L -DIDENT_UIDHASH=0xc87f05aaL CommAppC.nc -lm > /opt/tinyos-2.x/tos/chips/cc2420/lpl/DefaultLplC.nc:39:2: warning: #warning > "*** > USING DEFAULT LOW POWER COMMUNICATIONS ***" > /opt/tinyos-2.x/tos/chips/cc2420/lpl/DefaultLplP.nc:79: warning: non-atomic > acce > sses to shared variable `over': > /opt/tinyos-2.x/tos/chips/cc2420/lpl/DefaultLplP.nc:477: warning: > non-atomic w > rite > /Local/Temp/ccIG7otV.o: In function `CommC$Rec > eive$receive': > app.c:(.text+0x40cc): undefined reference to `CommC$over' > app.c:(.text+0x40d6): undefined reference to `CommC$stop_time' > app.c:(.text+0x40da): undefined reference to `CommC$stop_time' > app.c:(.text+0x40e2): undefined reference to `CommC$start_time' > app.c:(.text+0x40e6): undefined reference to `CommC$start_time' > make: *** [exe0] Error 1 > > Is there something I should do to include the extern variables in my app > code. Add some env variable maybe to tell the compiler the exact location of > its definition and initialization. > > Sorry but I am new to tinyOS and extern. > > Thanks, > Srinivas > > > On Wed, Dec 23, 2009 at 12:24 AM, Arik Sapojnik <[email protected]>wrote: > >> The problem is a C problem - you have to declare a variable - *rcvpkt *in >> the beginning of a scope. >> Rewrite as follows: >> >> ..... >> if (len == sizeof(Msg)) { >> >> Msg* rcvpkt = (Msg*)payload; <- First >> >> >> local_time = ((stop_time * over) - start_time); >> >> .......... >> >> >> >> >> On Tue, Dec 22, 2009 at 21:07, Srinivas Hegde >> <[email protected]>wrote: >> >>> Hi, >>> I have written a code that gets the local time at start and stop of each >>> radio period in MSp430PowerCycleP.nc. I would like to use these variables in >>> my application code to find the actual ON time of the radio. But, the extern >>> gives me error >>> >>> implementation { >>> >>> extern uint32_t stop_time; >>> extern uint32_t start_time; >>> extern uint8_t over; >>> uint32_t local_time[2]; >>> >>> ....... >>> >>> event message_t* Receive.receive(message_t* msg, void* payload, uint8_t >>> len) { >>> >>> call Leds.led2Toggle(); >>> >>> if (len == sizeof(Msg)) { >>> local_time = ((stop_time * over) - start_time); >>> >>> Msg* rcvpkt = (Msg*)payload; <--- Line no 127 >>> >>> .......... >>> >>> I am getting the following error: >>> In component `CommC': >>> CommC.nc: In function `Receive.receive': >>> CommC.nc:127: syntax error before `*' >>> CommC.nc:131: `srlpkt' undeclared (first use in this function) >>> CommC.nc:131: (Each undeclared identifier is reported only once >>> CommC.nc:131: for each function it appears in.) >>> CommC.nc:131: `rcvpkt' undeclared (first use in this function) >>> >>> The code works fine if I remove the following line: >>> local_time = ((stop_time * over) - start_time); >>> >>> I think there is some error in the extern variables usage. Can you please >>> help me with that. >>> >>> Thanks, >>> Srinivas Hegde >>> >>> _______________________________________________ >>> Tinyos-help mailing list >>> [email protected] >>> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help >>> >> >> >> >> -- >> Best Regards, >> Arik Sapojnik >> [email protected] >> > > -- Best Regards, Arik Sapojnik
_______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
