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

IENABLE in realview

Hi,

When I used the IENABLE and IDISABLE routines in Keil CARM compiler it all worked fine. Now I'm using Keil realview and suddenly I get some strange errors when I compile my code.

error: #20: identifier "LR" is undefined
error: #20: identifier "SP" is undefined

I also tried some routines from NXP (see below). These compiled ok but I think something is missing in the routines because the program crashes when I use them for nesting interrupts.

Can someone tell me how to make these routines work in Realview?

Kind regards,
Sander

/* routines from KEIL */
#define IENABLE \
__asm { MRS LR, SPSR } \
__asm { STMFD SP!, {LR} } \
__asm { MSR CPSR_c, #0x1F } \
__asm { STMFD R15!, {LR} } \

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

/* routines from NXP */
static uint32 sysreg; /* used as LR register */
#define IENABLE __asm
{ MRS sysreg, SPSR; MSR CPSR_c, #SYS32Mode; STMFD SP!, {sysreg} }

#define IDISABLE __asm
{ MSR CPSR_c, #(IRQ32Mode|I_Bit); MSR SPSR_cxsf, sysreg }

0