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 AND IDISABLE CODE NOT COMPILING

Hi,

I have used following macros for IENABLE and IDISABLE

#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 */

I am using Keil uvision v5 evaluation version
When I compile the program with these macros I get following error messages:-
1)timer_delay.c(28): error: #20: identifier "SP" is undefined
2)timer_delay.c(28): error: #20: identifier "LR" is undefined

Please guide me in this regard as I need to resolve this issue as early as possible.
I think this problem is of including assembly language in C but for SP and LR registers it is giving error as stated.

Thank you in advance.