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

Nested Interrupts with RealView

Dear People who migrate from legacy Keil Tools to ARM RealView:

I am interested to use the Nested Interrupt in Software in a simple way shown in Examples.
But in RealView I am not able to use Inline Assembly with Access to some Registers:

Macros for GCC and legacy Keil Tools:

// Macros for Interrupt Nesting
#define IENABLE
__asm { MRS LR, SPSR }
__asm { STMFD SP!, {LR} }
__asm { MSR CPSR_c, #0x1F }
__asm { STMFD SP!, {LR} }

#define IDISABLE
__asm { LDMFD SP!, {LR} }
__asm { MSR CPSR_c, #0x92 }
__asm { LDMFD SP!, {LR} }
__asm { MSR SPSR_cxsf, LR }

In current RealView Tools it is not possible to access the Registers SP, LR, PSR via Inline Assembly with Assembler Macros. Instead of the Macros, I developed the following Assembler Functions for Embedded Assembler:

nested_irq_enable:
STMFD SP!, {R0}
MOV R0, LR
MRS LR, SPSR
STMFD SP!, {LR}
MSR CPSR_c, #0x1F
STMFD SP!, {LR}
BX R0

nested_irq_disable:
MOV R0, LR
LDMFD SP!, {LR}
MSR CPSR_c, #0x92
LDMFD SP!, {LR}
MSR SPSR_cxsf, LR
MOV LR, R0
LDMFD SP!, {R0}
BX LR

The Runtime of these Instructions is a little bit longer as the Macros.
Also, the Stack is affected by a Register Saving of R0.

I have tested a simple configuration, a Timer Interrupt is breaking an external Interrupt, it works very well.

Should I be concerned on it?

Is there anybody who has an Idea to make this better?

Greetings

Dietmar Wengler