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

📄 cross_compiling.html

📁 ADI 公司blackfin系列的用户使用文挡。
💻 HTML
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head>  <title></title>  <link rel="stylesheet" media="screen" type="text/css" href="./style.css" />  <link rel="stylesheet" media="screen" type="text/css" href="./design.css" />  <link rel="stylesheet" media="print" type="text/css" href="./print.css" />  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body><a href=start.html>start</a></br><div class="toc"><div class="tocheader toctoggle" id="toc__header">Table of Contents</div><div id="toc__inside"><ul class="toc"><li class="clear"><ul class="toc"><li class="level2"><div class="li"><span class="li"><a href="#cross_compiling" class="toc">Cross Compiling</a></span></div><ul class="toc"><li class="level3"><div class="li"><span class="li"><a href="#using_configure" class="toc">Using configure</a></span></div></li><li class="level3"><div class="li"><span class="li"><a href="#integrating_external_user_space_applications_into_the_uclinux_build_system" class="toc">Integrating External User Space Applications into the uClinux Build System</a></span></div></li></ul></li></ul></li></ul></div></div><h2><a name="cross_compiling" id="cross_compiling">Cross Compiling</a></h2><div class="level2"><p>Cross compiling refers to compiling source code on one platform (e.g. Linux x86 desktop) for execution on another platform (e.g. Blackfin).  Because the target hardware is different, the standard gcc toolchain for x86 Linux cannot be used; this is why the Blackfin toolchain is required to compile U-Boot, uClinux, or any other program whose target is a Blackfin device.  Information on installing the Blackfin toolchain is given in the section below.</p><p>The key to select the correct cross compiler is the fact that each system uses a unique  prefix. This means that, for the Blackfin, <strong>gcc</strong> becomes <strong>bfin-elf-gcc</strong> or <strong>bfin-uclinux-gcc</strong>. The same prefix (<strong>bfin-elf-</strong>) is added to all the tools generated for the selected system. Once <strong>gcc</strong> has been invoked using a prefix it adds the same prefix to all the other toolchain components used to generate a system.</p><p>The uClinux Distribution and the Linux kernel sources use a variable <strong>CROSS_COMPILE</strong> which is defined in the <strong>config.arch</strong> file in the <strong>vendors/config/bfin</strong> directory.</p><p>Here is an example:</p><pre class="code c">CROSS_COMPILE = bfin-uclinux-CC            = $<span class="br0">&#40;</span>CROSS_COMPILE<span class="br0">&#41;</span>gcc $<span class="br0">&#40;</span>CPUFLAGS<span class="br0">&#41;</span></pre></div><!-- SECTION [1-1189] --><h3><a name="using_configure" id="using_configure">Using configure</a></h3><div class="level3"><p> When using a <strong>configure</strong> script to set up a source package for a cross compiled system it quite often works if you define <strong>CROSS_COMPILE=bfin-uclinux-</strong> and then use the configure system. For example: </p><pre class="code">    CROSS_COMPILE=bfin-uclinux- ./configure</pre><p> sometimes this is needed  </p><pre class="code">    CC=bfin-uclinux-gcc ./configure</pre><p> This will set up the package to be built on a development host for a cross compiled target.</p></div><!-- SECTION [1190-1626] --><h3><a name="integrating_external_user_space_applications_into_the_uclinux_build_system" id="integrating_external_user_space_applications_into_the_uclinux_build_system">Integrating External User Space Applications into the uClinux Build System</a></h3><div class="level3"><p> Follow the section on adding a simple <strong>Hello World</strong> application <a href="simple_hello_world_application_example.html" class="wikilink1" title="simple_hello_world_application_example.html">simple hello world application example</a></p><p> In most cases using the compiler definition and then <strong>configure</strong> will produce a  system buildable for the selected targets.</p><p>You may have to consider the following points </p><ul><li class="level1"><div class="li"> include file directories should be modified to point to those used by the Distribution. This can normally done in the Application Makefile</div></li><li class="level1"><div class="li"> the uClinux Distribution libraries should be used instead of <strong>glibc</strong> </div></li><li class="level1"><div class="li"> <strong>uClibc</strong> contains most of the needed components from <strong>glibc</strong> but you may find one or two components missing. Here you have a couple of options.</div><ol><li class="level2"><div class="li"> Rework the package source to use available library components</div></li><li class="level2"><div class="li"> Add the missing components to <strong>uClibc</strong></div></li></ol></li></ul><p> Some source packages are designed to work as <strong>daemons</strong> and immediately use the <strong>fork</strong> system call to put themselves in the background. The <strong>fork</strong> system call is not available under <strong>uClinux</strong> since we don&rsquo;t have a <strong>MMU</strong> to provide memory mapping. In these cases it is often possible to remove the <strong>fork</strong> system call and run the program in the background from the shell using the <strong>&amp;</strong> operator.</p><p>Example </p><pre class="code"> myprog &amp;</pre><p> Other cases the <strong>fork</strong> may be replaced by a <strong>vfork</strong> call. See the  <a href="living_without_forks.html" class="wikilink1" title="living_without_forks.html">living without forks</a> page for more details. </p></div><!-- SECTION [1627-] --></body></html>

⌨️ 快捷键说明

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