⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bug_fixes.htm

📁 uCosII原装光盘,包括uCosII源代码和uCos移植到各种常见处理器的代码.
💻 HTM
📖 第 1 页 / 共 2 页
字号:
  <param name="bgcolor" value="#FFFFFF">
  <param name="effect" value="glow">
  <param name="text" value="Y2K Statement">
  <param name="font" value="Helvetica">
  <param name="fontstyle" value="bold">
  <param name="fontsize" value="14">
  <param name="url" valuetype="ref" value="y2k.htm">
</applet>
</p>
<p align="center">
&nbsp;
</p>
<p align="center">
<applet codebase="index.htm" tppabs="http://www.ucos-ii.com/" code="fphover.class" tppabs="http://www.ucos-ii.com/fphover.class" width="200" height="24">
  <param name="color" value="#000080">
  <param name="hovercolor" value="#0000FF">
  <param name="textcolor" value="#FFFFFF">
  <param name="effect" value="glow">
  <param name="fontstyle" value="bold">
  <param name="fontsize" value="14">
  <param name="font" value="Helvetica">
  <param name="bgcolor" value="#FFFFFF">
  <param name="text" value="Picture Gallery">
  <param name="url" valuetype="ref" value="gallery.htm">
</applet>
</p>
</td><td valign="top" width="24"></td><!--msnavigation--><td valign="top"><p align="center"><font size="6" color="#000000"><strong><br>
Bug Fixes / Improvements</strong></font></p>

<p align="left">Below is a list of known bugs in the latest version of 礐/OS-II
(V2.51) as well as the correction(s) <b>or</b>, improvements that can be made to
<b>V2.51</b>.</p>

<table border="1" width="100%">
  <tr>
    <td width="200%" bgcolor="#C0C0C0"><p align="left"><img border="0" src="bugmove.gif" tppabs="http://www.ucos-ii.com/images/bugmove.gif" width="60" height="47"><strong><font size="5">uCOS_II.H
      (V2.51-001):</font></strong></td>
  </tr>
</table>

<p>The function prototype for <font face="Courier New" size="2">OSSchedLock()</font>
was changed by mistake to <font face="Courier New" size="2">OS_SchedLock()</font>.&nbsp;&nbsp;
Simply REMOVE the underscore since the <b>CORRECT</b> name is <font face="Courier New" size="2">OSSchedLock()</font>.</p>
<p>&nbsp;</p>

<table border="1" width="100%">
  <tr>
    <td width="200%" bgcolor="#C0C0C0"><p align="left"><img border="0" src="bugmove.gif" tppabs="http://www.ucos-ii.com/images/bugmove.gif" width="60" height="47"><strong><font size="5">OS_CPU_A.ASM
      (V2.05-001):<br>
      </font><font size="5">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      </font><font size="3">(For both Ix86L and Ix86L-FP)</font></strong></td>
  </tr>
</table>

<p>The <i>NEW</i> ISRs MUST check to see <font face="Courier New" size="2">if
OSIntNesting == 1</font> <i>BEFORE</i> you save the <font face="Courier New" size="2">SP</font>
in the current task's <font face="Courier New" size="2">OS_TCB</font>.&nbsp; The
incorrect 'pseudo' code is:</p>
<p><font face="Courier New" size="2">&nbsp;&nbsp; OSTCBCur-&gt;OSTCBStkPtr =
SP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* Save SP onto current
task's stack                   */<br>
</font><br>
&nbsp;&nbsp;&nbsp; <font color="#FF0000"><b>and should be:</b></font></p>
<p><font face="Courier New" size="2">&nbsp;&nbsp; if (OSIntNesting == 1) {<br>
</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font face="Courier New" size="2">OSTCBCur-&gt;OSTCBStkPtr
= SP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* Save SP onto current task's stack                   */<br>
&nbsp;&nbsp; }</font>
</p>

<p>The reason we need this change is that we don't want to save the current
value of <font face="Courier New" size="2">SP</font> if the ISR is for a nested
ISR!</p>

