📄 c-vxsim.html
字号:
</font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84438"></a>The following sections describe how to use the VxSim compilers. The recommended way to build VxSim modules is to use the project tool. For complete information on this tool, see <a href="c-builder.html#104670"><i class="title">4. Projects</i></a>. If you are using manual methods in your project, the information required for manual builds and loading is summarized below.</p><dd><p class="Body"><a name="84439"></a>This information applies to using manual methods on both the integrated version of VxSim and the full simulator product.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="84441"></a>Defining the CPU Type</i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84442"></a>Setting the preprocessor variable <b class="symbol_UC">CPU</b> ensures that VxWorks and your applications build with the appropriate features enabled. Define this variable to <b class="symbol_UC">SIMNT</b> for all Windows hosts. </p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="84456"></a>The Toolkit Environment</i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84466"></a>All VxWorks simulators use the GNU C/C++ compiler.</p></dl></dl><dl class="margin"><dd><p class="table"><table border="0" cellpadding="2" cellspacing="0"><tr valign="top"><td colspan=1 rowspan=1></td><td><hr></td></tr><tr valign="top"><td><img border="0" alt="*" src="icons/caution.gif"> </td><td colspan=1 rowspan=1><div class="CalloutCell"><a name="84461"></a><b class="symbol_UC"><font face="Helvetica, sans-serif" size="-1" class="sans">CAUTION: </font></b>The compiler used by the Tornado tools to compile VxSim applications for Windows is the GNU C/C++ compiler rather than any MicroSoft tools. This provides for greater compatibility between VxSim and VxWorks environments.</div></td></tr><tr valign="top"><td colspan=1 rowspan=1></td><td colspan=1 rowspan=1><hr></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="84467"></a>Compiling C and C++ Modules</i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84475"></a>Only the GNU compiler is supported for <b class="symbol_UC">SIMNT</b>: the Diab compiler is not supported. If you compile using the IDE build facilities, default build settings are already in place. If you wish to modify the defaults, or if you wish to build from the command line, the following information may be helpful.</p><dd><p class="Body"><a name="88951"></a>The following is an example of a compiler command line for VxSim development. The file to be compiled in this example has a base name of <b class="file">applic</b>.</p><dl class="margin"><dd><font color="009090"><pre class="Terminal2"><a name="84476"></a>% <font color="00a000"><b>ccsimpc -g -mpentium -ansi -DRW_MULTI_THREAD -D_REENTRANT -fno-builtin -fno-defer-pop -I. -I</b></font><i class="textVariable">installDir</i><font color="00a000"><b>/target/h/ -DCPU=SIMNT -DTOOL_FAMILY=gnu -DTOOL=gnu -c applic.c</b></font></pre></font></dl></dl></dl><dl class="margin"><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="88051"></a>Option Definitions </i></h5></font><dl class="margin"><dd><p class="Body"><a name="88082"></a>The options shown in the example and other compiler options are detailed in the online version of the <i class="title">GNU ToolKit User's Guide</i>. Wind River supports compiler options used in building Wind River 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.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="84536"></a>Linking an Application to VxSim</i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="88971"></a>Linking and loading for VxSim are identical to other BSPs. See the <i class="title">VxWorks Programmer's Guide</i>: <i class="title">Configuration and Build</i>.</p></dl></dl><br class="H2"><a name="84622"></a><br class="H2navbar"><font face="Helvetica, sans-serif" class="sans"><h3 class="H2"><i>6.4 Architecture Considerations</i></h3></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84623"></a>The information in this section highlights differences between VxSim (both the integrated and full versions) and other VxWorks BSPs. These differences should be taken into consideration as you develop applications on VxSim that will eventually be ported to another target architecture.</p><dd><p class="Body"><a name="84624"></a>VxSim uses the VxWorks scheduler, which behaves the same way as for any other VxWorks architecture (see the <i class="title">VxWorks Programmer's Guide: Basic OS</i>). The BSP is extensible; for example, pseudo-drivers can be written for additional timers, serial drivers, and so forth.</p><dd><p class="Body"><a name="84628"></a>The rest of this section discusses some details of the VxSim implementation. Differences between VxSim and other VxWorks environments are noted where appropriate.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="84629"></a>Supported Configurations</i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84630"></a>Most of the optional features and device drivers for VxWorks are supported by VxSim. The few that are not are hardware devices (SCSI, Ethernet), ROM configurations, and so on. The BSP makefile builds only the images <b class="file">vxWorks</b> and <b class="file">vxWorks.st</b> (standalone VxWorks).</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="88152"></a>Endianess</i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="88983"></a>The Windows simulator uses a little-endian environment.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="88982"></a>Simulator Timeout</i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="88154"></a>Occasionally a simulator session loses its target server connection due to the many things competing for CPU time on the host. If you find that your application is frequently losing its target server connection, adjust the back end timeout (<b class="command">-Bt</b>) and back end retry (<b class="command">-Br</b>) parameters when starting the target server with Tornado. To do this from the <font face="Helvetica, sans-serif" size="-1" class="sans">Configure Target Servers</font> dialog, select <font face="Helvetica, sans-serif" size="-1" class="sans">Miscellaneous</font> and set the appropriate options using the <font face="Helvetica, sans-serif" size="-1" class="sans">Other Options</font> field. For example, you may want to increase the back end timeout from 1 to 3 and the resend parameter from 3 to 4:</p><dl class="margin"><dd><font color="0000a0"><pre class="Code2"><a name="88993"></a>-Bt 3 -Br 4</pre></font></dl><dd><p class="Body"><a name="88994"></a>You can also add this string to the <b class="command">tgtsvr</b> command when you start the target server from the command line.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="84631"></a>The BSP Directory</i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="88159"></a>Aside from the following exceptions, the VxSim BSP is the same as a VxWorks BSP:</p></dl><dl class="margin"><dd><p class="listspace"><ul class="Bullet" type="disc"><li><a name="84633"></a>The <b class="file">sysLib.c</b> module contains the same essential functions: <b class="routine">sysModel( )</b>, <b class="routine">sysHwInit( )</b>, and <b class="routine">sysClkConnect( )</b> through <b class="routine">sysNvRamSet( )</b>. Because there is no bus, <b class="routine">sysBusToLocalAdrs( )</b> and related functions have no effect.</li></ul></p><dd><p class="listspace"><ul class="Bullet" type="disc"><li><a name="84634"></a>The file <b class="file">winSio.c</b> ultimately calls the host OS <b class="routine">read( )</b> and <b class="routine">write( )</b> routines on the process's standard input and output. Nevertheless, it supports all the functionality provided by <b class="file">tyLib.c</b>. </li></ul></p><dd><p class="listspace"><ul class="Bullet" type="disc"><li><a name="89035"></a>The <b class="file">simpcDrv.a</b> file is the library for <b class="command">simpc</b> BSP drivers.</li></ul></p><dd><p class="listspace"><ul class="Bullet" type="disc"><li><a name="84635"></a>The configuration header<b class="file"> config.h</b> is minimal:</li></ul></p><dl class="margin"><dd><p class="listspace"><ul class="Dash2" type="circle"><li><a name="84636"></a>It does not reference a <i class="textVariable">bspname</i><b class="file">.h</b> file.</li></ul></p><dd><p class="listspace"><ul class="Dash2" type="circle"><li><a name="84637"></a>Most network devices are excluded.</li></ul></p><dd><p class="listspace"><ul class="Dash2" type="circle"><li><a name="84638"></a>The boot line has no fixed memory location. Instead, it is stored in the variable <b class="routine">sysBootLine</b> in <b class="file">sysLib.c</b>.</li></ul></p></dl><dd><p class="listspace"><ul class="Bullet" type="disc"><li><a name="84639"></a>The <b class="file">Makefile</b> is the standard version for VxWorks BSPs. It does not build boot ROM images (although the makefile rules remain intact); it can only build <b class="file">vxWorks</b> and <b class="file">vxWorks.st</b> (standalone) images. The final linking does not arrange for the TEXT segment to be loaded at a fixed area in RAM, but follows the usual loading model. The makefile macro <b class="symbol_UC">MACH_EXTRA</b> is provided so that users can easily link their application modules into the VxWorks image if they are using manual build methods.</li></ul></p></dl><dl class="margin"><dd><p class="Body"><a name="84640"></a>The BSP file <b class="file">sysLib.c</b> can be extended to emulate the eventual target hardware more completely. </p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="84643"></a>Interrupts</i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84700"></a>Windows messages are used to simulate hardware interrupts. For example, VxSim uses messages 0xc000 - 0xc010 to simulate interrupts from ULIP, the pipe back end, and so forth. The messages are the VxSim equivalent to Interrupt Service Routines (ISRs) on other VxWorks targets. You can install ISRs in VxSim to handle these "interrupts." Not all VxWorks functions can be called from ISRs; see the <i class="title">VxWorks Programmer's Guide: Basic OS</i>. To run ISR code during a future system clock interrupt, use the watchdog timer facilities. To run ISR code during auxiliary clock interrupts, use the <b class="routine">sysAuxClk</b><i class="textVariable">xxx</i><b class="routine">( )</b> functions.</p><dd><p class="Body"><a name="84724"></a><a href="c-vxsim.html#84709">Table 6-2</a> shows how the message table is set up.</dl></dl><p class="table"><dl class="margin"><dd><p class="EntityTitle"><a name="84709"></a><font face="Helvetica, sans-serif" size="-1" class="sans">Table 6-2: <b>Interrupt Assignments</b></font></p></dl><dl class="margin"><dl class="margin">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -