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

📄 c-bkend3.html

📁 vxworks相关论文
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<td valign="top" width="40"><br><img border="0" alt="*" src="icons/note.gif"></td><td><hr><div class="CalloutCell"><a name="89317"><b class="symbol_UC"><font face="Helvetica, sans-serif" size="-1" class="sans">NOTE:  </font></b></a>The client-side RPC implementation must transmit datagrams in a UDP-like manner. In other words, the client-side RPC must reliably transmit an entire datagram. If data is lost, the back end can drop the datagram and RPC repeats the request. Consequently, if the network medium is character-oriented, like a serial device, the back end must packetize datagrams on both the host and target sides (see <a href="c-bkend3.html#85423"><i class="title">2.3.4&nbsp;Target-Side Code</i></a>). One way of doing this is to use the SLIP protocol, as Wind River does in the <b class="keyword">wdbserial</b> back end.</div></td></tr><tr valign="top"><td></td><td><hr></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p callout></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="85283">Building a Back End for UNIX Hosts</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="85285"> </a>By including the generic makefile templates provided with Tornado, it is easy to write a makefile for a back end.</p><dl class="margin"><dd><pre class="Code2"><b><a name="85286"># Makefile - for WDB serial backend</a></b></pre></dl><dd><p class="Body"><a name="85287"> </a>After the modification history, specify the suffixes of the shared library that will be built:</p><dl class="margin"><dd><pre class="Code2"><b><a name="85288">.SUFFIXES:&nbsp;&nbsp;&nbsp;.so .sl</a></b></pre></dl><dd><p class="Body"><a name="85289"> </a>Next, include the makefile templates provided by the Tornado development environment. These fragments make it easy to build a portable makefile.</p><dl class="margin"><dd><pre class="Code2"><b><a name="85290">include&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$(WIND_BASE)/host/include/make/generic.mh include&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$(WIND_BASE)/host/include/make/$(HOST).mh</a></b></pre></dl><dd><p class="Body"><a name="85293"> </a>Set the <b class="symbol_UC">INCLUDES</b> macro to specify that the compiler can find header files in the <i class="textVariable">installDir</i><b class="file">/host/include</b> and the <i class="textVariable">installDir</i><b class="file">/share/src/agents/wdb</b> directories. Specify any other directories that the compiler needs to search to find your back-end header files:</p><dl class="margin"><dd><pre class="Code2"><b><a name="85294">INCLUDES = $(WIND_INC) $(WIND_SHARE_INC)</a></b></pre></dl><dd><p class="Body"><a name="85295"> </a>Specify which modules should be linked to create the back end. List both the back end modules and the <b class="library">rpccore</b> modules (the modules in <b class="file">../share</b>): </p><dl class="margin"><dd><pre class="Code2"><b><a name="85296">BKEND_OBJS = clnt_tty.o wdbserial.o   BKEND_XDR_OBJS = ../share/ctx.o ../share/ctxcreat.o \                 ../share/ctxstep.o ../share/evtdata.o \                 ../share/evtpoint.o ../share/memory.o \                 ../share/regs.o ../share/rpccksum.o \                 ../share/rpccore.o ../share/tgtinfo.o \                 ../share/wrapper.o ../share/xdrcore.o</a></b></pre></dl><dd><p class="Body"><a name="85304"> </a>State the name of the back end: </p><dl class="margin"><dd><pre class="Code2"><b><a name="85305">SH_BKEND_OBJS = wdbserial.$(SHLIB_EXT)</a></b></pre></dl><dd><p class="Body"><a name="85306"> </a>Next, specify any extra compiler flags you need:</p><dl class="margin"><dd><pre class="Code2"><b><a name="85307">LOCAL_CFLAGS = -DPORTABLE -DHOST $(DYN_LK_FLAGS) ... default: lib $(SH_BKEND_OBJS)</a></b></pre></dl><dd><p class="Body"><a name="85310"> </a>Finally, an inference rule states that the back end is built from C source modules that are linked into the shared library. If you need to link the back end with other libraries or are using C++, you must modify this rule.</p><dl class="margin"><dd><pre class="Code2"><b><a name="85311">.c.$(SHLIB_EXT):$(BKEND_OBJS) $(BKEND_XDR_OBJS)         $(SHARED_LD) $(SHARED_LDFLAGS) -o $(SH_BKEND_LIB)/$*.$(SHLIB_EXT) \          $(BKEND_OBJS) $(BKEND_XDR_OBJS) ... include&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$(WIND_BASE)/host/include/make/generic2.mh</a></b></pre></dl></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="85319">Building a Back End for Windows Hosts</a></i></h4></font><dl class="margin"><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="85320">Using Visual C++ 5.0</a></i></h5></font><dl class="margin"><dd><p class="Body"><a name="88852"> </a>To build a back end for Windows hosts, you need to create a project for the back end using Microsoft's Visual C++. Because the target server was built with Visual C++ 5.0, we recommend that developers also use Visual C++ 5.0 to avoid incompatibilities between different versions of the standard libraries. Remember to address the following build issues:</p></dl><dl class="margin"><p class="listspace"><ul class="Bullet" type="disc"><li><a name="85325"> </a>Define the macros <b class="symbol_UC">HOST</b> and <b class="symbol_UC">WIN32</b> so that Wind River header files have the proper configuration for the Windows host. </li></ul></p><p class="listspace"><ul class="Bullet" type="disc"><li><a name="85326"> </a>Add <i class="textVariable">installDir</i><b class="file">/host/include</b> and <i class="textVariable">installDir</i><b class="file">/share/src/agents/wdb</b> to the list of directories to search for include files. </li></ul></p><p class="listspace"><ul class="Bullet" type="disc"><li><a name="85327"> </a>Link with: </li></ul></p><dl class="margin"><p class="listspace"><ul class="Dash2" type="circle"><li><a name="85328"> </a><b class="library">wsock32.lib</b> to provide the necessary socket support for RPC.</li></ul></p><p class="listspace"><ul class="Dash2" type="circle"><li><a name="85329"> </a><i class="textVariable">installDir</i><b class="file">/</b><b class="library">host/x86-win32/lib/backend.lib</b> to pull in back-end support facilities.</li></ul></p></dl></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="85423">2.3.4  &nbsp;&nbsp;Target-Side Code </a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="85425"> </a>The WDB target agent needs a means to send and receive UDP/IP datagrams over the physical network connection. There are two protocol stacks that can be used, the full VxWorks network protocol stack and a lightweight UDP/IP interpreter. The full network protocol stack provides a rich set of functionality, while the lightweight UDP/IP interpreter requires much less target memory. The choice of protocol stacks affects the type of driver that must be written for the physical device.&nbsp;<div class="frame"><h4 class="EntityTitle"><a name="90513"><font face="Helvetica, sans-serif" size="-1" class="sans">Figure 2-6:&nbsp;&nbsp;Driver Type for Different Protocol Stacks</font></a></h4><dl class="margin"><div class="Anchor"><a name="90515"> </a><img class="figure" border="0" src="images/c-bkend6.gif"></div></dl></div>&nbsp;&nbsp;</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="85458">Writing a Network Interface Driver</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="85460"> </a>Drivers that interface with the VxWorks TCP/IP network stack are called network interface drivers. Details of how to write a network interface driver are covered in <i class="title">The BSP Porting Kit</i> (an optional product). The advantage of creating such a driver is that, in addition to being used as a debug communication path, it can also be used for application network communication. To use a network interface driver, configure the target agent for network communication (the default configuration). </p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="85461">Writing a WDB Packet Driver</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="85463"> </a>Drivers that interface with the target agent's UDP/IP interpreter are called WDB packet drivers. Such drivers have the advantage that they do not require the TCP/IP stack to be present on the target. This can save space on resource-constrained targets. The agent's UDP/IP interpreter has the advantage of small size (only 800 bytes) but it also has limited functionality.</p><dd><p class="Body"><a name="87891"> </a>To create a WDB packet driver, start with the template driver in <i class="textVariable">installDir</i><b class="file">/target/src/drv/wdb/wdbTemplatePktDrv.c</b>. Use of the template is documented in the source file.</p><dd><p class="Body"><a name="85465"> </a>You must also modify the agent's startup code to initialize the new communication pathway. The target agent configuration code is provided in <i class="textVariable">installDir</i><b class="file">/target/src/config/usrWdb.c</b>. To initialize your custom packet driver, add initialization code to <b class="file">usrWdb.c</b> similar to the section bracketed with  <br><b class="keyword">#if&nbsp; (</b><b class="symbol_UC">WDB_COMM_TYPE</b><b class="keyword"> == </b><b class="symbol_UC">WDB_COMM_TYPE_CUSTOM</b><b class="keyword">)</b>. </p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="85466">Build Issues</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="85467"> </a>To build the packet driver, copy it into your BSP directory and use the standard techniques described in the <i class="title">Tornado User's Guide: Projects </i>or the <i class="title">VxWorks Programmer's Guide: Configuration and Build. </i>The makefile templates provided in <i class="textVariable">installDir</i><b class="file">/target/h/make</b> assist in developing a portable makefile. Modify the makefile in your BSP directory so that these modules are built and linked into your VxWorks image.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="85469">2.3.5  &nbsp;&nbsp;Testing</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="85471"> </a>Use the <b class="command">wtxtest</b> test suite to verify the new back-end connection. This facility exercises all back-end functions over your new link. For more information about <b class="command">wtxtest</b>, see the online reference material under <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Tornado Reference&gt;Tornado Tools</font></b>.</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/note.gif"></td><td><hr><div class="CalloutCell"><a name="89521"><b class="symbol_UC"><font face="Helvetica, sans-serif" size="-1" class="sans">NOTE:  </font></b></a><b class="command">wtxtest</b> is available in the Tornado distribution but it is not installed by default. If you want to use it, you must install it using <b class="symbol_UC">SETUP</b>. In the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Select Products</font></b> dialog box, highlight the appropriate Tornado object and click <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Details</font></b>. Check <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Tornado WTX Test Suite</font></b> in the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Select Parts</font></b> dialog box and complete your installation.</div></td></tr><tr valign="top"><td></td><td><hr></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p callout></dl><a name="foot"><hr></a><p class="FootnoteNumberMarker">1:&nbsp;<span class="Footnote"><a name="85115"> </a>For more information on RPC, please see the O'Reilley book, <i class="title">Power Programming with RPC</i>.</span><p class="FootnoteNumberMarker">2:&nbsp;<span class="Footnote"><a name="85119"> </a>The <b class="library">rpccore</b> library can be obtained when you request the <i class="title">Back-End Developer's Kit</i>.</span><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="icons/contents.gif"></a><a href="c-bkend.html"><img border="0" alt="[Index]" src="icons/index.gif"></a><a href="c-bkend.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="c-bkend2.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="c-bkend4.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 + -