[Tinyos-help] Compilation Problems in Tinyos-2.x
Murtuza
mirmurtuza at gmail.com
Thu Mar 15 10:47:09 PDT 2007
Hello Friends,
first of all I would like to thank everybody out here who do such a
wonderful thing by helping others and novices like me.
I have a compilation error in my application. I am using TinyOS-2.x and
tried to compile a simple application for mica2 motes. But it shows the
following error.
murtuza at hst000053326um:/opt/tinyos-2.x/apps/SimpleCmd> make mica2
mkdir -p build/mica2
compiling SimpleCmdC to a mica2 binary
ncc -o build/mica2/main.exe -Os -finline-limit=100000 -Wall -Wshadow
-Wnesc-all -target=mica2 -fnesc-cfile=build/mica2/app.c -board=micasb
-fnesc-dump=wiring -fnesc-dump='interfaces(!abstract())'
-fnesc-dump='referenced(interfacedefs, components)'
-fnesc-dumpfile=build/mica2/wiring-check.xml SimpleCmdC.nc -lm
/usr/lib/gcc/avr/3.4.3/../../../../avr/lib/avr5/crtm128.o(.init9+0x0): In
function `__bad_interrupt':
../../../crt1/gcrt1.S:104: undefined reference to `main'
make: *** [exe0] Error 1
Can anyone tell me what could the problem be. I have checked all the paths
and they are set correctly. The example codes in apps directory work well.
The makefile is O.K. The path $MAKERULES is also set properly.
The following is the code which i tried to compile
File : SimpleCmdC.nc
#include "SimpleCmdMsg.h"
module SimpleCmdC {
uses interface Boot;
uses interface Leds;
uses interface AMSend;
//uses interface StdControl;
uses interface SplitControl as RadioControl;
}
implementation {
message_t packet;
bool sendBusy;
//uint8_t *Buffer;
uint32_t seq;
uint32_t Total_len;
uint32_t Addr_offset;
void SystemInit()
{
call Leds.led0Off();
call Leds.led1Off();
call Leds.led2Off();
seq = 1;
sendBusy = FALSE;
call RadioControl.start();
call Leds.led0Toggle();
}
task void postmsg()
{
SimpleCmdMsg *msg = (SimpleCmdMsg *)(call AMSend.getPayload
(&packet));
msg->NodeId = 1;
msg->SeqNo = seq;
msg->message = 100;
if(sendBusy == FALSE)
{
if((call AMSend.send(AM_BROADCAST_ADDR, &packet,
sizeof(SimpleCmdMsg)))==SUCCESS)
{
call Leds.led1On();
sendBusy == TRUE;
}
else
call Leds.led2On();
}
}
event void Boot.booted()
{
SystemInit();
}
event void RadioControl.startDone(error_t err)
{
if(err != SUCCESS)
{
call RadioControl.start();
post postmsg();
}
else
{
call Leds.led0Toggle();
}
}
event void AMSend.sendDone(message_t *msg, error_t error)
{
if(error==SUCCESS)
{
call Leds.led1Off();
call RadioControl.stop();
}
}
event void RadioControl.stopDone(error_t err)
{
if (err != SUCCESS)
{
call RadioControl.stop();
}
else
{
}
}
}
File : SimpleCmdAppC.nc
#include "SimpleCmdMsg.h"
configuration SimpleCmdAppC
{}
implementation
{
components MainC;
components LedsC;
components ActiveMessageC;
components SimpleCmdC as App;
App->MainC.Boot;
App.Leds->LedsC;
App.RadioControl->ActiveMessageC;
App.AMSend->ActiveMessageC;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20070315/3f09a39f/attachment-0001.htm
More information about the Tinyos-help
mailing list