📄 x-sparc2.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><link rel="STYLESHEET" type="text/css" href="wrs.css"><title> Sun SPARC, SPARClite </title></head><body bgcolor="FFFFFF"><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-sparc.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="x-sparc1.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="x-sparc3.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p><font face="Helvetica, sans-serif" class="sans"><h3 class="H2"><i><a name="84381">B.2 Building Applications</a></i></h3></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84382"> </a>The Tornado 2.0 project facility is correctly preconfigured for building WRS BSPs. However, if you choose not to use the project facility or if you need to customize your build, you may need the information in the following sections. This includes a configuration constant, an environment variable, and compiler options that together specify the information the GNU toolkit requires to compile correctly for SPARC and SPARClite targets. </p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="84385">Defining the CPU Type</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84386"> </a>Setting the preprocessor variable <b class="symbol_UC">CPU</b> ensures that VxWorks and your applications build with the appropriate architecture-specific features enabled. Define this variable to <b class="symbol_UC">SPARC</b> for both the SPARC and SPARClite processors.</p><dd><p class="Body"><a name="84387"> </a>For example, to define <b class="symbol_UC">CPU</b> for a SPARC on the compiler command line, specify the following command-line option when you invoke the compiler:</p><dl class="margin"><dd><pre class="Code2"><b><a name="84388">-DCPU=SPARC</a></b></pre></dl><dd><p class="Body"><a name="84389"> </a>To provide the same information in a header or source file instead, include the following line in the file:</p><dl class="margin"><dd><pre class="Code2"><b><a name="84390">#define CPU SPARC</a></b></pre></dl></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="84392">Configuring the GNU ToolKit Environment</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84393"> </a>Tornado includes the GNU compiler and associated tools. Tornado is configured to use these tools by default. No change is required to the execution path, because the compilation chain is installed in the same <b class="file">bin</b> directory as the other Tornado executables. </p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="84395">Compiling C or C++ Modules</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84396"> </a>The following is an example of a compiler command line for SPARClite cross-development. The file to be compiled in this example has a base name of <b class="file">applic</b>.</p><dl class="margin"><dd><pre class="Code2"><b><a name="84397"></b><tt class="output">% </tt><b>ccsparc -DCPU=SPARC -I $WIND_BASE/target/h -O2 -nostdinc \ -fno-builtin -msparclite -msoft-float -c applic.<i class="textVariable">language_id</i></a></b></pre></dl><dd><p class="Body"><a name="84401"> </a>The options shown in the example have the following meanings:<sup><a href="#foot"><b class="FootnoteMarker">1</b></a></sup></p></dl><dl class="margin"><dd><div class="Item"><a name="84403"> </a><b class="symbol_UC">-DCPU=SPARC</b> </div><dl class="margin"><dd><div class="Indent"><a name="84404"> </a>Required; defines the CPU type. Use <b class="symbol_UC">SPARClite</b> for SPARClite processors.</div><br></dl><dd><div class="Item"><a name="84406"> </a><b class="command">-I</b><b class="symbol_UC"> $WIND_BASE</b><b class="file">/target/h</b><b class="command"> </b></div><dl class="margin"><dd><div class="Indent"><a name="84407"> </a>Required; includes VxWorks header files. (Additional <b class="command">-I</b> flags may be included to specify other header files.)</div><br></dl><dd><div class="Item"><a name="84409"> </a><b class="command">-O2</b> </div><dl class="margin"><dd><div class="Indent"><a name="84410"> </a>Optional; performs level 2 optimization.</div><br></dl><dd><div class="Item"><a name="84412"> </a><b class="command">-nostdinc</b> </div><dl class="margin"><dd><div class="Indent"><a name="84413"> </a>Required; searches only the directory(ies) specified with the <b class="command">-I</b> flag (see above) and the current directory for header files. Does not search host-system include files.</div><br></dl><dd><div class="Item"><a name="84415"> </a><b class="command">-fno-builtin</b> </div><dl class="margin"><dd><div class="Indent"><a name="84416"> </a>Required; uses library calls even for common library subroutines.</div><br></dl><dd><div class="Item"><a name="84418"> </a><b class="command">-msparclite</b> </div><dl class="margin"><dd><div class="Indent"><a name="84419"> </a>Required for SPARClite; generates SPARClite-specific code. </div><br></dl><dd><div class="Item"><a name="84421"> </a><b class="command">-msoft-float</b> </div><dl class="margin"><dd><div class="Indent"><a name="84422"> </a>Optional; generates software floating point library calls, rather than hardware floating point instructions. For more information, see <a href="x-sparc4.html#84870"><i class="title">USS Floating-Point Emulation Library</i></a>,</div><br></dl><dd><div class="Item"><a name="84427"> </a><b class="command">-c</b> </div><dl class="margin"><dd><div class="Indent"><a name="84428"> </a>Required; specifies that the module is to be compiled only, and not linked for execution under the host.</div><br></dl><dd><div class="Item"><a name="84430"> </a><b class="file">applic.</b><i class="textVariable">language_id </i></div><dl class="margin"><dd><div class="Indent"><a name="84431"> </a>Required; the file(s) to compile. For C compilation, specify a suffix of <b class="file">.c</b>. For C++ compilation, specify a suffix of <b class="file">.cpp</b>. The output is an unlinked object module in <b class="file">a.out</b> format with the suffix <b class="file">.o</b>; for the example, the output is <b class="file">applic.o</b>.</div><br><dd><div class="Indent"><a name="84432"> </a>During 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 can use to call the objects' constructors and destructors. See the <i class="title">VxWorks Programmer's Guide: C++ Development </i>for details<b></b></div><br></dl></dl></dl><a name="foot"><hr></a><p class="FootnoteNumberMarker">1: <span class="Footnote"><a name="84400"> </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; a list of these options is included in the <i class="title">Guide</i>. 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-sparc.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="x-sparc1.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="x-sparc3.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 + -