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 <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: Muhammad Azhar <[EMAIL PROTECTED]>
CC: [email protected]
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



_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to