This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ADuC Interrupt problem - can't enable interrupts on ADuC7024

Hi,
I am having an evaluation board from the ADI which contain ADXL345 and also MCU ADUC7024. I tried to build the files from the example code that they have provided.
As shown below is the example code,

#include <ADuC7024.H> /* ADuC7024 definitions */

void wait (void) { /* wait function */ unsigned long i; /* Delay var */

for (i = 0; i < 100000; ) { /* Delay for 10000 Counts */ i++; }
} void My_IRQ_Function(void);

int main (void) { T1LD = 0x20000; // Counter Value T1CON = 0xC4; // Enabled,Periodic,Binary and CLK/16 IRQ = My_IRQ_Function; // Specify Interrupt Service Rountine IRQEN = GP_TIMER_BIT; // Enable Timer1 IRQ

GP4DAT = 0x04000000; // P4.2 configured as an output. LED is turned on

while (1) { }
}

/********************************************************************/
/* */
/* Interrupt Service Rountine */
/* */
/********************************************************************/

void My_IRQ_Function()
{ if ((IRQSTA & GP_TIMER_BIT) != 0) // Timer1 IRQ? { GP4DAT ^= 0x00040000; // Complement P4.2 T1CLRI = 0; // Clear Timer IRQ } return ;
}

As shown above, the message error is:
.\Flash\Blinky.axf: Error: L6218E: Undefined symbol IRQ (referred from blinky.o).

Well, is there any command i need to enter into the startup code or anywhere else.
The interrupt handler also can't be called using the __irq method which i have tried few times. Therefore, i have found this interrupt method from the example they provided in the website and hoping someone would help me to solve this issue. Thanks a lot.
Please leave a message if you know about this.

Regards.

  • Sorry for the direct copy from the coding which makes a little bit of confusion. Here is the corrected version for better viewing purposes.

    #include <ADuC7024.H> /* ADuC7024 definitions */

    void wait (void)
    { /* wait function */ unsigned long i; /* Delay var */

    for (i = 0; i < 100000; )
    { /* Delay for 10000 Counts */ i++; }
    } void My_IRQ_Function(void);

    int main (void)
    { T1LD = 0x20000; // Counter Value T1CON = 0xC4; // Enabled,Periodic,Binary and CLK/16
    IRQ = My_IRQ_Function; // Specify Interrupt Service Rountine
    IRQEN = GP_TIMER_BIT; // Enable Timer1 IRQ

    GP4DAT = 0x04000000; // P4.2 configured as an output. LED is turned on

    while (1) {

    }
    }

    /********************************************************************/
    /* */
    /* Interrupt Service Rountine */
    /* */
    /********************************************************************/

    void My_IRQ_Function()
    { if ((IRQSTA & GP_TIMER_BIT) != 0) // Timer1 IRQ? { GP4DAT ^= 0x00040000; // Complement P4.2 T1CLRI = 0; // Clear Timer IRQ } return ;
    }

    As shown above, the message error is:
    .\Flash\Blinky.axf: Error: L6218E: Undefined symbol IRQ (referred from blinky.o).

    Please do comment if anything you can help. Thanks.

  • /*********************************************************************
    
     Author        : ADI - Apps            www.analog.com/MicroConverter
    
     Date          : Sept. 2005
    
     File          : TimerTrig1.c
    
     Hardware      : Applicable to ADuC702x rev H or I silicon
                     Currently targetting ADuC7026.
    
     Description   : Demonstrates Timer 1 causing an interrupt and complements
                                     P4.2 every 50ms.
    
    
    *********************************************************************/
    #include<ADuC7026.h>
    
    void My_IRQ_Function(void);
    
    int main (void)  {
    
            T1LD = 0x20000;                                         // Counter Value
            T1CON = 0xC4;                                           // Enabled,Periodic,Binary and CLK/16
            IRQ = My_IRQ_Function;                          // Specify Interrupt Service Rountine
            IRQEN = GP_TIMER_BIT;                           // Enable Timer1 IRQ
    
            GP4DAT = 0x04000000;                    // P4.2 configured as an output. LED is turned on
    
            while (1)
            {
            }
    }
    
    /********************************************************************/
    /*                                                                  */
    /*              Interrupt Service Rountine                                                                      */
    /*                                                                  */
    /********************************************************************/
    
    void My_IRQ_Function()
    {
            if ((IRQSTA & GP_TIMER_BIT) != 0)                   // Timer1 IRQ?
            {
                    GP4DAT ^= 0x00040000;                                   // Complement P4.2
                    T1CLRI = 0;                                                             // Clear Timer IRQ
            }
            return ;
    }
    
    
    
    
    
    
    
    
    

    The coding once again for proper viewing..

    The error message:

    .\Flash\Blinky.axf: Error: L6218E: Undefined symbol IRQ (referred from blinky.o).

  • IRQ = My_IRQ_Function;
    


    Is this really how you are expected to map an interrupt service routing with a device for your specific processor? What does the user manual/datasheet/application nodes/sample code show?

    Doesn't it have any support for vectorized interrupts, in which case an ISR can lookup which of multiple interrupt sources that needs processing?

    Unless this is a Cortex chip, you normally also needs a __irq keyword for an ISR (unless the assembler startup code takes care of all entry/exit handling and is happy with a standard C function)

  • That seems to be a perfectly reasonable & correct statement about your code:

    int main (void)  {
    
            T1LD  = 0x20000;                     // Counter Value
            T1CON = 0xC4;                        // Enabled,Periodic,Binary and CLK/16
            IRQ   = My_IRQ_Function;             // Specify Interrupt Service Rountine
            IRQEN = GP_TIMER_BIT;                // Enable Timer1 IRQ
    
            GP4DAT = 0x04000000;                 // P4.2 configured as an output. LED is turned on
    
            while (1)
            {
            }
    }
    

    You clearly make a reference to the symbol IRQ - on the left-hand side of an assignment, highlighted above - and you have shown no definition of that symbol!