<p align="left"><b>IMPORTANT</b>: If you have the release notes version <b>V2.05a</b>
then you have the CORRECT code.</p>

<hr>

<p align="left"><br>
Below is a list of known bugs in the latest version of 礐/OS-II
(V2.04) as well as the correction(s) <b>or</b>, improvements that can be made to
<b>V2.04</b>.</p>

<table border="1" width="100%">
  <tr>
    <td width="200%" bgcolor="#C0C0C0"><p align="left"><img border="0" src="bugmove.gif" tppabs="http://www.ucos-ii.com/images/bugmove.gif" width="60" height="47"><font size="5"><strong>OS_CORE.C
      (V2.04-001):</strong></font></td>
  </tr>
</table>

<p>The wrong argument is being passed to the call to <font face="Courier New" size="2">OSTaskCreateHook()</font>
in <font face="Courier New" size="2">OSTCBInit()</font>.&nbsp; The BAD code is:</p>
<p><font face="Courier New" size="2">OSTaskCreateHook(<b>OSTCBPrioTbl[prio]</b>);                            /* Call user defined hook                   */<br>
</font><br>
&nbsp;&nbsp;&nbsp; <font color="#FF0000"><b>and should be:</b></font></p>
<p><font face="Courier New" size="2">OSTaskCreateHook(<b>ptcb</b>);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
/* Call user defined hook                   */</font><br>
</p>

<table border="1" width="100%">
  <tr>
    <td width="200%" bgcolor="#C0C0C0"><p align="left"><img border="0" src="bugmove.gif" tppabs="http://www.ucos-ii.com/images/bugmove.gif" width="64" height="50"><strong><font size="5">OS_MUTEX.C
      (V2.04-002):</font></strong></td>
  </tr>
</table>

<p>The test in <font face="Courier New" size="2">OSMutexPost()</font> to see if
the posting task owns the MUTEX is incorrect.&nbsp; The correct test needs to
have <b><font face="Courier New" color="#FF0000" size="4">&amp;&amp;</font></b>
instead of <b><font face="Courier New" color="#FF0000" size="4">||</font></b> as
follows:</p>
<p><font face="Courier New" size="2">    if (OSTCBCur->OSTCBPrio != pip </font><b><font face="Courier New" size="4" color="#FF0000"> &amp;&amp;</font></b><font face="Courier New" size="2"><br>
&nbsp;&nbsp;&nbsp; OSTCBCur-&gt;OSTCBPrio != prio) {                /* See if posting task owns the MUTEX            */<br>
&nbsp;&nbsp;&nbsp; OS_EXIT_CRITICAL();<br>
&nbsp;&nbsp;&nbsp; return (OS_ERR_NOT_MUTEX_OWNER);<br>
    }</font><br>
</p>

<table border="1" width="100%">
  <tr>
    <td width="200%" bgcolor="#C0C0C0"><p align="left"><img border="0" src="bugmove.gif" tppabs="http://www.ucos-ii.com/images/bugmove.gif" width="64" height="50"><strong><font size="5">OS_MUTEX.C
      (V2.04-003):</font></strong></td>
  </tr>
</table>

<p>The function <font face="Courier New" size="2">OSMutexDel()</font>  needs to
release the priority of the PIP.&nbsp; The correct code for <font face="Courier New" size="2">OSMutexDel()</font>
can be downloaded from: <a href="os_mutex_del.c" tppabs="http://www.ucos-ii.com/files/os_mutex_del.c"><b>Download new <font face="Courier New">OSMutexDel()</font></b></a>.</p>
<p>&nbsp;
</p>

<table border="1" width="100%">
  <tr>
    <td width="200%" bgcolor="#C0C0C0"><p align="left"><img border="0" src="bugmove.gif" tppabs="http://www.ucos-ii.com/images/bugmove.gif" width="64" height="50"><strong><font size="5">uCOS_II.H
      (V2.04-004):</font></strong></td>
  </tr>
</table>

