hi, Am using LPC2366.From the keil sample software i took two macros IENABLE and IDISABLE and their definitions,used in ISR routine as in sample code.But my software hangs at PAbt_Addr DCD PAbt_Handler.what is the reason?
keshan, Can you please post relevant code?
// Macro for enabling interrupts, moving to System mode and relevant stack operations #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 */ \ // Macro for disabling interrupts, switching back to IRQ and relevant stack operations #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 got the following error.Can u suggest whats the problem?? compiling irq2366.c... ..\Src\LowLevel\irq2366.c(250): error: #20: identifier "LR" is undefined ..\Src\LowLevel\irq2366.c(250): error: #20: identifier "SP" is undefined ..\Src\LowLevel\irq2366.c(250): error: #20: identifier "LR" is undefined ..\Src\LowLevel\irq2366.c(250): warning: #1287-D: LDM/STM instruction may be expanded ..\Src\LowLevel\irq2366.c(250): error: #20: identifier "SP" is undefined ..\Src\LowLevel\irq2366.c(250): error: #20: identifier "LR" is undefined
Thanks in Advance.
Haven't you asserted that
my software hangs at PAbt_Addr DCD PAbt_Handler ?
sorry for previous one .
#define I_Bit 0x80 #define F_Bit 0x40 #define SYS32Mode 0x1F #define IRQ32Mode 0x12 #define FIQ32Mode 0x11 static DWORD sysreg; /* used as LR register */ //#define IENABLE __asm { MRS sysreg, SPSR; MSR CPSR_c, #SYS32Mode } //#define IDISABLE __asm { MSR CPSR_c, #(IRQ32Mode|I_Bit); MSR SPSR_cxsf, sysreg }
the above results in hanging.
sorry for previous one
#define I_Bit 0x80 #define F_Bit 0x40 #define SYS32Mode 0x1F #define IRQ32Mode 0x12 #define FIQ32Mode 0x11 static DWORD sysreg; /* used as LR register */ #define IENABLE __asm { MRS sysreg, SPSR; MSR CPSR_c, #SYS32Mode } #define IDISABLE __asm { MSR CPSR_c, #(IRQ32Mode|I_Bit); MSR SPSR_cxsf, sysreg }
this results in hanging
View all questions in Keil forum