I am maintaining a project which is worked with ARM COMPILER V2.53 and is finished six years ago .
The development platform is lost, I try to build and download the latest Keil MDK 4.6.
There is a big problem with interrupt. void Timer0Handler(void) __irq { T0IR = 1; // clear interrupt flag
IENABLE; // handles nested interrupt
jiffy++; // update the jiffy timer
IDISABLE;
VICVectAddr = 0; // Acknowledge Interrupt } ALL ISR ( timer0,timer1, i2c,...) have IENABLE and IDISABLE.
These embedded asm marco is in irq.h #if NESTED_INTERRUPT
#define IENABLE __asm { MRS LR, SPSR } \
__asm { STMFD SP!, {LR} } \
__asm { MSR CPSR_c, #SYS32Mode } \
__asm { STMFD SP!, {LR} }
#else
#define IENABLE ; /* do nothing */
#endif
#if NESTED_INTERRUPT
#define IDISABLE __asm { LDMFD SP!, {LR} } \
__asm { MSR CPSR_c, #(IRQ32Mode|I_Bit) } \
__asm { LDMFD SP!, {LR} } \
__asm { MSR SPSR_cxsf, LR }
#define IDISABLE ; /* do nothing */
The compiler generate error , like this src\Timer.c(30): error: #20: identifier "LR" is undefined src\Timer.c(30): error: #268: declaration may not appear after executable statement in block src\Timer.c(30): error: #20: identifier "MSR" is undefined src\Timer.c(30): error: #10: "#" not expected here src\Timer.c(30): error: #40: expected an identifier src\Timer.c(30): error: #40: expected an identifier src\Timer.c(30): error: #65: expected a ";"
Can anybody give me a hand? How to modify the soruce code?
Did you try to google for "keil nested interrupts" and then looked at the following link? http://www.keil.com/support/docs/3353.htm
It is more a problem with usage of assembly instructions in an inline assembly construct. Make the macros functions prepended by "__asm".