[Tinyos-help] Compile problems: undefined reference to main

Kenneth Lima kglima at yahoo.com
Wed Sep 14 03:38:56 PDT 2005


Hi all,
 
i just started programming with Nesc and tinyOS and i am trying to create some PWM code for my AVR Atmega 128 Microcontroller. I first receive the warning
 
/usr/local/lib/gcc-lib/avr/3.3-tinyos/../../../../avr/lib/avr5/crtm128.o: in function `__bad_interrupt´´:
and then the error
../../../crt1/gcrt1.S:99: undefined reference to `main´
 
 
I already used  "include ../Makerules" in my makefile. Has anyone encountered this before. Any help will be of great help. 
 
Thanks
 
This is how my code looks like :
 
/*********************** TxRxControllerM.nc *************************************/
includes sensorboard;  
module TxRxControllerM {
  provides interface StdControl;
 
  uses interface StdControl as USoundTxrControl;
  uses interface UltrasoundTransmit;
  uses interface Timer;
  uses interface Leds;
}
implementation {
  
 command result_t StdControl.init(){
   call USoundTxrControl.init(); 
   return SUCCESS;
  }
  command result_t StdControl.start(){
          call Leds.redOff();    
          sbi(EICRA, ISC01);
          sbi(EICRA, ISC00);  // Rising edge of INT0 generates an interrupt
          sbi(EIMSK,INT0) ;   // External inerrupt enable INT0 (PE4)
          return SUCCESS;
  }
  
  command result_t StdControl.stop(){
        cbi(EIMSK,INT0) ;   // disable interrupt enable INT0  
        call USoundTxrControl.stop();
 return SUCCESS;
  }
 
  
  event result_t Timer.fired(){
    return SUCCESS;
  }

 
  TOSH_SIGNAL(SIG_INTERRUPT0) { /* Debouncing */
    __nesc_enable_interrupt();  
          call Leds.redOff();
          call UltrasoundTransmit.sendUltrasoundPulse(10); // Send 10 pulses     
  }
}
 
/*********************** TxRxControllerC.nc *************************************/

configuration TxRxControllerC
{
  provides interface StdControl;
}
implementation
{
 components TxRxControllerM, USoundTxrC,  LedsC as Leds, TimerC;
  StdControl = TxRxControllerM;
  StdControl = TimerC;
  TxRxControllerM.USoundTxrControl->USoundTxrC.StdControl;
  TxRxControllerM.UltrasoundTransmit->USoundTxrC;
  TxRxControllerM.Leds -> Leds;
  TxRxControllerM.Timer -> TimerC.Timer[unique("Timer")];
}
 
/*********************** USoundTxrM.nc ***********************/
 
includes sensorboard;
module USoundTxrM {
  provides interface StdControl;
  provides interface UltrasoundTransmit;
}
implementation 
{
  command result_t StdControl.init() {
    TOSH_MAKE_USOUND_TXR_CTL_OUTPUT();     /* DDRC = _BV(PC1); -- PWM output */
 
    dbg(DBG_BOOT, "ULTRASOUND transmitter initialized.\n");
    return SUCCESS;
  }
  command result_t StdControl.start() {
 
    return SUCCESS;
  }
  command result_t StdControl.stop() {
   return SUCCESS;
  }
  //this resonates the ultrasound transmitter at 25usec pulses  (40Khz)  
command result_t UltrasoundTransmit.sendUltrasoundPulse(uint8_t numPulses)
  {
 while(numPulses > 0) {
   TOSH_SET_USOUND_TXR_CTL_PIN(); //PC1=1;
   TOSH_uwait(25);
   asm volatile ("nop" ::);
   TOSH_CLR_USOUND_TXR_CTL_PIN(); //PC1=0;
   TOSH_uwait(24);
   asm volatile ("nop" ::);
   asm volatile ("nop" ::);
  numPulses--;
 }
        return SUCCESS;
  }
}
 
/*************************************USoundTxrC.nc *************************/
includes sensorboard;
configuration USoundTxrC
{
  provides interface StdControl;
  provides interface UltrasoundTransmit;
}
implementation
{
  components USoundTxrM;
  StdControl = USoundTxrM;
  UltrasoundTransmit = USoundTxrM;
}

 
Thanks in advance
Kenneth
 


This world is no fun!!!!
		
---------------------------------
Yahoo! for Good
 Click here to donate to the Hurricane Katrina relief effort. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20050914/765d812a/attachment-0001.html


More information about the Tinyos-help mailing list