Replace your irq handler with the following code.
This example uses VIC. I hope you can figure out how to program the
VIC. Do NOT use the gnu "interrupt" keyword in your C function. You
also need to program the VIC address registers with the appropriate C
function handler addresses.
irq_handler:
/* save return address and work regs on stack */
/* save r0-r4,lr,r12 on stack remaining regs */
/* are saved by the c function if used */
stmfd sp!, { r0-r3,r12,lr }
/* use r1 to save spsr_irq */
mrs r1, spsr
/* save r1 again as per ATPCS r0-r4 & r12 are not saved */
/* by the called function */
stmfd sp!,{r1}
/* setup link register so that the normal c function */
/* which is used as an isr returns to ldmfd sp!,{r1} instruction */
add lr,pc,#0x4
/* Read the ISR address from the VIC */
ldr r0, =0xfffff030
ldr pc,[r0]
/* Restore spsr_irq */
ldmfd sp!,{r1}
msr spsr_cxsf, r1
/* Restore remaining registers
ldmfd sp!, { r0-r3,r12,lr }
/* Resume interrupted execution flow */
subs pc, lr, #0x4Message
Re: Interrupt works in Keil simulator but not in target
2003-12-11 by lpc2100
Attachments
- No local attachments were found for this message.