[Tinyos-help] Java Makefile
Muhammad Azhar
leo_az_83 at hotmail.com
Mon Feb 26 18:03:54 PST 2007
Hi,
Thanks for the reply, but I have no idea how to set the env var
MAKERULES to point to the right file. I have already made the necessary
changes, and I tried to do a Google search on explicitly setting MAKERULES
in tinyos, but I just can't seem to get any useful information.
I'd also like to clarify something else. Although my 2 structures are
not nested (i.e. none from the first structure is used in the second and
vice-versa), the beacon is a signal for the mote to start sending messages,
which is the countmsg structure. By using 2 different AM ids for these 2
structures, I am not too sure if it will affect the output of the program.
Thanks in advance.
Regards,
Azhar
>From: Michael Schippling <schip at santafe.edu>
>Reply-To: schip at santafe.edu
>To: Muhammad Azhar <leo_az_83 at hotmail.com>
>CC: tinyos-help at Millennium.Berkeley.EDU
>Subject: Re: [Tinyos-help] Java Makefile
>Date: Mon, 26 Feb 2007 13:43:33 -0700
>
>OK, despite never having used mig and being highly resistant to the TOS
>Makefile strain, I did manage to get this to work in my env...I have
>attached my version of your Makefile and a hacked OscopeMsg.h converted
>to be something like your C.h.
>
>First, you most definitely want to use different values for AM_ type IDs
>because this is the way the system tells your messages apart. You put the
>type id, e.g., AM_BEACON, in the TOS_Msg.type field before sending...
>
>The only change to your Makefile was to use the real names of the structs
>in the mig lines (making the names match the java file names you have
>assigned including the upper/lower case), and since I don't know what you
>called yours I can't be sure I got it the way you want...I also assume that
>you have an env var MAKERULES set to point to the right file, I just put
>an explicit setting in my file.
>
>With these two files I was able to generate the *Msg.class files using
> make mica2
>
>MS
>
>
>
>
>Muhammad Azhar wrote:
>>Hi,
>> Sorry for the late reply, but I didn't have a chance to use TinyOS for
>>the past few days. Anyway, the 2 structures are not nested structures -
>>i.e. they are independent of each other. Also, I did not add the dash "-"
>>sign to the Makefile - in my previous email, the "-" was just to link the
>>code to what I was going to say (my apologies for the confusion).
>> Actually, I have tried putting a space instead of ";" - but it still
>>doesn't work. Let me just paste the whole Makefile:
>>
>>COMPONENT=CountAppC
>>BUILD_EXTRA_DEPS = CountMsg.class BeaconMsg.class
>>
>>CountMsg.class: CountMsg.java
>> javac CountMsg.java
>>
>>BeaconMsg.class: BeaconMsg.java
>> javac BeaconMsg.java
>>
>>CountMsg.java: C.h
>> mig java -target=$(PLATFORM) $(CFLAGS) -java-classname=CountMsg C.h
>>countmsg -o $@
>>
>>BeaconMsg.java: C.h
>> mig java -target=$(PLATFORM) $(CFLAGS) -java-classname=BeaconMsg C.h
>>beacon -o $@
>>
>>include $(MAKERULES)
>>
>> When I first compiled, it gave me this warning: "warning: Cannot
>>determine AM type for beacon (Looking for definition of AM_BEACON)". I
>>had AM_COUNTMSG, but not AM_BEACON initially. So when I tried running the
>>java program for countmsg, the structure for countmsg worked, but when I
>>tried running the java program for beacon, there wasn't any output. Thus,
>>I tried inserting AM_BEACON into my C.h file. I gave it the same value as
>>AM_COUNTMSG. This time round, the warning disappeared, but the output was
>>rubbish. Let me paste some of it:
>>
>>1172479975200: Message <BeaconMsg>
>> [nodeid=0x700]
>> [treeDepth=0xd500]
>>
>>1172479976181: Message <BeaconMsg>
>> [nodeid=0x700]
>> [treeDepth=0xd600]
>>
>>1172479977150: Message <BeaconMsg>
>> [nodeid=0x700]
>> [treeDepth=0xd400]
>>
>> The nodeid should be 0x7 and not 0x700. Also, the treeDepth must
>>always be a constant value - in fact it should be 0x1 in this case, as the
>>number of hops to the root is only 1 (I have verified this with the
>>countmsg structure). Thus, I tried changing the value of AM_BEACON, but
>>of course, as I expected it, running the java program did not generate
>>anything.
>>
>> Thank you for your patience.
>>
>>Regards,
>>Azhar
>>
>>>From: Michael Schippling <schip at santafe.edu>
>>>Reply-To: schip at santafe.edu
>>>To: Muhammad Azhar <leo_az_83 at hotmail.com>
>>>CC: tinyos-help at Millennium.Berkeley.EDU
>>>Subject: Re: [Tinyos-help] Java Makefile
>>>Date: Wed, 21 Feb 2007 19:35:27 -0700
>>
>>>
>>>I'm sorry but my knowledge of makefile construction stopped accreting
>>>around 1990 so the TOS inner make workings are pretty much opaque to me.
>>>try: man make in the bash shell to see some more modern instructions.
>>>
>>>However the general makefile structure is:
>>>
>>>tagname: things it is dependent on
>>> instructions for making tagname
>>> more instruction...
>>><new tagname>
>>>
>>>where each of "things" "it" "is" "dependent" "on" should exist as
>>>other "tagname:" type definitions (or as some expansion of possibly
>>>headslappingly obscure internal rules, usually having to do with
>>>extensions like .c->.o, etal).
>>>
>>>I'm not sure what you mean with your first question on "main_struct
>>>and sub_struct". If they are nested structures, I don't know if MIG
>>>is smart enough to handle it. If what you want is to make two different
>>>TOS_Msg structures, they you should be able to do that with two separate
>>>struct header files and just copy and modify whatever lines work in the
>>>makefile.
>>>
>>>I also don't know where you're going with
>>> BUILD_EXTRA_DEPS: MainMsg.class;BeaconMsg.class -
>>>but a semi-colon ';' is probably no thing to use at the time, try
>>>a space instead ' '. And I'm not sure if the dash '-' is significant
>>>to something or not.
>>>
>>>As a wild guess after writing all this, perhaps you are trying to make
>>>two TOS_Msg structs and BUILD_EXTRA_DEPS is called someplace in your
>>>makefile to do one already, so maybe all you really wanted to do is:
>>>
>>> BUILD_EXTRA_DEPS: MainMsg.class BeaconMsg.class
>>>
>>>But (assuming that MainMsg.class was the thing that worked already) I
>>>think
>>>you may find some more instructions for it in the makefile which you will
>>>need to replicate for your BeaconMsg.class....
>>>
>>>If you still have trouble you should post the whole makefile and the
>>>output.
>>>
>>>MS
>>>
>>>
>>>Muhammad Azhar wrote:
>>>>Hi Michael, thanks for showing me how to modify data received, it really
>>>>helped.
>>>>
>>>>For now, I'm really wondering if it's possible to show more than one
>>>>structure in the mig Java output. 'Coz in the tutorial, we were only
>>>>taught how to show messages from one structure. Supposing I have more
>>>>than one structure, call them main_struct and sub_struct, instead of
>>>>just outputting main_struct, is there a way for me to output sub_struct
>>>>as well as main_struct in a single Makefile? Which part of the Makefile
>>>>command do I need to modify?
>>>>
>>>>Out of curiosity, I tried to modify my Makefile BUILD_EXTRA_DEPS:
>>>>MainMsg.class;BeaconMsg.class - but this doesn't work (and did the same
>>>>mig java for Beacon as how I did my Main, but well....) :(
>>>>error msg:
>>>>mkdir -p build/telosb
>>>>BeaconMsg.class FORCE
>>>>make: BeaconMsg.class: Command not found
>>>>make: *** [exe0] Error 127
>>>>
>>>>Thanks.
>>>>
>>>>Regards,
>>>>Azhar
>>>>
>>
>/* Hacked outa Message types used by Oscope, for example only. */
>
>enum {
> BUFFER_SIZE = 10
>};
>
>struct BeaconMsg
>{
> uint16_t sourceMoteID;
> uint16_t lastSampleNumber;
> uint16_t channel;
> uint16_t data[BUFFER_SIZE];
>};
>
>struct CountMsg
>{
> /* Empty payload! */
>};
>
>enum {
> AM_BEACONMSG = 10,
> AM_COUNTMSG = 32
>};
>
>COMPONENT=CountAppC
>BUILD_EXTRA_DEPS = CountMsg.class BeaconMsg.class
>
>CountMsg.class: CountMsg.java
> javac CountMsg.java
>
>BeaconMsg.class: BeaconMsg.java
> javac BeaconMsg.java
>
>CountMsg.java: C.h
> mig java -target=$(PLATFORM) $(CFLAGS) -java-classname=CountMsg C.h
>CountMsg -o $@
>
>BeaconMsg.java: C.h
> mig java -target=$(PLATFORM) $(CFLAGS) -java-classname=BeaconMsg C.h
>BeaconMsg -o $@
>
>MAKERULES = C:/cygwin/opt/tinyos-1.1.7/tools/make/Makerules
>
>include $(MAKERULES)
More information about the Tinyos-help
mailing list