Port uCosII4Skyeye to ADS
各位,偶因为想更容易跟踪ucos,把uCosII4Skyeye移植到ADS,之前也没什么经验。其中遇到一个问题,请各位帮忙解释一下:这是我原来从uCosII4Skyeye改的。
ARMDisableInt
MRS r0, cpsr
STMFD sp!, {r0} ;@ push current PSR
ORR r0, r0, #0x80
MSR cpsr_cf, r0 ;@ disable IRQ Int s
MOV pc, lr
; @------------------------------------------------------------------------
ARMEnableInt
LDMFD sp!, {r0} ;@ pop current PSR
MSR cpsr_cf, r0 ;@ restore original cpsr
MOV pc, lr
; @------------------------------------------------------------------------
如果这样的话:
OS_Sched()被编译成:
voidOS_Sched (void)
{
stmfd r13!,{r3,r14}
#if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
OS_CPU_SRcpu_sr;
#endif
INT8U y;
OS_ENTER_CRITICAL();
bl ARMDisableInt
if ((OSIntNesting == 0) && (OSLockNesting == 0)) { /* Sched. only if all ISRs done & not locked */
ldr r1,0x000018d0 ; = #0x28000088
ldrb r0,
ldrb r2,
orrs r0,r0,r2
bne 0x14a8; (OS_Sched + 0x68)
y = OSUnMapTbl; /* Get pointer to HPT ready to run */
ldrb r0,
ldr r3,0x000018fc ; = #0x00005b40
ldrb r0,
OSPrioHighRdy = (INT8U)((y << 3) + OSUnMapTbl]);
ldr r2,0x000018d4 ; = #0x28000092
ldrb r2,
ldrb r2,
add r0,r2,r0,lsl #3
and r0,r0,#0xff
strb r0,
if (OSPrioHighRdy != OSPrioCur) { /* No Ctx Sw if current task is highest rdy */
ldrb r2,
cmp r0,r2
beq 0x14a8; (OS_Sched + 0x68)
OSTCBHighRdy = OSTCBPrioTbl;
ldr r2,0x000018d8 ; = #0x28001134
ldr r0,
str r0,
OSCtxSwCtr++; /* Increment context switch counter */
ldr r0,
add r0,r0,#1
str r0,
OS_TASK_SW(); /* Perform a context switch */
bl OSCtxSw
}
}
OS_EXIT_CRITICAL();
ldmfd r13!,{r3,r14}
b ARMEnableInt
}
最后的两句汇编很奇怪,怎么b ARMEnableInt在ldmfd后面,这样从stack取数据都乱了。晕。。。
是和ARMEnableInt的写法有关吗?我把它们改成inline asm在函数中就好的。
我的修改在http://bugboy.yculblog.com/post.4076240903.html可以找到. 谢谢 8O
页:
[1]