📄 c-config7.html
字号:
</dl><dd><div class="Item"><a name="86385"> </a>Boot ROM Targets</div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="86386"> </a>Alternate forms of the VxWorks boot program, discussed in <a href="c-config6.html#86079"><i class="title">8.6.2 Executing VxWorks from ROM</i></a>.</div><br></dl></dl></dl><dl class="margin"><dd><p class="Body"><a name="86390"> </a>When you click any of the targets from the categories above, Tornado builds the corresponding object in the BSP directory. Output from the build goes to a <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Build Output</font></b> window, which you can use as a diagnostic aid.</p></dl><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="86392">Rebuilding VxWorks</a></i></h5></font><dl class="margin"><dd><p class="Body"><a name="86393"> </a>To rebuild VxWorks, click the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">vxWorks</font></b> target name under the appropriate <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Make </font></b><i class="textVariable">bspname</i> entry for your target in the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Project</font></b> menu. For example, <a href="c-config7.html#86362">Figure 8-2</a> shows the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">vxWorks</font></b> target selected for the EPC4 BSP. </p><dd><p class="Body"><a name="86397"> </a>You can also rebuild VxWorks from the Windows command prompt (or from a batch file). Change to the <b class="file">config</b> directory for the desired target, and invoke <b class="command">make</b> as follows:</p><dl class="margin"><dd><pre class="Code2"><b><a name="86398"></b><tt class="output">C:\> </tt><b>cd tornado\target\config\<i class="textVariable">bspname </i></b><tt class="output">C:\tornado\target\config\</tt><b><i class="textVariable">bspname</i></b><tt class="output">> </tt><b>make</a></b></pre></dl><dd><p class="Body"><a name="86399"> </a>In either case, <b class="command">make</b> compiles and links modules as necessary, based on the directives in the target directory's <b class="file">Makefile</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="87116"><b class="symbol_UC"><font face="Helvetica, sans-serif" size="-1" class="sans">NOTE: </font></b></a>For the sake of compactness, most examples of calling <b class="command">make</b> in this chapter use the command line; in real practice, the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Project</font></b> menu is usually more convenient. This is true for Windows hosts even if you use the Tornado 1.0.1 methods described in this section. </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="87480"> </a>To rebuild VxWorks when only header files change:</p><dl class="margin"><dd><pre class="Code2"><b><a name="87484">% make clean VxWorks</a></b></pre></dl><dd><p class="Body"><a name="87486"> </a>This regenerate all <b class="file">.o</b> files required by VxWorks. Or:</p><dl class="margin"><dd><pre class="Code2"><b><a name="87489">% make clean % make</a></b></pre></dl><dd><p class="Body"><a name="87492"> </a>The "make clean" removes all existing <b class="file">.o</b> files, and then "make" recreates the new <b class="file">.o</b> files required by VxWorks.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="87131">8.7.3 Including Customized VxWorks Code</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="86411"> </a><b></b>The directory <i class="textVariable">installDir</i><b class="file">/target/target/src/usr </b>contains the source code for certain portions of VxWorks that you may wish to customize. For example, <b class="file">usrLib.c</b> is a popular place to add target-resident routines that provide application-specific development aids. For a summary of other files in this directory, see the <i class="title">Tornado User's Guide: Directories and Files</i>. </p><dd><p class="Body"><a name="86415"> </a>If you modify one of these files, an extra step is necessary before rebuilding your VxWorks image: you must replace the modified object code in the appropriate VxWorks archive. The <b class="file">Makefile</b> in <i class="textVariable">installDir</i><b class="file">/target/target/src/usr</b> automates the details; however, because this directory is not specific to a single architecture, you must specify the value of the <b class="symbol_UC">CPU</b> variable on the <b class="command">make</b> command line:</p><dl class="margin"><dd><pre class="Code2"><b><a name="86416"></b><tt class="output">% </tt><b>make CPU=<i class="textVariable">cputype</i> </a></b></pre></dl><dd><p class="Body"><a name="86417"> </a>If you do this frequently on a Windows host, you can record the <b class="symbol_UC">CPU</b> definition in the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Build Target</font></b> field of a custom command in the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Project</font></b> menu; see <i class="title">Tornado User's Guide: Customization</i>.</p><dd><p class="Body"><a name="86418"> </a>This step recompiles all modified files in the directory, and replaces the corresponding object code in the appropriate architecture-dependent directory. After that, the next time you rebuild VxWorks, the resulting system image includes your modified code.</p><dd><p class="Body"><a name="86419"> </a>The following example illustrates replacing <b class="library">usrLib</b> with a modified version, rebuilding the archives, and then rebuilding the VxWorks system image. For the sake of conciseness, the <b class="command">make</b> output is not shown. The example assumes the <b class="file">epc4</b> (<b class="symbol_UC">I80386</b>) BSP; replace the BSP directory name and <b class="symbol_UC">CPU</b> value as appropriate for your environment. (On a Windows host, use <b class="command">copy</b> instead of the UNIX <b class="command">cp</b>.)</p><dl class="margin"><dd><pre class="Code2"><b><a name="86420"></b><tt class="output">% </tt><b>cd ${WIND_BASE}/target/src/usr </b><tt class="output">% </tt><b>cp usrLib.c usrLib.c.orig </b><tt class="output">% </tt><b>cp <i class="textVariable">develDir</i>/usrLib.c usrLib.c </b><tt class="output">% </tt><b>make CPU=I80386 </b><tt class="output">...</tt><b></a></b><dd> <b><a name="86421"></b><tt class="output">% </tt><b>cd ${WIND_BASE}/target/config/epc4 </b><tt class="output">% </tt><b>make </b><tt class="output">...</tt><b></a></b></pre></dl></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="86422">8.7.4 Linking the System Modules</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="86424"> </a>The commands to link a VxWorks system image are somewhat complicated. Fortunately, it is not necessary to understand those commands in detail because the <b class="file">Makefile </b>in each VxWorks target directory includes the necessary commands. However, for completeness, this section gives an explanation of the flags and parameters used to link VxWorks.</p><dd><p class="Body"><a name="86426"> </a>VxWorks operating system modules are distributed in the form of an archive library for each target architecture. The library is <i class="textVariable">installDir</i><b class="file">/target/lib/lib</b><i class="textVariable">cpu</i><b class="file">gnuvx.a</b>.</p><dd><p class="Body"><a name="86427"> </a>These modules are combined with the configuration module <b class="file">usrConfig.o</b> by the <b class="command">ld</b><i class="textVariable">arch</i> command on the host. (<b class="library">usrConfig.c</b> is described in <i class="title"></i><a href="c-config5.html#89502"><i class="title">8.5.3 The Configuration Module: usrConfig.c</i></a>.) The following is an example command for linking a VxWorks system using the GNU linker for the MC680<i class="textVariable">x</i>0:</p><dl class="margin"><dd><pre class="Code2"><b><a name="86431">ld68k -o vxWorks -X -N -Ttext 1000 -e _sysInit sysALib.o sysLib.o \ usrConfig.o version.o /tornado/target/lib/lib<i class="textVariable">cpu</i>gnuvx.a</a></b></pre></dl><dd><p class="Body"><a name="86433"> </a>The meanings of the flags in this command are as follows:</p></dl><dl class="margin"><dd><div class="Item"><a name="86434"> </a><b class="command">-o</b> <b class="file">vxWorks </b></div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="86435"> </a>name the output object module <b class="file">vxWorks</b>.</div><br></dl></dl><dd><div class="Item"><a name="86436"> </a><b class="command">-X</b></div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="86437"> </a>eliminate some compiler-generated symbols from the symbol table.</div><br></dl></dl><dd><div class="Item"><a name="86438"> </a><b class="command">-N</b></div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="86439"> </a>do not configure the output object module for a virtual-memory system.</div><br></dl></dl><dd><div class="Item"><a name="86440"> </a><b class="command">-Ttext 1000</b></div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="86441"> </a>specify the relocation address as a hexadecimal constant; in this example, 1000 hexadecimal. This is the address where the system must be loaded in the target, and is also the address where execution starts. Some target systems have limitations on where this relocation address can be.</div><br></dl></dl><dd><div class="Item"><a name="86442"> </a><b class="command">-e _sysInit </b></div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="86443"> </a>define the entry point to <b class="file">vxWorks</b>. <b class="routine"><i class="routine">sysInit</i></b><b>( )</b> is the first routine in <b class="file">sysALib.o</b>, which is the first module loaded by <b class="command">ld</b><i class="textVariable">arch</i>.</div><br></dl></dl><dd><div class="Item"><a name="86444"> </a><b class="file">sysALib.o</b> and <b class="file">sysLib.o</b> </div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="86445"> </a>modules that contain CPU-dependent initialization and support routines. The module <b class="file">sysALib.o</b> must be the first module specified in the <b class="command">ld</b><i class="textVariable">arch</i> command.</div><br></dl></dl><dd><div class="Item"><a name="86446"> </a><b class="file">usrConfig.o</b></div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="86449"> </a>the configuration module (described in detail in <i class="title"></i><a href="c-config5.html#89502"><i class="title">8.5.3 The Configuration Module: usrConfig.c</i></a>). If you have several different system configurations, you may maintain several different configuration modules, either in <i class="textVariable">installDir</i><b class="file">/target</b> or in your own directory.</div><br></dl></dl><dd><div class="Item"><a name="86451"> </a><b class="file">version.o</b></div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="86452"> </a>a module that defines the creation date and version number of this <b class="file">vxWorks</b> object module. It is created by compiling the output of <b class="command">makeVersion</b>, an auxiliary tool in the <i class="textVariable">installDir</i><b class="file">/host/</b><i class="textVariable">host</i><b class="file">-</b><i class="textVariable">os</i><b class="file">/bin</b> directory.</div><br></dl></dl><dd><div class="Item"><a name="86453"> </a><i class="textVariable">installDir</i><b class="file">/target/lib/lib</b><i class="textVariable">cpu</i><b class="file">gnuvx.a</b> </div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="86454"> </a>the archive library that contains all the VxWorks modules.</div><br></dl></dl><dd><div class="Item"><a name="86455"> </a>Additional object modules:</div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="86457"> </a>You can link additional object modules (with <b class="file">.o</b> suffix) into the run-time VxWorks system by naming them on the <b class="command">ld</b><i class="textVariable">arch</i> command line. An easy way to do this is to use the variable <b class="symbol_UC">MACH_EXTRA</b> in the BSP makefiles. Define this variable and list the object modules to be linked with VxWorks. Note that during development, application object modules are generally not linked with the system (unless they are needed by the <b class="library">usrConfig</b> module), because it is more convenient to load them incrementally from the host, after booting VxWorks. See <a href="c-config9.html#86670"><i class="title">8.9 Creating Bootable Applications</i></a> for more detail on linking application modules in a bootable system.</div><br><dd><div class="Indent2"><a name="86463"> </a>i960 systems require additional Intel libraries, which are listed in the makefiles for i960 BSPs.</div><br></dl></dl></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="91042">8.7.5 Creating the System Symbol Table Module</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="91044"> </a>The Tornado target server uses the VxWorks symbol table on the host system, both for dynamic linking and for symbolic debugging. The symbol table file is created by the supplied tool <b class="command">xsym</b>. Processing an object module with <b class="command">xsym</b> creates a new object module that contains all the symbols of the original file, but with no code or data. The line in <b class="file">Makefile</b> that creates this file executes the command as follows:</p><dl class="margin"><dd><pre class="Code2"><b><a name="86469">xsym < vxWorks > vxWorks.sym</a></b></pre></dl><dd><p class="Body"><a name="86471"> </a>The file <b class="file">vxWorks.sym</b> is the symbol table that the target server loads when it begins executing.</p></dl></dl><a name="foot"><hr></a><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="c-config.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="c-config6.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="c-config8.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 + -