Yahoo Groups archive

Lpc2000

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

Message

Re: [lpc2000] {To TomW} GCC-Bug in IRQs

2006-03-25 by Sten

David Hawkins wrote:
>>I'm thinking of writing a generic IRQ handler instead of a 
>>direct branch to VIC-vector register from vector table, 
> 
> 
> You mean something like this ....
> 
> irq_isr:
>      /* Save IRQ context, including the APCS registers, and r4-6 */
>      sub   lr, lr, #4
>      stmfd sp!, {r0-r6, ip, lr}
> 
>      /* Save the SPSR_irq register */
>      mrs r4, spsr
> 
>      /* Read the VICVectAddr */
>      ldr r5, VICVECTADDR
>      ldr r6, [r5]
> 
>      /* Change to SYS mode and enable IRQ */
>      msr cpsr_c, #SYS_MODE
> 
>      /* Debug:
>       * Comment out the change to system mode with IRQs enabled
>       * and uncomment the following to leave IRQs disabled. IRQs
>       * are then handled non-nested (with more overhead than normal)
>       */
> /*    msr cpsr_c, #SYS_MODE|IRQ_DISABLE*/
> 
>      /* Save the banked SYS mode link register */
>      stmfd sp!, {lr}
> 
>      /* Call the C-coded handler */
>      mov lr, pc
>      mov pc, r6
> 
>      /* Restore SYS mode link register */
>      ldmfd sp!, {lr}
> 
>      /* Change to IRQ mode and disable IRQ */
>      msr cpsr_c, #IRQ_MODE|IRQ_DISABLE
> 
>      /* Restore the SPSR */
>      msr spsr, r4
> 
>      /* Acknowledge the VIC */
>      mov r0, #0
>      str r0, [r5]
> 
>      /* Restore IRQ context and return from interrupt */
>      ldmfd sp!, {r0-r6, ip, pc}^
> 
> VICVECTADDR:     .word   0xFFFFF030
> 

YES, something like that! ;-) But without nesting and change of cpu-mode.

  Sten

-- 
/************************************************
 Do you need a tiny and efficient real time
 operating system (RTOS) with a preemtive
 multitasking for LPC2000 or AT91SAM7?

   http://nanortos.net-attack.de/

 Or some open-source tools and code for LPC2000?

   http://www.net-attack.de/

************************************************/

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.