0

I have been following the TinyOS tutorial at this link: http://www.cse.wustl.edu/~lu/cse521s/Slides/tutorial.pdf. I cannot get the final project code to compile in tinyos. I'm using windows xp with cygwin and all the latest rpms. When I try to compile the code with "make micaz" I get and error stating "avr gcc: no file or directory found". Here is the code. thanks in advance.

Makefile:

COMPONENT=DemoAppC  
include $(MAKERULES)

DemoMessage.h

#ifndef __DEMOMESSAGE_H 
#define __DEMOMESSAGE_H 
enum 
{ 
AM_DEMO_MSG = 231, 
}; 
typedef nx_struct demo_msg 
{ 
nx_uint16_t lastReading; 
} demo_msg_t; 
#endif

DemoP.nc

    module DemoP 
{ 
uses interface Boot; 
uses interface Leds; 
uses interface Read<uint16_t>; 
uses interface SplitControl as RadioControl; 
uses interface AMSend; 
uses interface Receive; 
uses interface Packet; 
uses interface Timer<TMilli>; 
} 

implementation 
{ 
message_t buf; 
task void readSensor(); 
task void sendBuffer(); 
event void Boot.booted() 
{ 
if(call RadioControl.start() != SUCCESS) 
call Leds.led0On(); 
} 
event void RadioControl.startDone(error_t err) 
{ 
if(err != SUCCESS) 
call Leds.led0On(); 
if(TOS_NODE_ID == 0) 
call Timer.startPeriodic(64); 
} 

event void Timer.fired() 
{ 
post readSensor();  
} 
task void readSensor() 
{ 
if(call Read.read() != SUCCESS) 
post readSensor(); 
} 
event void Read.readDone(error_t err, uint16_t val) 
{ 
demo_msg_t * payload = (demo_msg_t *)call Packet.getPayload(&buf, sizeof(d
payload->lastReading = val; 
post sendBuffer(); 
} 
task void sendBuffer() 
{ 
if(call AMSend.send(AM_BROADCAST_ADDR, 
&buf, sizeof(demo_msg_t)) != SUCCESS) 
post sendBuffer(); 
} 
event void AMSend.sendDone(message_t * jkdsakljads, error_t err) 
{ 
if(err != SUCCESS) 
post sendBuffer(); 
} 
event message_t * Receive.receive(message_t * m,void * payload,uint8_t size) 
{ 
demo_msg_t * dpayload = (demo_msg_t *)payload; 
call Leds.set(dpayload->lastReading / 200); 
return m; 
} 
event void RadioControl.stopDone(error_t err) {} 

DemoAppC.nc

    #include "DemoMessage.h" 
configuration DemoAppC{} 
implementation{ 
components DemoP, MainC; 
DemoP.Boot -> MainC.Boot; 
components LedsC; 
DemoP.Leds -> LedsC; 
components new HamamatsuS10871TsrC() as PhotoSensor; 
DemoP.Read -> PhotoSensor; 
components ActiveMessageC; 
DemoP.RadioControl -> ActiveMessageC; 
components new AMSenderC(AM_DEMO_MSG), 
new AMReceiverC(AM_DEMO_MSG); 
DemoP.AMSend -> AMSenderC; 
DemoP.Receive -> AMReceiverC; 
DemoP.Packet -> AMSenderC; 
components new TimerMilliC(); 
DemoP.Timer -> TimerMilliC; 
} 

2 Answers2

1

I had the same issue. Had to install avr-gcc from https://github.com/osx-cross/homebrew-avr

be-ee
  • 111
  • 3
0

avr-gcc must not be installed correctly. Make sure you have all of the RPMs from http://docs.tinyos.net/tinywiki/index.php/Manual_installation_using_RPM_packages under the avr section installed.

If rpm -ivh avr-gcc-4.1.2-1.cygwin.i386.rpm returns that the package is already installed then you need to add/usr/bin to your $PATH.

Brad
  • 5,845
  • 7
  • 30
  • 29