LPC2388: Cannot return to main after RTC interrupt

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by m2babaey on Mon Jul 15 23:28:25 MST 2013
I have activated RTC Alarm interrupt in LPC2388 but after entering the first interrupt, it doesn't exit from the interrupt. I used Jlink to watch where is code is going and noticed after finishing interrupt code, the program remain at this line of start up code:

                IMPORT  __main
                LDR     R0, =__main
                BX      R0

So it seems it cannot return to main

__irq void RTC_IRQHandler(void)
RTC_AMR = 255;                  // disable alarm interrupt, will be reEnabled in code
RTC_ILR = (1UL<<1);             // Clear RTC alarm interrupt flag /
VICVectAddr = 0;                // Acknowledge Interrupt /

int main(void)
  basic coonfiguration

  //init RTC

  RTC_CCR=0x21;  use 32k crystal

  RTC_AMR &= ~(0x6) ;
  RTC_AMR |= ~(0x6) ;  //only hour and minute are important for alarm interrupt

  VICVectAddr13 = (unsigned long) RTC_IRQHandler;           // set interrupt vector 13
  VICVectPriority13 = 15 ;
  VICIntEnable |= (1UL<<13);                                // Enable RTC Interrupt

   //rest of my code

Could you please help me where I am wrong?