27,520
社区成员
发帖
与我相关
我的任务
分享
Keil MDK ARM 7 新版本 产生错误
最近帮忙维护一个六年前的专案,ARM COMPILER V2.53, 配合 ARM7
当时的开发平台已经不在了,我从 Keil 下载最新的 MDK 4.6
旧的专案完全无法 COMPILER
看的懂的、能改的我已经改了,只剩下 NESTED_INTERRUPT, IENABLE, IDISABLE 这三个难题未解
请有经验的帮帮忙
一开始是 embedded asm 的指令不一样了
#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 }
#else
#define IDISABLE ; /* do nothing */
#endif
我修改成
#if NESTED_INTERRUPT
#define IENABLE \
__asm { MRS LR, SPSR \
STMFD SP!, {LR} \
MSR CPSR_c, #SYS32Mode \
STMFD SP!, {LR} }
#else
#define IENABLE ; /* do nothing */
#endif
#if NESTED_INTERRUPT
#define IDISABLE \
__asm { LDMFD SP!, {LR} \
// MSR CPSR_c, #(IRQ32Mode|I_Bit) \
MSR CPSR_c, #0x92 \
LDMFD SP!, {LR} \
MSR SPSR_cxsf, LR }
#else
#define IDISABLE ; /* do nothing */
#endif
irq.h 就没有产生错误,但是在每个中断程序中
void Timer0Handler(void) __irq
{
T0IR = 1; // clear interrupt flag
IENABLE; // handles nested interrupt
jiffy++; // update the jiffy timer
IDISABLE;
VICVectAddr = 0; // Acknowledge Interrupt
}
都有使用到 IENABLE IDISABLE 都产生类似的错误
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 ";"
不认识 LR / MSR # 等等指令
※ 中断内的 IENABLE IDISABLE 有什么用处?能不能拿掉?
NoInt EQU 0x80
NoFIQ EQU 0x40
IRQDisable
MRS R0, SPSR
ORR R0, R0, #NoInt
MSR SPSR_c, R0
MOVS PC, LR
IRQEnable
MRS R0, SPSR
BIC R0, R0, #NoInt
MSR SPSR_c, R0
MOVS PC, LR
FIQDisable
MRS R0, SPSR
ORR R0, R0, #NoFIQ
MSR SPSR_c, R0
MOVS PC, LR
FIQEnable
MRS R0, SPSR
BIC R0, R0, #NoFIQ
MSR SPSR_c, R0
MOVS PC, LR