I have explained how to set source and destination nodes. What you now need to do is use conditional branching in your makefile:
ifdef SRC PFLAGS += -DSRC_NODE=$(SRC) else PFLAGS += -DSRC_NODE=0 endif Invoke make like so: prompt$ SRC=2 make pc -- Warm regards, Darren Bishop, MSc, BSc (Hons), MBCS On Saturday 12 August 2006 09:33, saadia khan wrote: > Thankyou for answering. > I know about adding these flags in the makefile. What I exactly need to > know is that how to set the ids of source and destination nodes at the > compile time or runtime as arguments e.g., at command prompt something like > following: > > //for compiling a pc simulation > make SRC_NODE=33 DEST_NODE=12 pc > // or for runtime > main.exe num_nodes=50 src=24 dest=38 > > i am asking for compile time because as you know, each mote is seperately > compiled and run, but in case of simulation, its all done in one exe. > Thankyou again, > > S khan > > > > > > > ----- Original Message ---- > From: Darren Bishop <[EMAIL PROTECTED]> > To: saadia khan <[EMAIL PROTECTED]>; tos help > <[email protected]> Sent: Saturday, August 12, 2006 > 12:41:18 PM > Subject: RE: [Tinyos-help] Passing Arguments at compile time > > All you need to do is define and use a compile-time flag eg: > > > In your application directory e.g. apps/Blink equivalent, open Makefile > and add: > > PFLAGS+= –DSRC_NODE=2 > PFLAGS+= –DDEST_NODE=49 > > These are pre-processor flags. In your code simply test there value: > > If (SRC_NODE == TOS_LOCAL_ADDRESS) { > ;// do something interesting > } > > Likewise for DEST_NODE. > > I am writing a site-survey experiment myself at the moment. It is > scripted using Python and I have implemented Command Interpreter > components, which effectively communicate with the Python script over UART. > Using this I can set which node is the transmitter at runtime. There is a > component suite called Command (or near enough…) which provides this > functionality (obviously I discovered it too late and haven’t delved into – > a retro-fit maybe a possibilty); review the source to see if it fits your > needs > > Best regards, > > --- > Darren Bishop > > > From: saadia khan [mailto:[EMAIL PROTECTED] > Sent: 12 August 2006 08:04 > To: tos help > Subject: [Tinyos-help] Passing Arguments at compile time > > > Hi all, > > I'm currently implementing a routing protocol in tinyos as a TOSSIM > simulation. If want to set a node as source node and another as a > destination node. What i need to know is that whether i should do this at > compile time or run time, because for simulation i think it doesn't matter > if i take the arguments at runtime or compile time, but since i want this > implementation to be flexible enough to accomodate the motes later on (i'm > not using them right now), so what is the right way to do this? Secondly, > if it has to be at compile time then, what is the correct procedure to do > that? i figured it out that i'll have to deal with the makefiles but need > guidance in this case. > > Thank you > S Khan _______________________________________________ Tinyos-help mailing list [email protected] https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
