本帖最后由 李富贵 于 2011-11-6 15:10 编辑  
 
这个移植有问题,os_core.c里面OSIntExit ()和OSSched()两个函数中: 
-  
 
 - if (OSRunning == OS_TRUE) {
 
 - OS_ENTER_CRITICAL();
 
 - if (OSIntNesting > 0) { /* Prevent OSIntNesting from wrapping */
 
 - OSIntNesting--;
 
 - }
 
 - if (OSIntNesting == 0) { /* Reschedule only if all ISRs complete ... */
 
 - if (OSLockNesting == 0) { /* ... and not locked. */
 
 - OS_SchedNew();
 
 - if (OSPrioHighRdy != OSPrioCur) { /* No Ctx Sw if current task is highest rdy */
 
 - OSTCBHighRdy = OSTCBPrioTbl[OSPrioHighRdy];
 
 - #if OS_TASK_PROFILE_EN > 0
 
 - OSTCBHighRdy->OSTCBCtxSwCtr++; /* Inc. # of context switches to this task */
 
 - #endif
 
 - OSCtxSwCtr++; /* Keep track of the number of ctx switches */
 
 - OSIntCtxSw(); /* Perform interrupt level ctx switch */
 
 - }
 
 - }
 
 - }
 
 - OS_EXIT_CRITICAL();
 
 - }
 
 
  
应该改为: 
-  
 
 -     OS_ENTER_CRITICAL();
 
 -     if (OSIntNesting == 0u) {                          /* Schedule only if all ISRs done and ...       */
 
 -         if (OSLockNesting == 0u) {                     /* ... scheduler is not locked                  */
 
 -             OS_SchedNew();
 
 -             OSTCBHighRdy = OSTCBPrioTbl[OSPrioHighRdy];
 
 -             if (OSPrioHighRdy != OSPrioCur) {          /* No Ctx Sw if current task is highest rdy     */
 
 - #if OS_TASK_PROFILE_EN > 0u
 
 -                 OSTCBHighRdy->OSTCBCtxSwCtr++;         /* Inc. # of context switches to this task      */
 
 - #endif
 
 -                 OSCtxSwCtr++;                          /* Increment context switch counter             */
 
 -                 OS_TASK_SW();                          /* Perform a context switch                     */
 
 -             }
 
 -         }
 
 -     }
 
 -     OS_EXIT_CRITICAL();
 
 
  
 
  |