📄 x-mips2.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><link rel="STYLESHEET" type="text/css" href="wrs.css"><title> MIPS R3000, R4000, R4650 </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-mips.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="x-mips1.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="x-mips3.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="84380">E.2 Building Applications</a></i></h3></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84381"> </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 the MIPS targets.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="84383">Defining the CPU Type</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84384"> </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 be <b class="symbol_UC">R3000</b> (for the MIPS R3000 or R3500), <b class="symbol_UC">R4000</b> (for the R4200 or R4600), or <b class="symbol_UC">R4650</b> (for the MIPS R4640 or R4650).</p><dd><p class="Body"><a name="84385"> </a>For example, to define <b class="symbol_UC">CPU</b> for an R3500 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="84386">-DCPU=R3000</a></b></pre></dl><dd><p class="Body"><a name="84387"> </a>To provide the same information in a header or source file, include the following line in the file:</p><dl class="margin"><dd><pre class="Code2"><b><a name="84388">#define CPU R3000</a></b></pre></dl><dd><p class="Body"><a name="84389"> </a>All VxWorks makefiles pass along the definition of this variable to the compiler. You can define <b class="symbol_UC">CPU</b> on the <b class="command">make</b> command line as follows:</p><dl class="margin"><dd><pre class="Code2"><b><a name="84391"></b><tt class="output">%</tt><b> make CPU=R3000 ...</a></b></pre></dl><dd><p class="Body"><a name="84392"> </a>You can also set the definition directly in a makefile, with the following line:</p><dl class="margin"><dd><pre class="Code2"><b><a name="84393">CPU=R3000</a></b></pre></dl></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="84396">Configuring the GNU ToolKit Environment</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84397"> </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="84399">Compiling C or C++ Modules</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84400"> </a>The following is an example of a compiler command line for R3000 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="84401"></b><tt class="output">% </tt><b>ccmips -DCPU=R3000 -I/usr/vw/h -mcpu=r3000 -O2 -funroll-loops \ -nostdinc -G 0 -c applic.c</a></b></pre></dl><dd><p class="Body"><a name="84402"> </a>This is an example for the R4000:</p><dl class="margin"><dd><pre class="Code2"><b><a name="84403"></b><tt class="output">% </tt><b>ccmips -DCPU=R4000 -I/usr/vw/h -mcpu=r4000 -mips3 -mgp32 \ -mfp32 -O2 -funroll-loops -nostdinc -G 0 -c applic.c</a></b></pre></dl><dd><p class="Body"><a name="84407"> </a>The options shown in the examples 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="84409"> </a><b class="symbol_UC">-DCPU=R3000</b> </div><dl class="margin"><dd><div class="Indent"><a name="84410"> </a>Required; defines the CPU type for the R3000 or R3500. For the R4200 or R4600, specify<b class="symbol_UC"> R4000</b>. For the R4640 or R4650, specify <b class="symbol_UC">R4650</b>.</div><br></dl><dd><div class="Item"><a name="84412"> </a><b class="command">-I </b><b class="symbol_UC">$WIND_BASE</b><b class="command">/target/h</b> </div><dl class="margin"><dd><div class="Indent"><a name="84413"> </a>Required; gives access to the VxWorks include files. (Additional <br><b class="command">-I</b> flags may be included to specify other header files.)</div><br></dl><dd><div class="Item"><a name="84415"> </a><b class="command">-mcpu=r3000</b> </div><dl class="margin"><dd><div class="Indent"><a name="84416"> </a>Required; tells the compiler to produce code for the R3000 or R3500. For the R4200 or R4600, specify <b class="command">r4000</b>. For the R4640 or R4650, specify <b class="command">r4650</b>.</div><br></dl><dd><div class="Item"><a name="84418"> </a><b class="command">-mips3</b> </div><dl class="margin"><dd><div class="Indent"><a name="84419"> </a>Required for R4000 targets (R4200 and R4600) and R4650 targets (R4640 and R4650); tells the compiler to issue instructions from level 3 of the MIPS ISA (64-bit instructions). This compiler option does not apply to R3000 or R3500 targets.</div><br></dl><dd><div class="Item"><a name="84421"> </a><b class="command">-mfp32</b> </div><dl class="margin"><dd><div class="Indent"><a name="84422"> </a>Required for R4000 and R4650 targets; tells compiler to issue instructions assuming that fp registers are 32 bits, required for compatibility with <b class="library">mathALib</b>.</div><br></dl><dd><div class="Item"><a name="84424"> </a><b class="command">-mgp32</b> </div><dl class="margin"><dd><div class="Indent"><a name="84425"> </a>Required for R4000 and R4650 targets in code which makes calls to varargs functions provided by VxWorks (<b class="routine"><i class="routine">printf</i></b><b>( )</b>, <b class="routine"><i class="routine">sprintf</i></b><b>( )</b>, and so forth); tells the compiler to issue instructions assuming that all general-purpose registers are 32 bits.</div><br></dl><dd><div class="Item"><a name="84427"> </a><b class="command">-msingle-float</b> </div><dl class="margin"><dd><div class="Indent"><a name="84428"> </a>Required for R4640 and R4650; tells the compiler to assume that the floating-point processor supports only single-precision operations.</div><br></dl><dd><div class="Item"><a name="84430"> </a><b class="command">-m4650</b> </div><dl class="margin"><dd><div class="Indent"><a name="84434"> </a>Required for R4650 targets; sets <b class="command">-msingle-float</b> and <b class="command">-mmad<sup><a href="#foot"><b class="FootnoteMarker">2</b></a></sup></b> flags.</div><br></dl><dd><div class="Item"><a name="84436"> </a><b class="command">-O2</b> </div><dl class="margin"><dd><div class="Indent"><a name="84437"> </a>Optional; tells the compiler to use level 2 optimization.</div><br></dl></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="84881"><b class="symbol_UC"><font face="Helvetica, sans-serif" size="-1" class="sans">NOTE: </font></b></a>To specify optimization for use with GDB, use the <b class="command">-O0</b> flag. </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><div class="Item"><a name="84450"> </a><b class="command">-funroll-loops</b> </div><dl class="margin"><dd><div class="Indent"><a name="84451"> </a>Optional; tells the compiler to use loop unrolling optimization.</div><br></dl><dd><div class="Item"><a name="84453"> </a><b class="command">-nostdinc</b> </div><dl class="margin"><dd><div class="Indent"><a name="84454"> </a>Required; searches only the directories specified with the <b class="command">-I</b> flag (see above) and the current directory for header files.</div><br></dl><dd><div class="Item"><a name="84456"> </a><b class="command">-msoft-float</b> </div><dl class="margin"><dd><div class="Indent"><a name="84457"> </a>Required for software emulation, tells the compiler to issue library callouts for floating point. For more information, see <a href="x-mips4.html#84684"><i class="title">Floating-Point Support</i></a>.</div><br></dl><dd><div class="Item"><a name="84462"> </a><b class="command">-G 0</b> </div><dl class="margin"><dd><div class="Indent"><a name="84463"> </a>Required; tells the compiler not to use the global pointer. For more information, see <a href="x-mips4.html#84672"><i class="title">Gprel Addressing</i></a>.</div><br></dl><dd><div class="Item"><a name="84468"> </a><b class="command">-c</b> </div><dl class="margin"><dd><div class="Indent"><a name="84469"> </a>Required; specifies that the module is to be compiled only, not linked for execution under the host. </div><br><dd><div class="Indent"><a name="84470"> </a>The output is an unlinked object module in <b class="symbol_UC">ELF</b> format with the suffix <b class="file">.o</b>; for the example above, the output would be <b class="file">applic.o</b>.</div><br></dl></dl><dl class="margin"><dd><p class="Body"><a name="84472"> </a>The default for <b class="command">ccmips</b> is big-endian (set explicitly with <b class="command">-EB</b>) and defines <b class="symbol_UC">MIPSEB</b>. Tornado does not support little-endian; do not use <b class="command">-EL</b>. Users should not define either <b class="symbol_UC">MIPSEB</b> or <b class="symbol_UC">MIPSEL</b>. </p></dl></dl><a name="foot"><hr></a><p class="FootnoteNumberMarker">1: <span class="Footnote"><a name="84406"> </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="FootnoteNumberMarker">2: <span class="Footnote"><a name="84433"> </a>Consult <i class="title">GNU Toolkit User's Guide</i>.</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-mips.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="x-mips1.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="x-mips3.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 + -