📄 rom7.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.2.4 Debugging the ROM image </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="rom6.htm"><img src="images/navprev.gif" width="80" height="23"
border="0" alt="PREV"> </a></td>
<td><a href="rom8.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>
<h3>
<a name="1204514"> </a><font color="#003366" face="Verdana, Arial, Helvetica, sans-serif">9.2.4 Debugging the ROM image</font>
</h3>
<p>
<a name="1204515"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">ROM systems may be debugged provided there is a connection to the host from the on-chip diagnostic control unit of the ST20. ROM systems may be debugged from a reset-processor state or the debugger may be connected while the program is running.</font>
</p>
<h5>
<a name="1204517"> </a><i><font color="#003366" face="Verdana, Arial, Helvetica, sans-serif">Debugging a boot-from-ROM system (reset)</font></i>
</h5>
<p>
<a name="1204518"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">This debugging mode is started with the following command:</font>
</p>
<a name="1204519"> </a><font size=2 face=Courier><strong>st20run -i example.cfg -t keen -d<br></strong></font>
<p>
<a name="1204520"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">The target <font size=2 face=Courier><strong>keen</strong></font> (identified in the command line by <font size=2 face=Courier><strong>t</strong></font> <font size=2 face=Courier><strong>keen</strong></font>) has a connect procedure which resets the board, tells the debugger about the hardware, initializes the system memory and configures the EMI.</font>
</p>
<p>
<a name="1204521"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">The user must then tell the debugger about their program's debugging information. This may be done with the command:</font>
</p>
<a name="1204522"> </a><font size=2 face=Courier><strong>program -new example_ram.dbg<br></strong></font>
<p>
<a name="1204523"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">If there is more than one C or C++ program on the ROM, a <font size=2 face=Courier><strong>program new</strong></font> command must be performed for each corresponding debugging information <font size=2 face=Courier><strong>(.dbg)</strong></font> file.</font>
</p>
<p>
<a name="1204524"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">The user may set initial breakpoints at this stage. If the code is in <font size=2 face=Courier><strong>MVTORAM</strong></font>, breakpoints <strong>must</strong> be of hardware type; this is because software breakpoints would be overwritten when code is moved from ROM by the bootstrap.</font>
</p>
<p>
<a name="1204525"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">The user may start the ROM system by invoking the <font size=2 face=Courier><strong>go</strong></font> command.</font>
</p>
<p>
<a name="1208136"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">If initial breakpoints on code are set prior to starting the target, and the code is executed from RAM, these should be of hardware type, otherwise the breakpoint will be overwritten when code is moved from ROM to RAM by the bootstrap.</font>
</p>
<p>
<a name="1204526"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">If the processor is reset (for instance, by a watchdog timeout) or the program must be restarted, the command <font size=2 face=Courier><strong>restart</strong></font> should be used. The commands <font size=2 face=Courier><strong>reset</strong></font> followed by <font size=2 face=Courier><strong>go</strong></font> are not adequate. The command <font size=2 face=Courier><strong>restart</strong></font> executes the connect procedure, sets up breakpoints and executes a <font size=2 face=Courier><strong>go</strong></font> command.</font>
</p>
<p>
<a name="1204527"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">It is important that the connect procedure is executed because this defines the core type, the default register values, the cache and interrupt control procedures and perform EMI programming (which is necessary if the trap handler is not located in internal SRAM).</font>
</p>
<p>
<a name="1204528"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">If the debugger is connected, the chip always stalls on reset. Bit 31 of the DCU2 (or bit 0 of the DCU3) control register is set when the CPU is stalled.</font>
</p>
<h5>
<a name="1204529"> </a><i><font color="#003366" face="Verdana, Arial, Helvetica, sans-serif">Debugging a running system</font></i>
</h5>
<p>
<a name="1204530"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">To make the example in the <font size=2 face=Courier><strong>romdebug</strong></font> directory suitable for connecting to as a running system, it should be recompiled and programmed to ROM without the <font size=2 face=Courier><strong>DENABLE_WATCHDOG</strong></font> option. This turns off the calling of the external command language procedure <font size=2 face=Courier><strong>watchdog_reset</strong></font>, which is inappropriate in this case. This is because a debugger is not always connected and the procedure uses the <font size=2 face=Courier><strong>restart</strong></font> command. The <font size=2 face=Courier><strong>restart</strong></font> command will not work when connected to a target whose connect procedure does not perform a <font size=2 face=Courier><strong>reset</strong></font> and EMI initialization.</font>
</p>
<p>
<a name="1204531"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">This debugging mode is started with the following command:</font>
</p>
<a name="1204532"> </a><font size=2 face=Courier><strong>st20run -i example.cfg -t keen_nr -d<br></strong></font>
<p>
<a name="1204533"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">The target <font size=2 face=Courier><strong>keen_nr</strong></font> (identified in the command line by <font size=2 face=Courier><strong>t</strong></font> <font size=2 face=Courier><strong>keen_nr</strong></font>) has a connect procedure which does not perform a <font size=2 face=Courier><strong>reset</strong></font>, <font size=2 face=Courier><strong>ST20C2MemoryInit</strong></font>, or configure the EMI - a <font size=2 face=Courier><strong>reset</strong></font> would halt the running program and the other operations were already carried out by the ROM image's bootstrap code in order to start the program. However, the connect procedure does specify the memory segments to the debugger.</font>
</p>
<p>
<a name="1204534"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">By default, the debugger's input/output does not appear after connecting to a running system. These are enabled with the debugger command <font size=2 face=Courier><strong>informs enable</strong></font> and may be disabled with the command <font size=2 face=Courier><strong>informs disable</strong></font>.</font>
</p>
<p>
<a name="1204535"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">The user must provide the debugger with the program's debug information using the command:</font>
</p>
<a name="1204536"> </a><font size=2 face=Courier><strong>program -new example_ram.dbg<br></strong></font>
<p>
<a name="1204537"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">At this stage, breakpoints may be set. If a runtime system is in use (for example OS20) the debugger should be told at this point with the <font size=2 face=Courier><strong>runtime</strong></font> command.</font>
</p>
<p>
<a name="1204542"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">If at a later time the processor is reset, the procedures for initializing the system memory and programming the EMI must be called manually before the <font size=2 face=Courier><strong>restart</strong></font> command is issued. Otherwise, the issues discussed under the heading <a href="rom7.htm#1204517"><font color="#0000ff" face="Verdana, Arial, Helvetica, sans-serif"><i>Debugging a boot-from-ROM system (reset)</i></font></a> apply.</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="rom6.htm"><img src="images/navprev.gif" width="80" height="23"
border="0" alt="PREV"> </a></td>
<td><a href="rom8.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"> © 2001, 2002, 2003 STMicroelectronics. All Rights Reserved.<br>
ADCS 7250966F</font>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -