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

📄 rom11.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/04/03 16:05:52">
<title>9.4 Callbacks before and after the poke loop in romload()</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="a_refman.htm"><img src="images/navtoc.gif" width="84" height="23"
    border="0" alt="TOC"> </a></td>
    <td><a href="rom10.htm"><img src="images/navprev.gif" width="80" height="23"
    border="0" alt="PREV"> </a></td>
    <td><a href="rom12.htm"><img src="images/navnext.gif" width="83" height="23"
    border="0" alt="NEXT"> </a></td>
    <td><a href="a_refmaa.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="1204637"> </a><font color="#003366"  face="Verdana, Arial, Helvetica, sans-serif">9.4 	 Callbacks before and after the poke loop in romload()</font>
</h2><hr>


<p>
  <a name="1204638"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif">The set of <font size=2 face=Courier><strong>poke</strong></font> commands encountered during the link phase of a ROM program is performed at run time by the function <font size=2 face=Courier><strong>romload</strong></font>. There is no such automatic mechanism for configuration scripts which read memory or perform conditional memory operations. To perform this function, one user-supplied function may be called prior to these pokes being carried out, and another user-supplied function may be called after the pokes.</font>
</p>


<p>
  <a name="1204639"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif">These functions must be defined as:</font>
</p>


<a name="1204641"> </a><font size=2 face=Courier><strong>void PrePokeLoopCallback(void)<br>void PostPokeLoopCallback(void)<br></strong></font>



<p>
  <a name="1204644"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif">They should both be defined in a source module called <font size=2 face=Courier><strong>initfuncs.c</strong></font> which is compiled to a file called <font size=2 face=Courier><strong>initfuncs.tco</strong></font>. The header file <font size=2 face=Courier><strong>initfuncs.h</strong></font> must be included in <font size=2 face=Courier><strong>initfuncs.c</strong></font>. The object file <font size=2 face=Courier><strong>initfuncs.tco</strong></font> may then be linked into the main program to override stub functions provided in the toolset libraries.</font>
</p>


<p>
  <a name="1205583"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif"><em>Note:	1	 The object file <font size=2 face=Courier><strong>initfuncs.tco</strong></font> must <strong>not</strong> be placed in a library; this object file must be specified to <font  face="Verdana, Arial, Helvetica, sans-serif"><b>st20cc</b></font> at link time.</em></font>
</p>

<p>
  <a name="1205589"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif"><em>	2	 If one of the callback functions is implemented as described above, the other must be implemented in the same file, even if this is merely a stub.</em></font>
</p>

<p>
  <a name="1204645"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif">The user supplied functions may not access static data because it has not been set up at this stage in the bootstrap phase. The functions may declare local variables subject to stack allocation (see below). They should not call functions which have yet to be copied from ROM to RAM.</font>
</p>


<p>
  <a name="1206716"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif">The functions <font size=2 face=Courier><strong>romload</strong></font>, <font size=2 face=Courier><strong>PrePokeLoopCallback</strong></font> and <font size=2 face=Courier><strong>PostPokeLoopCallback</strong></font> use internal memory for their workspace. If the command <font size=2 face=Courier><strong>initstack</strong></font> was present during the link phase, the function <font size=2 face=Courier><strong>romload</strong></font> sets the contents of the <span class=Signal>Wptr</span> to the argument of this command as one of its first operations, and before the callback functions are called. Otherwise the <span class=Signal>Wptr</span> is not altered; if the processor was reset it will thus contain <font size=2 face=Courier><strong>0x80000140</strong></font> on an ST20C2 core, or <font size=2 face=Courier><strong>0x80000000</strong></font> on an ST20C1 core. The function <font size=2 face=Courier><strong>romload</strong></font> and the default callback functions use seven words above the <span class=Signal>Wptr</span> value.</font>
</p>


<p>
  <a name="1204647"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif">If the callback functions use any stack or call any functions, the user must allocate local workspace in internal memory. This is done by specifying the top of a negatively growing stack for user and compiler generated local variables.</font>
</p>


<p>
  <a name="1204648"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif">For example, to allocate 32 words for the user-supplied callbacks, at the start of <font size=2 face=Courier><strong>romload</strong></font> the <span class=Signal>Wptr</span> must be set to:</font>
</p>


<a name="1206002"> </a><font size=2 face=Courier><strong>Wptr at reset + 32*4<br>= 0x80000140 + 32*4<br>= 0x800001C0<br></strong></font>



<p>
  <a name="1204652"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif">and this may be achieved by using the following command in the link phase:</font>
</p>


<a name="1204653"> </a><font size=2 face=Courier><strong>initstack 0x800001C0<br></strong></font>



<p>
  <a name="1204654"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif"><em>Note:	 Seven words above this stack are used by <font size=2 face=Courier><strong>romload</strong></font> so the <span class=Signal>Wptr</span> must be set at least seven words below the top of the internal memory segment.</em></font>
</p>

<p>
  <a name="1204655"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif">The most convenient way of determining the number of stack words required by a <font size=2 face=Courier><strong>PrePokeLoopCallback</strong></font> or <font size=2 face=Courier><strong>PostPokeLoopCallback</strong></font> function is to use the stack depth analysis feature in <strong>st20cc</strong>.</font>
</p>
</blockquote>

<hr>



<table width="331" border="0" align="left" cellpadding="0" cellspacing="0">
  <tr>
    <td><a href="a_refman.htm"><img src="images/navtoc.gif" width="84" height="23"
    border="0" alt="TOC"> </a></td>
    <td><a href="rom10.htm"><img src="images/navprev.gif" width="80" height="23"
    border="0" alt="PREV"> </a></td>
    <td><a href="rom12.htm"><img src="images/navnext.gif" width="83" height="23"
    border="0" alt="NEXT"> </a></td>
    <td><a href="a_refmaa.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 7250966F</font>
</body>
</html>

⌨️ 快捷键说明

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