📄 x-vxsim3.html
字号:
<td colspan=1 rowspan=1><p class="BodyLeft"><a name="84527"> </a><b class="symbol_UC">SOM</b> </p></td></tr><tr valign="top"><td colspan=1 rowspan=1><p class="BodyLeft"><a name="84529"> </a><b class="symbol_UC">SIMNT</b> </p></td><td colspan=1 rowspan=1><p class="BodyLeft"><a name="84531"> </a><b class="symbol_lc">a.out</b> </p></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p></div><br><dd><div class="Indent"><a name="84532"> </a>Following C++ compilation, the compiled object module (<i class="textVariable">applic</i><b class="file">.o</b>) is <i class="term">munched</i>. Munching is the process of scanning an object module for non-local static objects, and generating data structures that VxWorks run-time support can use to call the object constructors and destructors. See <a href="c-wfc2.html#84479"><i class="title">5.2.5 Munching C++ Application Modules</i></a>.</div><br></dl></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="84536">Linking an Application to VxSim</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="86281"> </a>By default, applications can be loaded into VxSim while it is running. Alternatively, the application can be statically linked to VxSim by modifying the target makefile. </p></dl></dl><dl class="margin"><dd><p class="table" callout><table border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td valign="top" width="40"><br><img border="0" alt="*" src="icons/caution.gif"></td><td><hr><div class="CalloutCell"><a name="84542"><b class="symbol_UC"><font face="Helvetica, sans-serif" size="-1" class="sans">CAUTION: </font></b></a>VxSim for HP-UX uses the HP native linker <b class="command">ld</b> rather than the GNU linker (<b class="command">ldhppa</b>).</div></td></tr><tr valign="top"><td></td><td><hr></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p callout><dl class="margin"><dd><p class="Body"><a name="84547"> </a>This information applies to using manual methods on both the built-in version of VxSim and the optional networking product.</p></dl></dl><dl class="margin"><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="84548">Dynamic Loading</a></i></h5></font><dl class="margin"><dd><p class="Body"><a name="84549"> </a>To load your application dynamically into VxSim, follow these steps:</p></dl><dl class="margin"><p><ol class="List"><li value="1."><a name="84553"> </a>Start VxSim as described in <a href="x-vxsim2.html#84421"><i class="title">Starting VxSim</i></a>.</li></ol></p><p><ol class="List"><li value="2."><a name="84554"> </a>From a WindSh window, use the <b class="routine"><i class="routine">ld</i></b><b>(</b> <b>)</b> function to load the application dynamically. For example:</li></ol></p><dl class="margin"><dd><pre class="Code2"><b><a name="84555"></b><tt class="output">-> </tt><b>ld </usr/tony/application.o </b><tt class="output">value = 3957696 = 0x3c63c0</tt><b></a></b></pre></dl><dl class="margin"><dd><div class="Indent"><a name="84556"> </a>A nonzero return value indicates that the load was successful.</div><br></dl></dl><dl class="margin"><dd><p class="Body"><a name="84557"> </a>As with VxWorks, the Tornado dynamic linker <b class="routine"><i class="routine">ld</i></b><b>(</b> <b>)</b> requires a relocatable object module. The object format is as follows: <p class="table"><h4 class="EntityTitle"><a name="84560"><font face="Helvetica, sans-serif" size="-1" class="sans">Table H-1: Object Formats by VxSim Host</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="84566"> </a><font face="Helvetica, sans-serif" size="-1" class="sans">Host Type</font></b></div></th><th rowspan="1" colspan="1"><div class="CellHeading"><b><a name="84568"> </a><font face="Helvetica, sans-serif" size="-1" class="sans">Object Format</font></b></div></th><th rowspan="1" colspan="1"><div class="CellHeading"><b><a name="84570"> </a><font face="Helvetica, sans-serif" size="-1" class="sans">Produced By</font></b></div></th></tr><tr><td colspan="20"><hr class="tablerule2"></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84578"> </a>Solaris 2 </div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84580"> </a><b class="file">elf</b> </div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84582"> </a><b class="command">ccsimso</b> </div></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84584"> </a>HP-UX </div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84586"> </a><b class="file">som</b> </div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84588"> </a><b class="command">cchppa</b> </div></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="85643"> </a>Windows </div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="85645"> </a><b class="file">a.out</b> </div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="85647"> </a><b class="command">ccsimpc</b> </div></td></tr><tr><td colspan="20"><hr class="tablerule"></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p></p></dl><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="84589">Static Linking</a></i></h5></font><dl class="margin"><dd><p class="Body"><a name="84590"> </a>The other method of linking is to modify the target makefile to link the application code statically into VxSim when VxSim is built. This method is also useful if you have already debugged a module and you do not want to download it to the target every time you start VxSim.</p><dd><p class="Body"><a name="84591"> </a>To link the application code statically into VxSim, follow these steps:</p></dl><dl class="margin"><p><ol class="List"><li value="1."><a name="84592"> </a>Add your application modules in the makefile definition of <b class="symbol_UC">MACH_EXTRA.</b> The makefile is <b class="file">${</b><b class="symbol_UC">WIND_BASE</b><b class="file">}/target/config/</b><i class="textVariable">bspname</i><b class="file">/Makefile</b>, where <i class="textVariable">bspname</i> is one of <b class="file">solaris</b>, <b class="file">hpux</b>, or <b class="file">simpc</b>:</li></ol></p><dl class="margin"><dl class="margin"><dd><pre class="Code3"><b><a name="84593">MACH_EXTRA = application.o</a></b></pre></dl></dl><dl class="margin"><dd><div class="Indent"><a name="84594"> </a>If your application module is in another directory, specify the pathname.</div><br></dl><p><ol class="List"><li value="2."><a name="84595"> </a>Use <b class="command">make</b> to rebuild VxSim with <b class="file">application.o</b> linked in. </li></ol></p><dl class="margin"><dd><div class="Indent"><a name="84596"> </a>For a discussion of using BSP makefiles to incorporate application modules, see <a href="c-config.html#84365"><i class="title">8. Configuration and Build</i></a>.</div><br></dl></dl><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="84600">Partial Linking</a></i></h5></font><dl class="margin"><dd><p class="Body"><a name="84601"> </a>Large applications may be managed more effectively by using multiple object files. Before downloading the application to VxSim, the objects can be combined into a single file by performing a <i class="term">partial link</i> as shown below:</p><dl class="margin"><dd><pre class="Code2"><b><a name="84602"></b><tt class="output">% </tt><b>/bin/ldsimso -B immediate -N -r -o application.o module1.o \ module2.o ...</a></b><dd> <b><a name="84603"></b><tt class="output">% </tt><b>/bin/ld -B immediate -N -r -o application.o module1.o module2.o ...</a></b><dd> <b><a name="84604"></b><tt class="output">% </tt><b>/bin/ldsimpc -B immediate -N -r -o application.o module1.o \ module2.o ...</a></b></pre></dl><dd><p class="Body"><a name="84605"> </a>If you want to use CrossWind to debug your application on the HP-UX simulator, you must run <b class="command">xlinkHppa</b> on the partially-linked object file before downloading it to VxWorks. For example:</p><dl class="margin"><dd><pre class="Code2"><b><a name="84606">% xlinkHppa application.o</a></b></pre></dl><dd><p class="Body"><a name="84607"> </a>For more information on <b class="command">xlinkHppa</b>, see its reference entry. </p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="84608">Architecture-Specific Tools</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84609"> </a>The following tools are available to extract the symbol table from an object file created for a simulator. The syntax is:</p></dl><dl class="margin"><dd><div class="Item"><a name="84611"> </a><b class="command">elfXsyms </b></div><dl class="margin"><dd><div class="Indent"><a name="84612"> </a>is used for an <b class="symbol_UC">ELF</b> file for the Solaris simulator. The syntax is:</div><br><dl class="margin"><dd><pre class="Code3"><b><a name="84614">elfXsyms < <i class="textVariable">objMod</i> > <i class="textVariable">symTbl</i> </a></b></pre></dl></dl><dd><div class="Item"><a name="84616"> </a><b class="command">xsymHppa </b></div><dl class="margin"><dd><div class="Indent"><a name="84617"> </a>is used for a <b class="symbol_UC">SOM</b> file for the HP-UX simulator. The syntax is:</div><br><dl class="margin"><dd><pre class="Code3"><b><a name="84619">xsymHppa < <i class="textVariable">objMod</i> > <i class="textVariable">symTbl</i> </a></b></pre></dl></dl></dl><dl class="margin"><dd><p class="Body"><a name="84620"> </a>No tool is required for the Windows simulator. When a symbol table is required, the loader loads the entire executable but only the symbol table is referenced.</p></dl></dl><a name="foot"><hr></a><p class="FootnoteNumberMarker">1: <span class="Footnote"><a name="84480"> </a>For more information on these and other compiler options, see the <i class="title">GNU ToolKit User's Guide</i>. WRS supports compiler options used in building WRS software; see the <i class="title">Guide</i> for a list. Other options are not supported, although they are available with the tools as shipped.</span><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="icons/contents.gif"></a><a href="GuideIX.html"><img border="0" alt="[Index]" src="icons/index.gif"></a><a href="x-vxsim.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="x-vxsim2.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="x-vxsim4.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p></body></html><!---by WRS Documentation (), Wind River Systems, Inc. conversion tool: Quadralay WebWorks Publisher 4.0.11 template: CSS Template, Jan 1998 - Jefro --->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -