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

📄 c-bkend4.html

📁 vxworks相关论文
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<td><hr><div class="CalloutCell"><a name="89384"><b class="symbol_UC"><font face="Helvetica, sans-serif" size="-1" class="sans">NOTE:  </font></b></a><b class="symbol_UC">UINT32</b> is a Wind River convention for a 32-bit, unsigned integer. It is declared in <i class="textVariable">installDir</i><b class="file">/host/include/host.h</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="85983"> </a>Use the appropriate stub function for each method's return type to implement the remaining mandatory methods. For example, <b class="routine"><i class="routine">Ace_T::tgtPing</i></b><b>(&nbsp;)</b> would be implemented as follows:</p></dl><dl class="margin"><dd><pre class="Code"><b><a name="85984">UINT32 Ace_T::tgtPing_m (void)     {     return (stubUINT32&nbsp;("tgtPing_m&nbsp;(&nbsp;)"));     }</a></b></pre></dl><dl class="margin"><dd><p class="Body"><a name="85988"> </a>The only function besides <b class="symbol_lc">Ace_T</b>'s constructor you should implement without the stub functions is the <b class="routine"><i class="routine">Ace_T::tgtConnect_m</i></b><b>(&nbsp;)</b> method. This method initializes <b class="symbol_UC">WDB_TGT_INFO, </b>which describes the target's configuration. </p></dl><dl class="margin"><dd><pre class="Code"><b><a name="85990">UINT32 Ace_T::tgtConnect_m (WDB_TGT_INFO * pWdbTgtInfo)     {     WPWR_LOG_MSG ("Establishing ACE SuperBDM connection... ");      // XXX - this information should be read from the $WIND_TGT_INFO     // file.  Using hard-coded literals for now.</a></b></pre></dl><dl class="margin"><dd><p class="Body"><a name="85996"> </a>First, record information about the debug agent, in this case the new emulator back end. <b class="symbol_lc">agentInfo.mtu</b><b> </b>specifies the maximum amount of data that can be sent or received by the agent. <b class="symbol_lc">agentInfo.mode</b> is always set to <b class="symbol_UC">WDB_MODE_EXTERN</b> for a system-level debug agent like our emulator; this value is defined in <b class="file">wdb.h</b>.</p></dl><dl class="margin"><dd><pre class="Code"><b><a name="85997">    pWdbTgtInfo-&gt;agentInfo.agentVersion      = "ACE BDM 1.0.1";      pWdbTgtInfo-&gt;agentInfo.mtu               = Ace_T::MaxMtu;      // XXX     pWdbTgtInfo-&gt;agentInfo.mode              = WDB_MODE_EXTERN;</a></b></pre></dl><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="89400"><b class="symbol_UC"><font face="Helvetica, sans-serif" size="-1" class="sans">CAUTION:  </font></b></a><b class="symbol_lc">pWdbTgtInfo-&gt;agentInfo.agentVersion</b> specifies which version of Tornado the back end supports. This string must include the appropriate version number for initialization to proceed.</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="86009"> </a>Next, describe the real-time operating system supported. At present only VxWorks is supported. Possible values for <b class="symbol_lc">rtInfo.cpuType</b> are defined in <i class="textVariable">installDir</i><b class="file">/host/include/cputypes.h</b>. Set the value of <b class="symbol_lc">rtInfo.endian</b> to 1234 or 4321 for big-Endian or little-Endian targets, respectively.</p></dl><dl class="margin"><dd><pre class="Code"><b><a name="86010">    pWdbTgtInfo-&gt;rtInfo.rtType               = WDB_RT_VXWORKS;     pWdbTgtInfo-&gt;rtInfo.rtVersion            = "5.3";     pWdbTgtInfo-&gt;rtInfo.cpuType              = CPU32;     pWdbTgtInfo-&gt;rtInfo.hasFpp               = FALSE;     pWdbTgtInfo-&gt;rtInfo.hasWriteProtect      = 0;     pWdbTgtInfo-&gt;rtInfo.pageSize             = 0xffffffff;      /* The CPU32 target is always Big Endian */     pWdbTgtInfo-&gt;rtInfo.endian          = 1234;      pWdbTgtInfo-&gt;rtInfo.bspName         = "ACE SuperBDM BDM Emulator";     pWdbTgtInfo-&gt;rtInfo.bootline        = NULL;</a></b></pre></dl><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="89416"><b class="symbol_UC"><font face="Helvetica, sans-serif" size="-1" class="sans">NOTE:  </font></b></a><b class="symbol_lc">pWdbTgtInfo-&gt;rtInfo.cpuType</b> is architecture specific.</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="86031"> </a>The target server invokes <b class="routine"><i class="routine">Backend_T::tgtConnect_m</i></b><b>(&nbsp;)</b> to perform any generic target connection work which may be needed. This function parses the target information configuration file by invoking <b class="routine"><i class="routine">Backend_T::tgtInfoGet_m</i></b><b>(&nbsp;)</b>. See the source code in <b class="file">backend.cpp</b> for more information on <b class="routine"><i class="routine">Backend_T::tgtInfoGet_m</i></b><b>(&nbsp;)</b>.</p></dl><dl class="margin"><dd><pre class="Code"><b><a name="86032">    if (Backend_T::tgtConnect_m (pWdbTgtInfo) != WDB_OK)         {         WPWR_LOG_ERR ("Backend_T::tgtConnect_m () failed.\n");         return (WDB_ERR_PROC_FAILED);         }      WPWR_LOG_MSG ("succeeded.\n");      return (WDB_OK);     }</a></b></pre></dl><dl class="margin"><dd><p class="Body"><a name="86043"> </a>Now the skeleton is complete and ready for building and testing.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="86044">Building the Back End on UNIX</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="86046"> </a>Tornado provides makefile stubs, which implement the generic part of a makefile. This facilitates the development and porting of makefiles. Including these stubs in a makefile assures that the generic part of the makefile is correctly implemented in a host-independent fashion.</p></dl></dl><dl class="margin"><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="86047">Building the Back-End Developer's Kit (BEDK) Library</a></i></h5></font><dl class="margin"><dd><p class="Body"><a name="86049"> </a>In order to use the BEDK library you must build this library before building the back end. A makefile and source code for the BEDK are provided in the BEDK directory, <i class="textVariable">installDir</i><b class="file">/host/src/tgtsvr/backend/bedk</b>. The makefile is designed to be host-independent to facilitate porting the BEDK to hosts that are not SunOS 4.1.3.</p></dl><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="86050">Building a New Back End</a></i></h5></font><dl class="margin"><dd><p class="Body"><a name="86051"> </a>Once the BEDK library is built, create a makefile to build the new back end. Use the makefile provided for <b class="keyword">acecpu32</b> as an example. After the usual comments, define the necessary suffixes to build a back-end DLL on your host platform from C++. Inference rules are already defined in the makefile fragments provided by Tornado, but you should define any extra macros which are needed for the back end. The <b class="symbol_UC">ACE_</b><i class="textVariable">XXX </i>macros specify the location of the ACE C API library and header files.</p><dl class="margin"><dl class="margin"><dd><pre class="Code3"><b><a name="86052"># Makefile - for acecpu32 backend ... .SUFFIXES:   .cpp .so .sl ACE_BASE          = /folk/bss/sig/bdm/ace/api/aceapi_1.1 ACE_LD_FLAGS      = -L$(ACE_BASE)/SunOS/lib -lACE68K ACE_INC           = -I$(ACE_BASE)/include</a></b></pre></dl></dl><dd><p class="Body"><a name="86058"> </a><b class="symbol_UC">EXTRA_CFLAGS</b> is a macro provided by the Tornado environment; it is used to specify extra options for the compiler. In this example, the extra option is used to define a macro to specify the CPU type used by the ACE emulator. Also include the makefile stubs provided by Tornado, which define standard macros and rules for building host applications:</p><dl class="margin"><dl class="margin"><dd><pre class="Code3"><b><a name="86059">EXTRA_CFLAGS     = -DACETARGET_68K ... include       $(WIND_BASE)/host/include/make/generic.mh include       $(WIND_BASE)/host/include/make/$(HOST).mh</a></b></pre></dl></dl><dl class="margin"><dd><div class="Indent"><a name="86064"> </a>Because the BEDK library uses Rogue Wave's <b class="library">Tools.h++</b> library, you must define the following macros which specify where <b class="library">Tools.h++</b> is installed:</div><br><dl class="margin"><dd><pre class="Code3"><b><a name="86065">RW_ROOT           = /vobs/devtools/rogue/$(HOST) RW_INC            = -I$(RW_ROOT) RW_LIB            = $(RW_ROOT)/lib/librwtool.a RW_LD_FLAGS       = -L/vobs/devtools/rogue/$(HOST)/lib -lrwtool</a></b></pre></dl></dl><dd><p class="Body"><a name="86071"> </a>Next, define <b class="symbol_UC">INCLUDES</b> to specify the include files location. Define <b class="symbol_UC">BKEND_OBJS</b> to be the list of objects that should be built and linked into the new back end:</p><dl class="margin"><dl class="margin"><dd><pre class="Code3"><b><a name="86072">INCLUDES     = $(WIND_INC) $(WIND_SHARE_INC) $(ACE_INC) $(RW_INC) \              &nbsp;&nbsp;-I$(WIND_BASE)/share/src/agents/bedk \             &nbsp;&nbsp;&nbsp;&nbsp;-I$(GNU_ROOT)/lib/g++include ... BKEND_OBJS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= acecpu32.o acecpu32Backend.o event.o FULL_BKD_OBJS&nbsp;&nbsp;= $(patsubst %.o, $(HOST)/%.o, $(BKEND_OBJS)) ...</a></b></pre></dl></dl><dd><p class="Body"><a name="86079"> </a><b class="symbol_UC">FULL_BKD_OBJS</b> causes the object files to be placed in a subdirectory named after your <i class="textVariable">hostType</i> (on UNIX, the <b class="symbol_UC">WIND_HOST_TYPE</b> environment variable, for example, <b class="symbol_lc">sun4-sunos4</b>).</p><dd><p class="Body"><a name="86080"> </a>Specify the libraries to be linked with the back end, including their path names. The Tornado makefile stub defines a macro <b class="symbol_lc">gnu_</b><b class="symbol_UC">ROOT</b>, which specifies the root of the tree containing the GNU ToolKit used to build the back end. You may need to redefine it for your configuration. If you forget to link a required library with the back end, the target server will crash when it loads the back end. An error message will state which symbol was unresolved. Run <b class="symbol_lc">c++filt</b> or an equivalent tool to demangle the symbol; you can then use <b class="command">nm</b> to determine which library contains that symbol and link the library with the back end.</p><dl class="margin"><dl class="margin"><dd><pre class="Code3"><b><a name="86081">BKEND_LIB_EXTRA =  \     -L../bedk     \     -lbedk        \ 

⌨️ 快捷键说明

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