Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: Interrupts trouble...

2004-08-11 by Randy Ott

Yann,

Unless you supply an irq_handler, the default weak symbol will be 
linked and the interrupt will branch to an infinite loop.  I use a 
handler in C that looks like this:
==================================
__irq __arm void irq_handler(void)
{
  void (*interrupt_function)();
  unsigned int vector;

  vector = VICVectAddr;   // Get interrupt vector.
  interrupt_function = (void(*)())vector;
  (*interrupt_function)();  // Call vectored interrupt function.

  VICVectAddr = 0;        // Clear interrupt in VIC.
}
==================================
I don't know how the __irq and __arm attributes are declared in 
Crossworks.  If it is GNU then I believe you need to change the 
function declaration to:

irq_handler(void) __attribute__ ((interrupt ("IRQ")))

Hope this helps.

Randy Ott



--- In lpc2000@yahoogroups.com, "nourson54" <yannsuisini@h...> wrote:
> Hi,
> 
> I'm trying to play with interrupts with Crossworks but I can't get 
it
> working , even with the samples code (timer0 interrupt) .
> I debug with Olimex JTAG .
> I put a breakpoint on my interrupt ISR but it never breaks on it 
> but in the startup code :
> 
> "/*****************************************************
>  
*                                                                   
>         *
>  * Default exception 
handlers                                        
>         *
>  * These are declared weak symbols so they can be redefined in user
> code.     * 
>  
*                                                                   
>         *
>  *****************************************************/
> 
> undef_handler:
>   b undef_handler
>   
> swi_handler:
>   b swi_handler
>   
> pabort_handler:
>   b pabort_handler
>   
> dabort_handler:
>   b dabort_handler
>   
> irq_handler:
>   b irq_handler      <-----------------------  BREAKS HERE 
>   
> fiq_handler:
>   b fiq_handler
> 
>   .weak undef_handler, swi_handler, pabort_handler, dabort_handler,
> irq_handler, fiq_handler
> 
> 
> 
> Could someone help me ? 
> 
> thx
> 
> Yann
> 
> 
> PS: I'm a newbie in ARM world ;-) So excuse me if it seems a 
trivial
> question :-P

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.