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

📄 c-bkend4.html

📁 vxworks相关论文
💻 HTML
📖 第 1 页 / 共 5 页
字号:
    $(ACE_LD_FLAGS)        \     $(RW_LD_FLAGS)         \     -L$(gnu_ROOT)/lib      \     -lg++         \     -liostream    \     -L$(gnu_ROOT)/lib/gcc-lib/sparc-sun-sunos4.1.3_U1/2.6.3/     \     -ldl -lc -lgcc</a></b></pre></dl></dl><dl class="margin"><dd><div class="Indent"><a name="86092"> </a>Specify the name of the back end using <b class="symbol_UC">SH_BKEND_OBJS</b>. Then use <b class="symbol_UC">LOCAL_CFLAGS</b> to define the local compiler options: <b class="symbol_UC">-DPORTABLE</b> specifies portable versions of host libraries, -<b class="symbol_UC">DHOST</b> specifies host versions of header files, and <b class="symbol_UC">$(DYN_LK_FLAGS)</b> sets the options for compiling a DLL.</div><br><dl class="margin"><dd><pre class="Code3"><b><a name="86097">SH_BKEND_OBJS     = acecpu32.$(SHLIB_EXT) ... LOCAL_CFLAGS      = -DPORTABLE -DHOST $(DYN_LK_FLAGS) -fno-builtin  \               -g -fno-inline ...</a></b></pre></dl><dd><div class="Indent"><a name="86102"> </a>Finally, there is a target rule and an inference rule to build the back-end DLL:</div><br><dl class="margin"><dd><pre class="Code3"><b><a name="86103">default:lib objdircre $(SH_BKEND_OBJS)  %.$(SHLIB_EXT):$(FULL_BKD_OBJS)         $(SHARED_LD) $(SHARED_LDFLAGS) -o$(SH_BKEND_LIB)/$*.$(SHLIB_EXT) \              $(BKEND_OBJS) $(BKEND_LIB_EXTRA) $(BKEND_XDR_OBJS)  ... include&nbsp;&nbsp;$(WIND_BASE)/host/include/make/generic2.mh ...</a></b></pre></dl><dd><div class="Indent"><a name="86113"> </a>Once your makefile is complete, build the skeleton back end with <b class="command">make</b>.</div><br></dl></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="86114">Building on Windows NT and Windows 95</a></i></h4></font><dl class="margin"><dl class="margin"><p><ol class="List"><li value="1."><a name="89698"> </a>Use Microsoft Visual C++ 5.0.</li></ol></p><p><ol class="List"><li value="2."><a name="89712"> </a>Create a project for a multi-threaded DLL which includes BEDK source, your back end source, and any third party sources.</li></ol></p><p><ol class="List"><li value="3."><a name="86131"> </a>In the project settings:</li></ol></p><dl class="margin"><p class="listspace"><ul class="Dash2" type="circle"><li><a name="86132"> </a>Link with Rogue Wave and other necessary libraries. Link only with multi-threaded DLLs. Do not link with <b class="library">libc</b> or <b class="library">libcmt</b>.</li></ul></p><p class="listspace"><ul class="Dash2" type="circle"><li><a name="86133"> </a>Define the macros <b class="symbol_UC">RW_NO_STL</b> and <b class="symbol_UC">_RWTOOLSDLL</b> (required by Roque Wave). Also define <b class="symbol_UC">WIN32</b> and <b class="symbol_UC">HOST</b> (required by Wind River).</li></ul></p></dl><p><ol class="List"><li value="4."><a name="86134"> </a>Build Rogue Wave's multi-threaded DLL:</li></ol></p><dl class="margin"><dd><pre class="Code2"><b><a name="86135">nmake -f makefile.msc ENVIRON=WIN32 THREAD=MULTI BINDING=DLL</a></b></pre></dl><dl class="margin"><dd><div class="Indent"><a name="86136"> </a>Define <b class="symbol_UC">RW_NO_WSTR</b> in <b class="file">rw/compiler.h</b>. Define <b class="symbol_UC">RW_NO_STL</b> and <b class="symbol_UC">_RWTOOLSDLL</b>.</div><br></dl><p><ol class="List"><li value="5."><a name="86138"> </a>Do not mix debug and release objects and libraries.</li></ol></p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="86139">Testing</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="86141"> </a>There are two milestones that should be achieved while testing the skeleton back end: successfully loading the back end you build, and successfully invoking back end methods with <b class="keyword">wtxtcl</b>.</p></dl></dl><dl class="margin"><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="86142">Loading the Back End</a></i></h5></font><dl class="margin"><dd><p class="Body"><a name="86144"> </a>After you have built the back end, the next step is to invoke the target server. Invoke the target server using Tornado's <b class="keyword">Launch</b> tool, or enter:</p><dl class="margin"><dd><pre class="Code2"><b><a name="86145"></b><tt class="output">%</tt><b> tgtsvr -V -B acecpu32    \ -core $WIND_BASE/target/config/ace360/vxWorks -A <i class="textVariable">hostNameOfEmulator</i></a></b></pre></dl><dd><p class="Body"><a name="86147"> </a>where <b class="command">-V</b> enables verbose diagnostic output, <b class="command">-B</b> specifies which back end to use, <b class="command">-core</b> specifies the path to the VxWorks image loaded on the target,<b> </b><b class="command">-A</b> causes all of VxWorks' symbols to be loaded into the target server symbol table (this flag is optional), and <i class="textVariable">hostNameOfEmulator</i> is the emulator's host name.</p><dd><p class="Body"><a name="86148"> </a>If you do not have a VxWorks image for the target board, you can use the following instead:</p><dl class="margin"><dd><pre class="Code2"><b><a name="86149"></b><tt class="output">%</tt><b> tgtsvr -V -B acecpu32 -f a.out <i class="textVariable">hostNameOfEmulator</i></a></b></pre></dl><dd><p class="Body"><a name="86150"> </a>where <b class="command">-f</b> specifies the object module format (OMF) to use. Use the same OMF which Wind River uses for your target architecture. For more information on the target server and its options see the reference pages and the <i class="title">Tornado User's Guide: Getting Started</i>.</p><dd><p class="Body"><a name="86151"> </a>If you are using UNIX and fail to link all the necessary libraries into the back end, the target server crashes. (This problem will not occur under Windows because Microsoft Visual C++ will generate error messages for unresolved externals during the link phase.) The UNIX error message is similar to the following:</p><dl class="margin"><dd><pre class="Code2"><b><a name="86152"></b><tt class="output">%</tt><b> tgtsvr -V -B acecpu32 \     -core $WIND_BASE/target/config/est360/vxWorks -A myTarget </b><tt class="output">tgtsvr (myTarget@acheron): Tue May  7 12:26:10 1996     Attaching backend... ld.so: Undefined symbol: ___builtin_new</tt><b></a></b></pre></dl><dd><p class="Body"><a name="86156"> </a>To solve this problem, you need to determine which library implements the undefined symbol, <b class="symbol_lc">___builtin_new</b>. You will find <b class="command">nm</b> invaluable for solving this problem, because it displays the symbols in a module. If the undefined symbol is a mangled name, use <b class="command">c++filt</b> to convert the name to an unmangled name to make your search easier. </p><dd><p class="Body"><a name="86157"> </a>A side effect of the target server's crash is that the target server does not unregister with the registry daemon, <b class="symbol_lc">wtxregd</b>. You can confirm this using the registry status command, <b class="command">wtxreg</b>:</p></dl><dl class="margin"><dd><pre class="Code"><b><a name="86158"></b><tt class="output">%</tt><b> wtxreg </b><tt class="output">Registry for acheron:         Name              &nbsp;Arch          Mb    #tools  User      Idle --------------------      ------------- ------ ------ --------- ------ myTarget@acheron &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DOWN</tt><b></a></b></pre></dl><dl class="margin"><dd><p class="Body"><a name="86163"> </a>You cannot restart a target server with the same name until you clean up the registry. To do so, use the <b class="keyword">wtxtcl</b> script <b class="command">unreg</b>, shown in <a href="c-bkend1.html#84425"><i class="title">Shutting Down the Target Server</i> on p. 17</a>, or use <b class="command">Launch</b>.</p><dd><p class="Body"><a name="86167"> </a>When the back end is correctly linked, invoking the target server should produce the following messages:</p><dl class="margin"><dd><pre class="Code2"><b><a name="86168"></b><tt class="output">tgtsvr (myTarget@acheron): Tue May  7 12:37:27 1996     Attaching backend... succeeded.     Establishing ACE SuperBDM connection...&nbsp;&nbsp;succeeded.     Attaching C++ interface... succeeded.     Attached a.out OMF reader.     Warning: Core file checksums do not match.</tt><b></a></b></pre></dl><dd><p class="Body"><a name="86174"> </a>Note that the <b class="keyword">acecpu32</b> back end does not perform the checksum because it would take too long, given this emulator's low bandwidth memory-read capability. Consequently, the target server logs a warning. This warning will not appear if your back end can perform a checksum, and if it matches the target server checksum of VxWorks' text segment.</p></dl><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="86176">Invoking Back-End Methods</a></i></h5></font><dl class="margin"><dd><p class="Body"><a name="86178"> </a>Once you have built a back end that the target server can load, use <b class="keyword">wtxtcl</b> to invoke back-end methods. This validates that tools can use the Tornado framework to invoke back-end methods. A typical test session involves starting the <b class="keyword">wtxtcl</b> shell, attaching the target server and testing various back-end methods by issuing <b class="keyword">wtxtcl</b> commands:</p><dl class="margin"><dd><pre class="Code2"><b><a name="86179"></b><tt class="output">%</tt><b> wtxtcl </b><tt class="output">wtxtcl&gt;</tt><b>wtxToolAttach myTarget </b><tt class="output">myTarget@acheron wtxtcl&gt;</tt><b>wtxMemRead 0x0 16 </b><tt class="output">mblk0 </tt><b>... </b><tt class="output">wtxtcl&gt;</tt><b>exit</a></b></pre></dl><dd><p class="Body"><a name="86186"> </a>If your implementation is successful, the back end logs appropriate messages when you invoke a back-end method. Most WTX Tcl procedures, like <b class="tclProc">wtxMemRead</b>, directly map onto a corresponding back-end method. The first WTX Tcl command which you enter is always <b class="tclProc">wtxToolAttach</b> to connect <b class="keyword">wtxtcl</b> to a specific target server. Then invoke appropriate WTX Tcl procedures to test the back-end framework.</p><dd><p class="Body"><a name="86187"> </a>If a <b class="keyword">wtxtcl</b> method fails, use <i class="textVariable">installDir</i><b class="file">/host/include/wtxerr.h </b>to convert the error code into a meaningful message. For example:</p><dl class="margin"><dd><pre class="Code2"><b><a name="86188"></b><tt class="output">wtxtcl&gt;</tt><b>wtxVioWrite 1 -string "asdf" </b><tt class="output">Error: WTX Error 0x100d4</tt><b></a></b></pre></dl><dd><p class="Body"><a name="86190"> </a>To convert 0x1000d4 into a meaningful value, convert 0xd4 to a decimal value. You should find a corresponding entry in <b class="file">wtxerr.h</b>. You may find it helpful to create a script to do this using <b class="command">grep</b> and <b class="command">bc</b>. Once you have converted the value, you find:</p><dl class="margin"><dd><pre class="Code2"><b><a name="86192">WTX_ERR_AGENT_NO_AGENT_PROC    = (WTXERR_BASE_NUM | 212)</a></b></pre></dl></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="86194">2.4.4  &nbsp;&nbsp;Implementing Mandatory Member Functions</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="86196"> </a>Once the back-end framework is validated, you can implement the mandatory member functions. First implement memory and register read and write methods. Once this milestone is achieved, implement the remaining mandatory back-end functions including state management and event handling. Studying the <b class="keyword">acecpu32</b> back-end example in parallel with this section will be helpful, especially in understanding the use of the WDB data structures. The required back-end methods are shown in <a href="c-bkend4.html#86206">Table&nbsp;2-1</a>.&nbsp;&nbsp;&nbsp;<p class="table"><h4 class="EntityTitle"><a name="86206"><font face="Helvetica, sans-serif" size="-1" class="sans">Table 2-1:&nbsp;&nbsp;Mandatory Member Functions&nbsp;</font></a></h4><table border="0" cellpadding="0" cellspacing="0"><tr><td colspan="20"><hr class="tablerule"></td></tr><tr valign="middle"><th rowspan="1" colspan="1"><div class="CellHeading"><b><a name="86210"> </a><font face="Helvetica, sans-serif" size="-1" class="sans">Member Function</font></b></div></th><td width="10">&nbsp;</td><th rowspan="1" colspan="1"><div class="CellHeading"><b><a name="86212"> </a><font face="Helvetica, sans-serif" size="-1" class="sans">Purpose</font></b></div></th><td width="10">&nbsp;</td></tr><tr><td colspan="20"><hr class="tablerule2"></td></tr><tr valign="top"><td colspan=2 rowspan=1><div class="CellHeading"><b><a name="86214"> </a><font face="Helvetica, sans-serif" size="-1" class="sans">Functions Included in the Target Server Back End API</font></b></div></td><td width="10">&nbsp;</td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="86218"> </a><b class="routine"><i class="routine">tgtConnect_m</i></b><b>(&nbsp;)</b></div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><div class="CellBody"><a name="86220"> </a>Connect back end to emulator.</div></td><td width="10">&nbsp;</td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="86222"> </a><b class="routine"><i class="routine">tgtDisconnect_m</i></b><b>(&nbsp;)</b></div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><div class="CellBody"><a name="86224"> </a>Disconnect back end from emulator.</div></td><td width="10">&nbsp;</td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="86226"> </a><b class="routine"><i class="routine">memRead_m</i></b><b

⌨️ 快捷键说明

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