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

📄 build.make.html

📁 有关ecos2。0介绍了实时嵌入式的结构以及线程调度的实现和内存的管理等
💻 HTML
📖 第 1 页 / 共 4 页
字号:
><TR><TD><PRECLASS="PROGRAMLISTING">cdl_component CYGBLD_GLOBAL_OPTIONS {    flavor  none    parent  CYGPKG_NONE    &#8230;    cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX {        flavor  data        default_value { "arm-elf" }        &#8230;    }    cdl_option CYGBLD_GLOBAL_CFLAGS {        flavor  data        default_value "-Wall -g -O2 &#8230;"        &#8230;    }    cdl_option CYGBLD_GLOBAL_LDFLAGS {        flavor  data        default_value "-g -nostdlib -Wl,--gc-sections &#8230;"        &#8230;    }}</PRE></TD></TR></TABLE><P>The <TTCLASS="VARNAME">CYGBLD_GLOBAL_OPTIONS</TT> component serves tocollect together all global build-related options. It has the flavor<TTCLASS="LITERAL">none</TT> since disabling all of these options wouldmake it impossible to build anything and hence is not useful. It isparented immediately below the root of the configuration hierarchy,thus making sure that it is readily accessible in the graphicalconfiguration tool and, for command line users, in the<TTCLASS="FILENAME">ecos.ecc</TT> save file.</P><DIVCLASS="NOTE"><BLOCKQUOTECLASS="NOTE"><P><B>Note: </B>Currently the <SPANCLASS="PROPERTY">parent</SPAN> property lists a parent of<TTCLASS="VARNAME">CYGPKG_NONE</TT>, rather than an empty string. Thiscould be unfortunate if there was ever a package with that name. Theissue will be addressed in a future release of the componentframework.</P></BLOCKQUOTE></DIV><P>The option <TTCLASS="VARNAME">CYGBLD_GLOBAL_COMMAND_PREFIX</TT> defineswhich tools should be used for the current target. Typically this isdetermined by the processor on the target hardware. In some cases agiven target board may be able to support several differentprocessors, in which case the <SPANCLASS="PROPERTY">default_value</SPAN> expression could selecta different toolchain depending on some other option that is used tocontrol which particular processor.<TTCLASS="VARNAME">CYGBLD_GLOBAL_COMMAND_PREFIX</TT> is modifiable ratherthan calculated, so users can override this when necessary.</P><P>Given a command prefix such as <TTCLASS="LITERAL">arm-elf</TT>, all Csource files will be compiled with <TTCLASS="LITERAL">arm-elf-gcc</TT>, allC++ sources will be built using <TTCLASS="LITERAL">arm-elf-g++</TT>,and <TTCLASS="LITERAL">arm-elf-ar</TT> will be used to generate thelibrary. This is in accordance with the usual naming conventions forGNU cross-compilers and similar tools. For the purposes of custombuild steps, tokens such as <TTCLASS="LITERAL">$(CC)</TT> will be set to<TTCLASS="LITERAL">arm-elf-gcc</TT>.</P><P>The next option, <TTCLASS="VARNAME">CYGBLD_GLOBAL_CFLAGS</TT>, is used toprovide the initial value of <TTCLASS="LITERAL">$(CFLAGS)</TT>. Somecompiler flags such as <TTCLASS="LITERAL">-Wall</TT> and<TTCLASS="LITERAL">-g</TT> are likely to be used on all targets. Otherflags such as <TTCLASS="LITERAL">-mcpu=arm7tdmi</TT> will betarget-specific. Again this is a modifiable option, so the user canswitch from say <TTCLASS="LITERAL">-O2</TT> to <TTCLASS="LITERAL">-Os</TT> ifdesired. The option <TTCLASS="VARNAME">CYGBLD_GLOBAL_LDFLAGS</TT> servesthe same purpose for <TTCLASS="LITERAL">$(LDFLAGS)</TT> and linking. It isused primarily when building test cases or possibly for some custombuild steps, since building eCos itself generally involves buildingone or more libraries rather than executables.</P><P>Some packages may wish to add certain flags to the global set, orpossibly remove some flags. This can be achieved by havingappropriately named options in the package, for example:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cdl_component CYGPKG_KERNEL_OPTIONS {    display "Kernel build options"    flavor  none    &#8230;    cdl_option CYGPKG_KERNEL_CFLAGS_ADD {        display "Additional compiler flags"        flavor  data        default_value { "" }        &#8230;    }    cdl_option CYGPKG_KERNEL_CFLAGS_REMOVE {        display "Suppressed compiler flags"        flavor  data        default_value { "" }        &#8230;    }    cdl_option CYGPKG_KERNEL_LDFLAGS_ADD {        display "Additional linker flags"        flavor  data        default_value { "" }        &#8230;    }    cdl_option CYGPKG_KERNEL_LDFLAGS_REMOVE {        display "Suppressed linker flags"        flavor  data        default_value { "" }        &#8230;    }}</PRE></TD></TR></TABLE><P>In this example the kernel does not modify the global compiler flagsby default, but it is possible for the users to modify the options ifdesired. The value of <TTCLASS="LITERAL">$(CFLAGS)</TT> that is used forthe compilations and custom build steps in a given package isdetermined as follows:</P><P></P><OLTYPE="1"><LI><P>Start with the global settings from<TTCLASS="VARNAME">CYGBLD_GLOBAL_CFLAGS</TT>, for example<TTCLASS="LITERAL">-g&nbsp;-O2</TT>.</P></LI><LI><P>Remove any flags specified in the per-package<TTCLASS="LITERAL">CFLAGS_REMOVE</TT> option, if any. For exampleif <TTCLASS="LITERAL">-O2</TT> should be removed for this package then<TTCLASS="LITERAL">$(CFLAGS)</TT> would now have a value of just<TTCLASS="LITERAL">-g</TT>.</P></LI><LI><P>Then concatenate the flags specified by the per-package<TTCLASS="LITERAL">CFLAGS_ADD</TT> option, if any. For example if<TTCLASS="LITERAL">-Os</TT> should be added for the current package thenthe final value of <TTCLASS="LITERAL">$(CFLAGS)</TT> will be<TTCLASS="LITERAL">-g&nbsp;-Os</TT>.</P></LI></OL><P><TTCLASS="LITERAL">$(LDFLAGS)</TT> is determined in much the same way.</P><DIVCLASS="NOTE"><BLOCKQUOTECLASS="NOTE"><P><B>Note: </B>The way compiler flags are handled at present has numerous limitationsthat need to be addressed in a future release, although it shouldsuffice for nearly all cases. For the time being custom build stepsand in particular the <SPANCLASS="PROPERTY">make_object</SPAN> property can be used to workaround the limitations.</P><P>Amongst the issues, there is a specific problem with packageencapsulation. For example the math library imposes some stringentrequirements on the compiler in order to guarantee exact IEEEbehavior, and may need special flags on a per-architecture basis. Oneway of handling this is to have<TTCLASS="VARNAME">CYGPKG_LIBM_CFLAGS_ADD</TT> and<TTCLASS="VARNAME">CYGPKG_LIBM_CFLAGS_REMOVE</TT> <SPANCLASS="PROPERTY">default_value</SPAN>expressions which depend on the target architecture, but suchexpressions may have to updated for each new architecture. Analternative approach would allow the architectural HAL package tomodify the <SPANCLASS="PROPERTY">default_value</SPAN> expressions for the math library, but thisbreaks encapsulation. A third approach would allow some architecturalHAL packages to define one or more special options with well-knownnames, and the math library could check if these options were definedand adjust the default values appropriately. Other packages withfloating point requirements could do the same. This approach also hasscalability issues, in particular how many such categories of optionswould be needed? It is not yet clear how best to resolve such issues.</P></BLOCKQUOTE></DIV><DIVCLASS="NOTE"><BLOCKQUOTECLASS="NOTE"><P><B>Note: </B>When generating a build tree it would be desirable for the componentframework to output details of the tools and compiler flags in aformat that can be re-used for application builds, for example amakefile fragment. This would make it easier for applicationdevelopers to use the same set of flags as were used for building eCositself, thus avoiding some potential problems with incompatiblecompiler flags.</P></BLOCKQUOTE></DIV></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="BUILD.CUSTOM">Custom Build Steps</H2><DIVCLASS="CAUTION"><P></P><TABLECLASS="CAUTION"BORDER="1"WIDTH="100%"><TR><TDALIGN="CENTER"><B>Caution</B></TD></TR><TR><TDALIGN="LEFT"><P>Some of the details of custom build steps as described below aresubject to change in future revisions of the component framework,although every reasonable attempt will be made to avoid breakingbackwards compatibility.</P></TD></TR></TABLE></DIV><P>For most packages simply listing one or more source files in a<SPANCLASS="PROPERTY">compile</SPAN> property is sufficient. These files will get built using theappropriate compiler and compiler flags and added to a library, whichthen gets linked with application code. A package that can be built inthis way is likely to be more portable to different targets and buildenvironments, since it avoids build-time dependencies. However somepackages have special needs, and the component framework supportscustom build steps to allow for these needs. There are two propertiesrelated to this, <SPANCLASS="PROPERTY">make</SPAN> and <SPANCLASS="PROPERTY">make_object</SPAN>, and both take the followingform:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">    make {        &lt;target_filepath&gt; : &lt;dependency_filepath&gt; &#8230;            &lt;command&gt;            ...    }</PRE></TD></TR></TABLE><P>Although this may look like makefile syntax, and although some buildenvironments will indeed involve generating makefiles and running<SPANCLASS="APPLICATION">make</SPAN>, this is notguaranteed. It is possible for the component framework to beintegrated with some other build system, and custom build steps shouldbe written with that possibility in mind. Each custom build stepinvolves a target, some number of dependency files, and some number ofcommands. If the target is not up to date with respect to one or moreof the dependencies then the commands need to be executed.</P><P></P><OLTYPE="a"><LI><P>Only one target can be specified. For a <SPANCLASS="PROPERTY">make_object</SPAN> property thistarget must be an object file. For a <SPANCLASS="PROPERTY">make</SPAN> property it can be anyfile. In both cases it must refer to a physical file, the use ofphony targets is not supported. The target should not be an absolutepath name. If the generated file needs to end up in the install treethen this can be achieved using a <TTCLASS="LITERAL">&lt;PREFIX&gt;</TT>token, for example:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">    make {        &lt;PREFIX&gt;/lib/mytarget : &#8230;            ...    }</PRE></TD></TR></TABLE><P>When the build tree is generated and the custom build step is added tothe makefile (or whatever build system is used)<TTCLASS="LITERAL">&lt;PREFIX&gt;</TT> will be replaced with the absolutepath to the install tree. </P></LI><LI><P>All the dependencies must also refer to physical files, not to phonytargets. These files may be in the source tree. The<TTCLASS="LITERAL">&lt;PACKAGE&gt;</TT> token can be used to indicate this:when the build tree is generated this token will be replaced with theabsolute path to the package's root directory in the componentrepository, for example:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">    make_object {        xyzzy.o : &lt;PACKAGE&gt;/src/xyzzy.c            &#8230;</PRE></TD></TR></TABLE><P>If the component repository was installed in <TTCLASS="FILENAME">/usr/local/ecos</TT> and this custom buildstep existed in version 1_5 of the kernel,<TTCLASS="LITERAL">&lt;PACKAGE&gt;</TT> would be replaced with<TTCLASS="FILENAME">/usr/local/ecos/packages/kernel/v1_5</TT>.</P><P>Alternatively the dependencies may refer to files that are generatedduring the build. These may be object files resulting from <SPANCLASS="PROPERTY">compile</SPAN>properties or other <SPANCLASS="PROPERTY">make_object</SPAN> properties, or they may be otherfiles resulting from a <SPANCLASS="PROPERTY">make</SPAN> property, for example:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">    compile plugh.c    make_object {        xyzzy.o : plugh.o            &#8230;    }</PRE></TD></TR></TABLE></LI><LI><P>No other token or makefile variables may be used in the target ordependency file names. Also conditionals such as<TTCLASS="LITERAL">ifneq</TT> and similar makefile functionality must notbe used.</P></LI><LI><P> Similarly the list of commands must not use any makefile conditionalsor similar functionality. A number of tokens can be used to provideaccess to target-specific or environmental data. Note that thesetokens look like makefile variables, unlike the <TTCLASS="LITERAL">&lt;PREFIX&gt;</TT> and<TTCLASS="LITERAL">&lt;PACKAGE&gt;</TT> tokens mentioned earlier:</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN2778"><P></P><TABLEBORDER="1"CLASS="CALSTABLE"><THEAD><TR><TH

⌨️ 快捷键说明

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