[Tinyos-help] #ifdef support in nesc.

Tehn Yit Chin tehn-yit.chin at greyinnovation.com
Thu Jun 29 17:33:49 PDT 2006


Hi,

Does anyone know if #ifdef is supported in nesc?

I was experimenting with SurgeM.nc in apps/surge, and the following bit 
of code is not compiling for me.

   event result_t Timer.fired() {
     dbg(DBG_USR1, "SurgeM: Timer fired\n");
     timer_ticks++;
     if (timer_ticks % TIMER_GETADC_COUNT == 0) {
       call ADC.getData();
     }

     // If we're the focused node, chirp
     if (focused && timer_ticks % TIMER_CHIRP_COUNT == 0) {
#ifdef CHIRP_ENABLE
       call Sounder.start();
#endif /* CHIRP_ENABLE*/
     }
     // If we're the focused node, chirp
     if (focused && timer_ticks % TIMER_CHIRP_COUNT == 1) {
#ifdef CHIRP_ENABLE
       call Sounder.stop();
#endif /* CHIRP_ENABLE*/
     }

The results are

$ make mica2
     compiling Surge to a mica2 binary
ncc -o build/mica2/main.exe -Os -board=micasb -target=mica2 
-I%T/lib/Route -I%T/lib/Queue -I%T/lib/Broadcast -Wall -Wshadow -DDEF_TO
S_AM_GROUP=0x7d -Wnesc-all -finline-limit=100000 
-fnesc-cfile=build/mica2/app.c  Surge.nc -lm
SurgeM.nc: In function `Timer.fired':
SurgeM.nc:163: Sounder.start not connected
SurgeM.nc:169: Sounder.stop not connected
SurgeM.nc: In function `Bcast.receive':
SurgeM.nc:248: Sounder.init not connected
SurgeM.nc:265: Sounder.stop not connected
make: *** [build/mica2/main.exe] Error 1

I also has the following the module definition as well.

#ifdef CHIRP_ENABLE
     interface StdControl as Sounder;
#endif /* CHIRP_ENABLE */

I am using nesc 1.1. Any pointer is appreciated.

-- 
Tehn Yit Chin
Embedded System Engineer, Grey Innovation Pty. Ltd.


-- 
Tehn Yit Chin
Embedded System Engineer, Grey Innovation Pty. Ltd.


More information about the Tinyos-help mailing list