<p>The function <font face="Courier New" size="2">OSMutexDel()</font>  needs to
be added in the prototype list for MUTEXes as follows:</p>
<p><font face="Courier New" size="2">#if OS_MUTEX_EN<br>
INT8U&nbsp;&nbsp;&nbsp;&nbsp; OSMutexAccept(OS_EVENT *pevent, INT8U *err);<br>
OS_EVENT   *OSMutexCreate(INT8U prio, INT8U *err);<br>
<font color="#FF0000"><b>OS_EVENT   *OSMutexDel (OS_EVENT *pevent, INT8U opt, INT8U *err);<br>
</b></font>void&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OSMutexPend(OS_EVENT *pevent, INT16U timeout, INT8U *err);<br>
INT8U&nbsp;&nbsp;&nbsp;&nbsp; OSMutexPost(OS_EVENT *pevent);<br>
INT8U&nbsp;&nbsp;&nbsp;&nbsp; OSMutexQuery(OS_EVENT *pevent, OS_MUTEX_DATA *pdata);<br>
#endif<br>
</font></p>

<table border="1" width="100%">
  <tr>
    <td width="100%" bgcolor="#C0C0C0"><p align="left"><strong><font size="5">OS_CPU_A.ASM
      and ISRs:</font></strong></td>
  </tr>
</table>

