extern void ARMEnableInt(void); // enable global interrupts
extern void ARMDisableInt(void); // disable global interrupts
在os_cpu_a.s中有以下定义:
EXPORT ARMDisableInt
ARMDisableInt
MRS r0, cpsr
STMFD sp!, {r0} ; push current PSR
ORR r0, r0, #0xC0
MSR cpsr_c, r0 ; disable IRQ Int s
MOV pc, lr
EXPORT ARMEnableInt
ARMEnableInt
LDMFD sp!, {r0} ; pop current PSR
MSR cpsr_c, r0 ; restore original cpsr
MOV pc, lr
编译一切正常,没有报错,但运行不了系统,我进行单步跟踪后发现问题出在这里:
os_core.c中有函数:
#if OS_SCHED_LOCK_EN > 0
void OSSchedLock (void)
{
#if OS_CRITICAL_METHOD == 3 /* 在OS_CPU.H中宏定义为OS_CRITICAL_METHOD=2*/
OS_CPU_SR cpu_sr;
cpu_sr = 0; /* Prevent compiler */
#endif
if (OSRunning == TRUE) { /* Make sure multitasking is */
OS_ENTER_CRITICAL();
if (OSLockNesting < 255u) { /* Prevent OSLockNesting from wrapping back to 0 */
OSLockNesting++; /* Increment lock nesting */
}
OS_EXIT_CRITICAL();
}
}
#endif