[Tinyos-help] Fwd: Problems with Meshbean
Miklos Maroti
mmaroti at math.u-szeged.hu
Thu Jan 13 06:44:45 PST 2011
---------- Forwarded message ----------
From: Miklos Maroti <mmaroti at math.u-szeged.hu>
Date: Thu, Jan 13, 2011 at 12:59 PM
Subject: Re: [Tinyos-help] Problems with Meshbean
To: 200911033 at daiict.ac.in
Hi!
- Get the latest tinyos-2.x code from google to a directory, e.g.
/home/xxx/tinyos-2.x.
- Get the latest tinyos-2.x-contrib/ethz from sourceforge to a
directory, e.g. /home/xxx/tinyos-2.x-contrib/ethz
- Then go to the /home/xxx/tinyos-2.x/tos/platforms directory and type
ln -s /home/xxx/tinyos-2.x-contrib/ethz/meshbean900/tos/platforms/meshbean
meshbean
Do the same for meshbean900. This will create symbolic directories in
your tinyos-2.x tree that will point to the tinyos-2.x-contrib tree.
Then do the same for the support/make/meshbean.target and
meshbean900.target files: in /home/xxx/tinyos-2.x/support/make and
type
ln -s /home/xxx/tinyos-2.x-contrib/ethz/meshbean900/support/make/meshbean.target
meshbean.target
Then you should be able to compile everything. Best,
Miklos
On Thu, Jan 13, 2011 at 12:43 PM, <200911033 at daiict.ac.in> wrote:
> Hi Miklos,
> Thanks for replying, but I couldnt understand what you have stated in the last post. I will share the two files that I am trying to compile for meshbean, please see if they are correct.
>
> BlinkToRadioAppC.nc
>>>
>>> #include <Timer.h>
>>> #include "BlinktoRadio.h"
>>>
>>> configuration BlinkToRadioAppC {
>>> }
>>> implementation {
>>> components MainC;
>>> components LedsC;
>>> components BlinktoRadioC as App;
>>> components new TimerMilliC() as Timer0;
>>> components RF230ActiveMessageC;
>>> components new AMSenderC(AM_BLINKTORADIO);
>>> components new AMReceiverC(AM_BLINKTORADIO);
>>> // components CC2420PacketC;
>>> // App.CC2420Packet -> CC2420PacketC;
>>>
>>> // components for serial communication with pc
>>> // components SerialActiveMessageC;
>>> // components new SerialAMSenderC(AM_RSSI) as PCSender;
>>>
>>> App.Boot -> MainC;
>>> App.Leds -> LedsC;
>>> App.Timer0 -> Timer0;
>>> App.Packet -> AMSenderC;
>>> App.AMPacket -> AMSenderC;
>>> App.AMSend -> AMSenderC;
>>> App.AMControl ->RF230ActiveMessageC;
>>> App.Receive -> AMReceiverC;
>>> // App.SerialSend -> PCSender;
>>> // App.SerialControl -> SerialActiveMessageC;
>>> }
>>>
>>>
>>> BlinktoRadioC.nc
>>>
>>> #include <Timer.h>
>>> #include "BlinktoRadio.h"
>>>
>>> module BlinktoRadioC {
>>> uses interface Boot;
>>> uses interface Leds;
>>> uses interface Timer<TMilli> as Timer0;
>>> uses interface Packet;
>>> uses interface AMPacket;
>>> uses interface AMSend;
>>> uses interface SplitControl as AMControl;
>>> uses interface Receive;
>>>
>>> }
>>> implementation {
>>> uint16_t counter = 0;
>>> bool busy = FALSE;
>>> message_t pkt;
>>>
>>> event void Boot.booted() {
>>> dbg("print","in boot.booted\n");
>>> call AMControl.start();
>>> }
>>>
>>> event void AMControl.startDone(error_t err) {
>>> if (err == SUCCESS) {
>>> dbg("print","in startDone\n");
>>> if(!busy) {
>>>
>>> BlinktoRadioMsg* btrpkt = (BlinktoRadioMsg*)(call Packet.getPayload(&pkt, NULL));
>>> btrpkt->nodeid= TOS_NODE_ID;
>>> btrpkt->hello= (int)"hello";
>>> btrpkt->counter = 1;
>>>
>>>
>>>
>>> if (call AMSend.send(AM_BROADCAST_ADDR, &pkt, sizeof(BlinktoRadioMsg)) == SUCCESS) {
>>> dbg("print","still sending\n");
>>> busy = TRUE;
>>> }
>>>
>>> }
>>> else {
>>> call AMControl.start();
>>> }
>>> }
>>> }
>>>
>>> event void Timer0.fired(){
>>> if(TOS_NODE_ID==1)
>>> {
>>> dbg("print","Acknowledgement not received\n");
>>> }
>>> }
>>>
>>> event void AMControl.stopDone(error_t err) {
>>> }
>>>
>>> event void AMSend.sendDone(message_t* msg, error_t err) {
>>> if (&pkt == msg) {
>>> dbg("print","sendDone \n");
>>> call Timer0.startOneShot(100);
>>> busy=FALSE;
>>> }
>>> if (&pkt != msg) {
>>> dbg("print","sendDone reply\n");
>>> }
>>>
>>> }
>>>
>>> event message_t* Receive.receive(message_t* msg, void* payload, uint8_t len) {
>>>
>>> if (len == sizeof(BlinktoRadioMsg)) {
>>> message_t pktrpl;
>>> BlinktoRadioMsg* btrpkt = (BlinktoRadioMsg *)payload;
>>> BlinktoRadioMsgReply* btrpktrpl = (BlinktoRadioMsgReply*)(call Packet.getPayload(&pktrpl, NULL));
>>> btrpktrpl->nodeid= TOS_NODE_ID;
>>>
>>> call Leds.set(btrpkt->counter);
>>> dbg("print","received from %hhu. \n",btrpkt->nodeid);
>>>
>>> if (call AMSend.send(btrpkt->nodeid, &pktrpl, sizeof(BlinktoRadioMsgReply)) == SUCCESS)
>>> {
>>> dbg("print","still sending reply\n");
>>>
>>> }
>>>
>>> }
>>> if (len == sizeof(BlinktoRadioMsgReply))
>>> {
>>> call Leds.set(2);
>>> dbg("print","got reply\n");
>>> }
>>> return msg;
>>> }
>>> }
>
> Regards,
> Deepak Hemnani.
>
>
> ----- Original Message -----
> From: "Miklos Maroti" <mmaroti at math.u-szeged.hu>
> To: 200911033 at daiict.ac.in, "TinyOS" <tinyos-help at millennium.berkeley.edu>
> Sent: Wednesday, January 12, 2011 12:02:10 PM
> Subject: Re: [Tinyos-help] Problems with Meshbean
>
> Hi! Yes, I know. That is why you need two sources: tinyos2-x. on
> google code and meshbean stuff from tinyos-2.x-contrib/etzh. You
> should add symbolic links in the tinyos-2.x tree to the
> tinyos-2.x-contrib at the following places: to tos/platforms/meshbean
> and meshbean900 and the support/make/meshbean.target and
> meshbean900.target. There might be other files, but these re the ones
> I remember. Miklos
>
> On Wed, Jan 12, 2011 at 6:57 AM, <200911033 at daiict.ac.in> wrote:
>> This code doesn't have the files for meshbean. I searched it throughout.
>>
>> Regards,
>> Deepak Hemnani.
>>
>> ----- Original Message -----
>> From: "Miklos Maroti" <mmaroti at math.u-szeged.hu>
>> To: 200911033 at daiict.ac.in
>> Sent: Tuesday, January 11, 2011 6:08:25 PM
>> Subject: Re: [Tinyos-help] Problems with Meshbean
>>
>> Hi!
>>
>> The tinyos-2.x tree on sourceforge is obsolete. Use this:
>>
>> http://code.google.com/p/tinyos-main/
>>
>> Best,
>> Miklos
>>
>> On Tue, Jan 11, 2011 at 11:25 AM, <200911033 at daiict.ac.in> wrote:
>>> Thanks for reply Miklos.
>>>
>>> I found the source available at Sourceforge and replaced my copy with that one. I couldn't find the contributed code at Google code. However there are still errors in compiling my code. I am pasting the code here for you to review, this is a simple application for testing communication between to meshbean motes. Please review.
>>>
>>> BlinkToRadioAppC.nc
>>>
>>> #include <Timer.h>
>>> #include "BlinktoRadio.h"
>>>
>>> configuration BlinkToRadioAppC {
>>> }
>>> implementation {
>>> components MainC;
>>> components LedsC;
>>> components BlinktoRadioC as App;
>>> components new TimerMilliC() as Timer0;
>>> components RF230ActiveMessageC;
>>> components new AMSenderC(AM_BLINKTORADIO);
>>> components new AMReceiverC(AM_BLINKTORADIO);
>>> // components CC2420PacketC;
>>> // App.CC2420Packet -> CC2420PacketC;
>>>
>>> // components for serial communication with pc
>>> // components SerialActiveMessageC;
>>> // components new SerialAMSenderC(AM_RSSI) as PCSender;
>>>
>>> App.Boot -> MainC;
>>> App.Leds -> LedsC;
>>> App.Timer0 -> Timer0;
>>> App.Packet -> AMSenderC;
>>> App.AMPacket -> AMSenderC;
>>> App.AMSend -> AMSenderC;
>>> App.AMControl ->RF230ActiveMessageC;
>>> App.Receive -> AMReceiverC;
>>> // App.SerialSend -> PCSender;
>>> // App.SerialControl -> SerialActiveMessageC;
>>> }
>>>
>>>
>>> BlinktoRadioC.nc
>>>
>>> #include <Timer.h>
>>> #include "BlinktoRadio.h"
>>>
>>> module BlinktoRadioC {
>>> uses interface Boot;
>>> uses interface Leds;
>>> uses interface Timer<TMilli> as Timer0;
>>> uses interface Packet;
>>> uses interface AMPacket;
>>> uses interface AMSend;
>>> uses interface SplitControl as AMControl;
>>> uses interface Receive;
>>>
>>> }
>>> implementation {
>>> uint16_t counter = 0;
>>> bool busy = FALSE;
>>> message_t pkt;
>>>
>>> event void Boot.booted() {
>>> dbg("print","in boot.booted\n");
>>> call AMControl.start();
>>> }
>>>
>>> event void AMControl.startDone(error_t err) {
>>> if (err == SUCCESS) {
>>> dbg("print","in startDone\n");
>>> if(!busy) {
>>>
>>> BlinktoRadioMsg* btrpkt = (BlinktoRadioMsg*)(call Packet.getPayload(&pkt, NULL));
>>> btrpkt->nodeid= TOS_NODE_ID;
>>> btrpkt->hello= (int)"hello";
>>> btrpkt->counter = 1;
>>>
>>>
>>>
>>> if (call AMSend.send(AM_BROADCAST_ADDR, &pkt, sizeof(BlinktoRadioMsg)) == SUCCESS) {
>>> dbg("print","still sending\n");
>>> busy = TRUE;
>>> }
>>>
>>> }
>>> else {
>>> call AMControl.start();
>>> }
>>> }
>>> }
>>>
>>> event void Timer0.fired(){
>>> if(TOS_NODE_ID==1)
>>> {
>>> dbg("print","Acknowledgement not received\n");
>>> }
>>> }
>>>
>>> event void AMControl.stopDone(error_t err) {
>>> }
>>>
>>> event void AMSend.sendDone(message_t* msg, error_t err) {
>>> if (&pkt == msg) {
>>> dbg("print","sendDone \n");
>>> call Timer0.startOneShot(100);
>>> busy=FALSE;
>>> }
>>> if (&pkt != msg) {
>>> dbg("print","sendDone reply\n");
>>> }
>>>
>>> }
>>>
>>> event message_t* Receive.receive(message_t* msg, void* payload, uint8_t len) {
>>>
>>> if (len == sizeof(BlinktoRadioMsg)) {
>>> message_t pktrpl;
>>> BlinktoRadioMsg* btrpkt = (BlinktoRadioMsg *)payload;
>>> BlinktoRadioMsgReply* btrpktrpl = (BlinktoRadioMsgReply*)(call Packet.getPayload(&pktrpl, NULL));
>>> btrpktrpl->nodeid= TOS_NODE_ID;
>>>
>>> call Leds.set(btrpkt->counter);
>>> dbg("print","received from %hhu. \n",btrpkt->nodeid);
>>>
>>> if (call AMSend.send(btrpkt->nodeid, &pktrpl, sizeof(BlinktoRadioMsgReply)) == SUCCESS)
>>> {
>>> dbg("print","still sending reply\n");
>>>
>>> }
>>>
>>> }
>>> if (len == sizeof(BlinktoRadioMsgReply))
>>> {
>>> call Leds.set(2);
>>> dbg("print","got reply\n");
>>> }
>>> return msg;
>>> }
>>> }
>>>
>>>
>>>
>>> ----- Original Message -----
>>> From: "Miklos Maroti" <mmaroti at math.u-szeged.hu>
>>> To: 200911033 at daiict.ac.in
>>> Cc: tinyos-help at millennium.berkeley.edu
>>> Sent: Tuesday, January 11, 2011 2:48:26 PM
>>> Subject: Re: [Tinyos-help] Problems with Meshbean
>>>
>>> Hi Deepak,
>>>
>>> Do you use the latest tinyos SVN code from google code and the latest
>>> tinyos-2.x-contrib/etzh meshbean platforms? That should work without a
>>> problem.
>>>
>>> Best,
>>> Miklos
>>>
>>> On Tue, Jan 11, 2011 at 6:06 AM, <200911033 at daiict.ac.in> wrote:
>>>> Hello,
>>>> I have been working with TinyOs for quite sometime now. I wrote
>>>> small applications with Micaz and they seemed to work properly, however when
>>>> I wrote them for meshbean I am facing quite a few errors. My guess is that
>>>> my source files are not properly updated. Please guide me with this error. I
>>>> have written a simple application to exchange data.
>>>> Regards,
>>>> Deepak Hemnani.
>>>>
>>>>
>>>> mkdir -p build/meshbean
>>>> compiling BlinkToRadioAppC to a meshbean binary
>>>> ncc -o build/meshbean/main.exe -Os -fnesc-separator=__ -Wall -Wshadow
>>>> -Wnesc-all -target=meshbean -fnesc-cfile=build/meshbean/app.c -board=
>>>> -DDEFINED_TOS_AM_GROUP=0x22 --param max-inline-insns-single=100000
>>>> -DIDENT_APPNAME=\"BlinkToRadioApp\" -DIDENT_USERNAME=\"root\"
>>>> -DIDENT_HOSTNAME=\"localhost.local\" -DIDENT_USERHASH=0x53b81074L
>>>> -DIDENT_TIMESTAMP=0x4d2be47cL -DIDENT_UIDHASH=0xa5a00463L -fnesc-dump=wiring
>>>> -fnesc-dump='interfaces(!abstract())' -fnesc-dump='referenced(interfacedefs,
>>>> components)' -fnesc-dumpfile=build/meshbean/wiring-check.xml
>>>> BlinkToRadioAppC.nc -lm
>>>> In file included from BlinkToRadioAppC.nc:9:
>>>> In component `BlinktoRadioC':
>>>> BlinktoRadioC.nc: In function `AMControl.startDone':
>>>> BlinktoRadioC.nc:30: warning: passing argument 2 of `Packet.getPayload'
>>>> makes integer from pointer without a cast
>>>> BlinktoRadioC.nc: In function `Receive.receive':
>>>> BlinktoRadioC.nc:76: warning: passing argument 2 of `Packet.getPayload'
>>>> makes integer from pointer without a cast
>>>> In component `LocalTimeMicroC':
>>>> /home/thechamp/Desktop/tinyos_testing/tos/platforms/iris/LocalTimeMicroC.nc:
>>>> At top level:
>>>> /home/thechamp/Desktop/tinyos_testing/tos/platforms/iris/LocalTimeMicroC.nc:39:
>>>> no match
>>>> In component `HplRF230C':
>>>> /home/thechamp/Desktop/tinyos_testing/tos/platforms/meshbean/chips/rf230/HplRF230C.nc:72:
>>>> no match
>>>> In component `ActiveMessageC':
>>>> /home/thechamp/Desktop/tinyos_testing/tos/platforms/iris/ActiveMessageC.nc:64:
>>>> no match
>>>> make: *** [exe0] Error 1
>>>>
>>>>
>>>> _______________________________________________
>>>> Tinyos-help mailing list
>>>> Tinyos-help at millennium.berkeley.edu
>>>> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>>>>
>>>
>>
>
More information about the Tinyos-help
mailing list