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

📄 compile5.htm

📁 ST20 Embedded Toolset R2.0.5用于开发基于ST20芯片机顶盒软件的开发平台,2.0.5版本,国内找不到的.在国外论坛上花了N天才找到!
💻 HTM
字号:
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="GENERATOR" content="Quadralay WebWorks Publisher Professional Edition 6.0.5">
<meta name="TEMPLATEBASE" content="book_html">
<meta name="LASTUPDATED" content="12/01/03 14:15:55">
<title>15.4 Performance considerations</title>

<STYLE TYPE="text/css">
<!--
	span.Signal { text-transform: uppercase; font-family: Verdana }
-->
</STYLE>

</head>

<body link="#3366CC" vlink="#9999CC" text="#000000" alink="#0000CC" bgcolor="#FFFFFF"
background="images/backgrnd.gif">

<p><img src="images/stlogo.gif" width="106" height="83" align="left"
alt="logo here!"> </p>

<table width="331" border="0" align="right" cellpadding="0" cellspacing="0">
  <tr>
    <td><a href="os20toc.htm"><img src="images/navtoc.gif" width="84" height="23"
    border="0" alt="TOC"> </a></td>
    <td><a href="compile4.htm"><img src="images/navprev.gif" width="80" height="23"
    border="0" alt="PREV"> </a></td>
    <td><a href="libs.htm"><img src="images/navnext.gif" width="83" height="23"
    border="0" alt="NEXT"> </a></td>
    <td><a href="os20ix.htm"><img src="images/navidx.gif" width="84" height="23"
    border="0" alt="INDEX"> </a></td>
  </tr>
</table>

<p><br clear="all">
</p>

<hr align="left">

<blockquote>
<h2>
  <a name="1204675"> </a><font color="#003366"  face="Verdana, Arial, Helvetica, sans-serif">15.4 	 Performance considerations</font>
</h2><hr>


<p>
  <a name="1204680"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif">This section gives some hints on how to place portions of OS20 in memory to optimize performance. Normally the defaults generate reasonably good results. However, in some circumstances it may be necessary to select where in memory certain sections should be placed, and this section gives some recommendations.</font>
</p>


<p>
  <a name="1204684"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif">OS20 has been structured so that most of the important code exists within the scheduler trap handler. This code is responsible for all context switches and management of the kernel data structures. For this reason the trap handler code is normally executed with all interrupts disabled, and so can affect interrupt latency. Thus there are usually two objectives when trying to tune OS20 performance:</font>
</p>

<ul>
<p>  <font size=2  face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1204688"> </a>to reduce context switch times,</font></p>
<p>  <font size=2  face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1204690"> </a>to reduce interrupt latency caused by the scheduler disabling interrupts.</font></p>
</ul>

<p>
  <a name="1204691"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif">The trap handler has been written to reduce execution time as far as possible; timings are dominated by memory access times. This is why the task structures have been broken down into two components, the <font size=2 face=Courier><strong>task_t</strong></font> structure which contains largely static information, and the <font size=2 face=Courier><strong>tdesc_t</strong></font> which contains dynamic information, accessed on context switches. This breakdown allows the <font size=2 face=Courier><strong>tdesc_t</strong></font> to be moved into on-chip memory.</font>
</p>


<p>
  <a name="1204695"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif">There are five sections which OS20 uses:</font>
</p>

<ul>
<p>  <font size=2  face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1204696"> </a>trap handler code (<font size=2 face=Courier><strong>os20_th_code</strong></font> section),</font></p>
<p>  <font size=2  face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1204700"> </a>trap handler workspace (including many OS20 variables) (<font size=2 face=Courier><strong>os20_th_data</strong></font> section),</font></p>
<p>  <font size=2  face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1204701"> </a>task <font size=2 face=Courier><strong>tdesc_t</strong></font> structures,</font></p>
<p>  <font size=2  face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1204702"> </a>task queues (<font size=2 face=Courier><strong>os20_task_queue</strong></font> section),</font></p>
<p>  <font size=2  face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1204703"> </a>interrupt handler stacks.</font></p>
</ul>

<p>
  <a name="1204704"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif">Three of these can be placed using the ST20 Embedded Toolset's configuration files, using the section names indicated in brackets. The remaining two are under the user's control. By default, <font size=2 face=Courier><strong>tdesc_t</strong></font>s are allocated from the internal_partition if <font size=2 face=Courier><strong>task_create()</strong></font> is used, which is normally placed in internal memory, however, if <font size=2 face=Courier><strong>task_init()</strong></font> is used then their location is completely up to the user.</font>
</p>


<p>
  <a name="1204705"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif">Putting the trap handler code and data on chip can bring large performance gains, with fairly small usage of internal memory, and should be done if at all possible. This has been shown to give performance gains of 30%, while moving <font size=2 face=Courier><strong>tdesc</strong></font>s, queues and interrupt stacks on chips only yields an additional 9% improvement.</font>
</p>


<p>
  <a name="1204706"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif">For the remaining three categories, the choices are not so clear. Moving task queues and <font size=2 face=Courier><strong>tdesc</strong></font>s on-chip brings performance improvements in virtually all circumstances, however, these can be large data structures when there are lots of tasks and priorities. One option is to only place the <font size=2 face=Courier><strong>tdesc</strong></font>s of critical tasks on chip while others are still off-chip. This improves the context switch times to those tasks which have their <font size=2 face=Courier><strong>tdesc</strong></font>s on-chip, although this does not result in the full performance gain seen with all <font size=2 face=Courier><strong>tdesc</strong></font>s on-chip, because details of the task being switched away from may have to saved.</font>
</p>


<p>
  <a name="1204707"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif">Moving the interrupt stacks on-chip may be desirable to improve the performance of critical routines, and OS20 also benefits; however it is unlikely to be possible for all interrupt stacks, and should only be considered where the interrupt handler itself needs to execute quickly, and the task response time is also important.</font>
</p>
</blockquote>

<hr>



<table width="331" border="0" align="left" cellpadding="0" cellspacing="0">
  <tr>
    <td><a href="os20toc.htm"><img src="images/navtoc.gif" width="84" height="23"
    border="0" alt="TOC"> </a></td>
    <td><a href="compile4.htm"><img src="images/navprev.gif" width="80" height="23"
    border="0" alt="PREV"> </a></td>
    <td><a href="libs.htm"><img src="images/navnext.gif" width="83" height="23"
    border="0" alt="NEXT"> </a></td>
    <td><a href="os20ix.htm"><img src="images/navidx.gif" width="84" height="23"
    border="0" alt="INDEX"> </a></td>
  </tr>
</table>
<font size=1 face="Verdana, Arial, Helvetica, sans-serif">&nbsp; &copy; 2001, 2002, 2003 STMicroelectronics. All Rights Reserved.<br>
&nbsp; ADCS 7473749B</font>
</body>
</html>

⌨️ 快捷键说明

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