我一直在关注此链接的TinyOS教程:http://www.cse.wustl.edu/~lu/cse521s/Slides/tutorial.pdf。我无法获得最终的项目代码在tinyos中编译。我正在使用带有cygwin的windows xp和所有最新的rpms。当我尝试使用“make micaz”编译代码时,我得到并且错误声明“avr gcc:找不到文件或目录”。这是代码。提前致谢。
生成文件:
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;
}
答案 0 :(得分:1)
我有同样的问题。必须从https://github.com/osx-cross/homebrew-avr
安装avr-gcc答案 1 :(得分:0)
avr-gcc
。确保您已安装avr
部分下的http://docs.tinyos.net/tinywiki/index.php/Manual_installation_using_RPM_packages的所有RPM。
如果rpm -ivh avr-gcc-4.1.2-1.cygwin.i386.rpm
返回已安装软件包,则需要将/usr/bin
添加到$PATH
。