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

Does anyone have a nested interrupt example using armcc..

The RealView Compiler that Keil is now pushing is the armcc compiler.

I have been using CARM which is now considered a "legacy" compiler. I have been trying to port Keil's nested interrupt example which works with CARM to the RealView compiler with no luck.
Here is an example of what Keil says to do with CARM.

You may nest interrupts by using the macros IENABLE and IDISABLE at beginning and end of an interrupt service routine.

#define IENABLE /* Nested Interrupts Entry */ \
__asm { MRS LR, SPSR } /* Copy SPSR_irq to LR */ \
__asm { STMFD SP!, {LR} } /* Save SPSR_irq */ \
__asm { MSR CPSR_c, #0x1F } /* Enable IRQ (Sys Mode) */ \
__asm { STMFD SP!, {LR} } /* Save LR */ \

#define IDISABLE /* Nested Interrupts Exit */ \
__asm { LDMFD SP!, {LR} } /* Restore LR */ \
__asm { MSR CPSR_c, #0x92 } /* Disable IRQ (IRQ Mode) */ \
__asm { LDMFD SP!, {LR} } /* Restore SPSR_irq to LR */ \
__asm { MSR SPSR_cxsf, LR } /* Copy LR to SPSR_irq */ \

The usage is as shown below:

void interrupt_srv (void) __irq {
IENABLE; // allow nested interrupts
... // interrupt code
IDISABLE; // disable interrupt nesting
}

Depending on interrupt controller, it might be required to clear the interrupt source and acknowledge the interrupt. So in reality an implementation might look like the following example:

/* External Interrupt 1 Service */
void eint1_srv (void) __irq {
EXTINT = 2; // Clear EINT1 interrupt flag
IENABLE; // allow nested interrupts
delay ();
++intrp_count; // increment interrupt count
IDISABLE; // disable interrupt nesting
VICVectAddr = 0; // Acknowledge Interrupt
}

I have tried many different ways to get the above code to work, but I have had no luck. I am sure I am just missing something in the documentation somewhere.

Does anyone have example code of how they nest interrupts using the RealView Compiler.

Thanks.

0