|
各位,偶因为想更容易跟踪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()被编译成:
void OS_Sched (void)
{
[0xe92d4008] stmfd r13!,{r3,r14}
#if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
OS_CPU_SR cpu_sr;
#endif
INT8U y;
OS_ENTER_CRITICAL();
[0xeb000fa7] bl ARMDisableInt
if ((OSIntNesting == 0) && (OSLockNesting == 0)) { /* Sched. only if all ISRs done & not locked */
[0xe59f1480] ldr r1,0x000018d0 ; = #0x28000088
[0xe5d10002] ldrb r0,[r1,#2]
[0xe5d12004] ldrb r2,[r1,#4]
[0xe1900002] orrs r0,r0,r2
[0x1a000012] bne 0x14a8 ; (OS_Sched + 0x6
y = OSUnMapTbl[OSRdyGrp]; /* Get pointer to HPT ready to run */
[0xe5d10007] ldrb r0,[r1,#7]
[0xe59f3494] ldr r3,0x000018fc ; = #0x00005b40
[0xe7d30000] ldrb r0,[r3,r0]
OSPrioHighRdy = (INT8U)((y << 3) + OSUnMapTbl[OSRdyTbl[y]]);
[0xe59f2464] ldr r2,0x000018d4 ; = #0x28000092
[0xe7d22000] ldrb r2,[r2,r0]
[0xe7d32002] ldrb r2,[r3,r2]
[0xe0820180] add r0,r2,r0,lsl #3
[0xe20000ff] and r0,r0,#0xff
[0xe5c10006] strb r0,[r1,#6]
if (OSPrioHighRdy != OSPrioCur) { /* No Ctx Sw if current task is highest rdy */
[0xe5d12005] ldrb r2,[r1,#5]
[0xe1500002] cmp r0,r2
[0x0a000006] beq 0x14a8 ; (OS_Sched + 0x6
OSTCBHighRdy = OSTCBPrioTbl[OSPrioHighRdy];
[0xe59f2444] ldr r2,0x000018d8 ; = #0x28001134
[0xe7920100] ldr r0,[r2,r0,lsl #2]
[0xe5810028] str r0,[r1,#0x28]
OSCtxSwCtr++; /* Increment context switch counter */
[0xe591000c] ldr r0,[r1,#0xc]
[0xe2800001] add r0,r0,#1
[0xe581000c] str r0,[r1,#0xc]
OS_TASK_SW(); /* Perform a context switch */
[0xeb000f51] bl OSCtxSw
}
}
OS_EXIT_CRITICAL();
[0xe8bd4008] ldmfd r13!,{r3,r14}
[0xea000f92] b ARMEnableInt
}
最后的两句汇编很奇怪,怎么b ARMEnableInt在ldmfd后面,这样从stack取数据都乱了。晕。。。
是和ARMEnableInt的写法有关吗?我把它们改成inline asm在函数中就好的。
我的修改在http://bugboy.yculblog.com/post.4076240903.html可以找到. 谢谢 |
|