[Tinyos-help] a strange error

weiping SONG w.song at cs.ucc.ie
Tue Mar 11 05:32:41 PDT 2008


Hi all,

I faced a strange error  this morning as following:
I could not compile my TestRadioAppC.nc if I put "Counter++;" before 
radio_test_mag_t in TestRadioC.nc...

---------------------------------------------------------------------
event void TimerRadio.fired() {
	 // Counter++;
	  if (locked) {
	    return;
	  }
	  else {
	    Counter++;
	    radio_test_msg_t* rcm = (radio_test_msg_t*)call Packet.getPayload(&packet, NULL);
	    if (call Packet.maxPayloadLength() < sizeof(radio_test_msg_t)) {
	      return;
	    }

	    rcm->voltage = InVoltage;
	    rcm->count = Counter;
	    rcm->temp = 0;
	    if (call AMSend.send(AM_BROADCAST_ADDR, &packet, sizeof(radio_test_msg_t)) == SUCCESS) {
		 locked = TRUE;
	    }
	  }
	}
----------------------------------------------------------------------------------------------------------
[realtime at m1-02 TestRadio]$ make telosb
mkdir -p build/telosb
    compiling TestRadioAppC to a telosb binary
ncc -o build/telosb/main.exe -Os -O -mdisable-hwmul -Wall -Wshadow -DDEF_TOS_AM_GROUP=0x7d -Wnesc-all -target=telosb -fnesc-cfile=build/telosb/app.c -board= -DIDENT_PROGRAM_NAME=\"TestRadioAppC\" -DIDENT_USER_ID=\"realtime\" -DIDENT_HOSTNAME=\"m1-02.ucc.ie\" -DIDENT_USER_HASH=0x69427c28L -DIDENT_UNIX_TIME=0x47d67976L -DIDENT_UID_HASH=0xc8fd72abL  TestRadioAppC.nc -lm
In file included from TestRadioAppC.nc:13:
In component `TestRadioC':
TestRadioC.nc: In function `TimerRadio.fired':
TestRadioC.nc:47: syntax error before `*'
TestRadioC.nc:52: `rcm' undeclared (first use in this function)
TestRadioC.nc:52: (Each undeclared identifier is reported only once
TestRadioC.nc:52: for each function it appears in.)
make: *** [exe0] Error 1
[realtime at m1-02 TestRadio]$

----------------------------------------------------------------------------------------------------------------------------------

But it worked well if I put "Counter++;" in the first line of the event.

I do not understand why, can some one help me?

Regards,

Weiping Song


More information about the Tinyos-help mailing list