<p>As you probably know, 礐/OS-II has a function
that is dependent on compiler options (<font face="Courier New" size="2">OSIntCtxSw()</font>)
and, the port designer <font color="#FF0000"><b> HAS</b></font> to adjust the Stack Pointer based on the code
generation of the compiler.</p>
<p>On certain processors (e.g. 80x86) you can simply
write ISRs so that you <b>save</b> the Stack Pointer (<font face="Courier New" size="2">SS:SP</font>
for the 80x86) into the current task's <font face="Courier New" size="2">OS_TCB</font>
<b>
after</b> incrementing <font face="Courier New" size="2">OSIntNesting</font>.&nbsp; This way,
we save the proper pointer to the ISR stack frame in case we don't actually
return to the interrupted task.&nbsp; If we DO return to the interrupted task
then, there is no harm and all we did was waste a little bit of CPU time!&nbsp;
Of course, we <b> eliminate</b> the code at the beginning of <font face="Courier New" size="2">OSIntCtxSw()</font>
to adjust the Stack Pointer (<font face="Courier New" size="2">SP</font> for the 80x86)
and the code to save the Stack Pointer into the <font face="Courier New" size="2">OS_TCB</font>!</p>
<p>The new pseudo code for an ISR and <font face="Courier New" size="2">OSIntCtxSw()</font>
is now:</p>
<p><font face="Courier New" size="2">MyISR:<br>
&nbsp;&nbsp;&nbsp; Save ALL registers;<br>
&nbsp;&nbsp;&nbsp; OSIntNesting++;<br>
</font><font face="Courier New">&nbsp;&nbsp; <font SIZE="2">OSTCBCur-&gt;OSTCBStkPtr
= SP;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp; &lt;&lt;&lt;&lt; NEW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
*/<br>
</font> </font><font face="Courier New" size="2">&nbsp;&nbsp;&nbsp; /* Handle ISR
*/<br>
&nbsp;&nbsp;&nbsp; OSIntExit();<br>
&nbsp;&nbsp;&nbsp; Restore ALL registers;<br>
&nbsp;&nbsp;&nbsp; Return from Interrupt;</font></p>
<p><font face="Courier New" size="2">OSIntCtxSw:<br>
&nbsp;&nbsp;&nbsp; OSTaskSwHook();<br>
&nbsp;&nbsp;&nbsp; OSTCBCur = OSTCBHighRdy;<br>
&nbsp;&nbsp;&nbsp; SP = OSTCBHighRdy-&gt;OSTCBStkPtr;<br>
&nbsp;&nbsp;&nbsp; Restore ALL registers;<br>
&nbsp;&nbsp;&nbsp; Return from Interrupt;</font></p>
<p>In assembly language for the 80x86 (Large model),
this becomes:</p>
<font SIZE="2">
<p><font face="Courier New">_MyISR PROC FAR<br>
;<br>
&nbsp;&nbsp;&nbsp; PUSHA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
; Save interrupted task's context<br>
&nbsp;&nbsp;&nbsp; PUSH ES<br>
&nbsp;&nbsp;&nbsp; PUSH DS<br>
;<br>
&nbsp;&nbsp;&nbsp; MOV AX, SEG(_OSIntNesting)&nbsp;&nbsp;&nbsp;&nbsp; ; Reload
DS<br>
&nbsp;&nbsp;&nbsp; MOV DS, AX<br>
&nbsp;&nbsp;&nbsp; INC BYTE PTR _OSIntNesting&nbsp;&nbsp;&nbsp;&nbsp; ; Notify
uC/OS-II of ISR<br>
;<br>
&nbsp;&nbsp;&nbsp; LES BX, DWORD PTR DS:_OSTCBCur ; OSTCBCur-&gt;OSTCBStkPtr =
SS:SP<br>
&nbsp;&nbsp;&nbsp; MOV ES:[BX+2], SS<br>
&nbsp;&nbsp;&nbsp; MOV ES:[BX+0], SP<br>
&nbsp;&nbsp;&nbsp; CALL FAR PTR _MyISRHandler&nbsp;&nbsp;&nbsp;&nbsp; ; Process
the Interrupt<br>
;<br>
&nbsp;&nbsp;&nbsp; CALL FAR PTR _OSIntExit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
; Notify uC/OS-II of end of ISR<br>
;<br>
&nbsp;&nbsp;&nbsp; POP
DS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
; Restore interrupted task's context<br>
&nbsp;&nbsp;&nbsp; POP ES<br>
&nbsp;&nbsp;&nbsp; POPA<br>
;<br>
&nbsp;&nbsp;&nbsp; IRET&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
; Return to interrupted task<br>
;<br>
_MyISR ENDP</font></p>
<p>&nbsp;</p>
<p><font face="Courier New" size="2">_OSIntCtxSw PROC FAR<br>
;<br>
&nbsp;&nbsp;&nbsp; CALL FAR PTR _OSTaskSwHook&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;
Call user defined task switch hook<br>
;<br>
&nbsp;&nbsp;&nbsp; MOV AX, WORD PTR DS:_OSTCBHighRdy+2 ; OSTCBCur = OSTCBHighRdy<br>
&nbsp;&nbsp;&nbsp; MOV DX, WORD PTR DS:_OSTCBHighRdy <br>
&nbsp;&nbsp;&nbsp; MOV WORD PTR DS:_OSTCBCur+2, AX<br>
&nbsp;&nbsp;&nbsp; MOV WORD PTR DS:_OSTCBCur, DX <br>
;<br>
&nbsp;&nbsp;&nbsp; MOV AL, BYTE PTR DS:_OSPrioHighRdy ; OSPrioCur =
OSPrioHighRdy<br>
&nbsp;&nbsp;&nbsp; MOV BYTE PTR DS:_OSPrioCur, AL<br>
;<br>
&nbsp;&nbsp;&nbsp; LES BX, DWORD PTR DS:_OSTCBHighRdy ; SS:SP = OSTCBHighRdy-&gt;OSTCBStkPtr<br>
&nbsp;&nbsp;&nbsp; MOV SS, ES:[BX+2]<br>
&nbsp;&nbsp;&nbsp; MOV SP, ES:[BX]<br>
;<br>
&nbsp;&nbsp;&nbsp; POP
DS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;
Load new task's context<br>
&nbsp;&nbsp;&nbsp; POP ES<br>
&nbsp;&nbsp;&nbsp; POPA<br>
;<br>
&nbsp;&nbsp;&nbsp; IRET&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
; Return to new task<br>
;<br>
_OSIntCtxSw ENDP</font></p>
</font>

<p align="left">&nbsp;
<p>&nbsp;</p>
<!--msnavigation--></td></tr><!--msnavigation--></table></body>

</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -