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
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to