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

📄 build.make.html

📁 有关ecos2。0介绍了实时嵌入式的结构以及线程调度的实现和内存的管理等
💻 HTML
📖 第 1 页 / 共 4 页
字号:
ALIGN="LEFT"VALIGN="TOP">Token</TH><THALIGN="LEFT"VALIGN="TOP">Purpose</TH><THALIGN="LEFT"VALIGN="TOP">Example value</TH></TR></THEAD><TBODY><TR><TDALIGN="LEFT"VALIGN="TOP"><TTCLASS="LITERAL">$(AR)</TT></TD><TDALIGN="LEFT"VALIGN="TOP">the GNU archiver</TD><TDALIGN="LEFT"VALIGN="TOP"><TTCLASS="LITERAL">mips-tx39-elf-ar</TT></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"><TTCLASS="LITERAL">$(CC)</TT></TD><TDALIGN="LEFT"VALIGN="TOP">the GNU compiler</TD><TDALIGN="LEFT"VALIGN="TOP"><TTCLASS="LITERAL">sh-elf-gcc</TT></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"><TTCLASS="LITERAL">$(CFLAGS)</TT></TD><TDALIGN="LEFT"VALIGN="TOP">compiler flags</TD><TDALIGN="LEFT"VALIGN="TOP"><TTCLASS="LITERAL">-O2 -Wall</TT></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"><TTCLASS="LITERAL">$(COMMAND_PREFIX)</TT></TD><TDALIGN="LEFT"VALIGN="TOP">the triplet prefix</TD><TDALIGN="LEFT"VALIGN="TOP"><TTCLASS="LITERAL">mn10300-elf-</TT></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"><TTCLASS="LITERAL">$(INCLUDE_PATH&#62;</TT></TD><TDALIGN="LEFT"VALIGN="TOP">header file search path</TD><TDALIGN="LEFT"VALIGN="TOP"><TTCLASS="LITERAL">-I. -Isrc/misc</TT></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"><TTCLASS="LITERAL">$(LDFLAGS)</TT></TD><TDALIGN="LEFT"VALIGN="TOP">linker flags</TD><TDALIGN="LEFT"VALIGN="TOP"><TTCLASS="LITERAL">-nostdlib -Wl,-static</TT></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"><TTCLASS="LITERAL">$(OBJCOPY)</TT></TD><TDALIGN="LEFT"VALIGN="TOP">the objcopy utility</TD><TDALIGN="LEFT"VALIGN="TOP"><TTCLASS="LITERAL">arm-elf-objcopy</TT></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"><TTCLASS="LITERAL">$(PREFIX)</TT></TD><TDALIGN="LEFT"VALIGN="TOP">location of the install tree</TD><TDALIGN="LEFT"VALIGN="TOP"><TTCLASS="FILENAME">/home/fred/ecos-install</TT></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"><TTCLASS="LITERAL">$(REPOSITORY)</TT></TD><TDALIGN="LEFT"VALIGN="TOP">location of the component repository</TD><TDALIGN="LEFT"VALIGN="TOP"><TTCLASS="FILENAME">/home/fred/ecos/packages</TT></TD></TR></TBODY></TABLE><P></P></DIV><P>In addition commands in a custom build step may refer to the targetand the dependencies using <TTCLASS="LITERAL">$@</TT>,<TTCLASS="LITERAL">$&#60;</TT>, <TTCLASS="LITERAL">$^</TT> and<TTCLASS="LITERAL">$*</TT>, all of which behave as per GNU make syntax. Thecommands will execute in a suitable directory in the build tree.</P></LI><LI><P>The current directory used during a custom build step is animplementation detail of the build system. However it can be assumedthat each package will have its own directory somewhere in the buildtree, to prevent file name clashes, and that this will be the currentdirectory. In addition any object files generated as a result of<SPANCLASS="PROPERTY">compile</SPAN> properties will be located here as well, which is useful forcustom build steps that depend on a <TTCLASS="LITERAL">.o</TT> filepreviously generated.</P><P>Any temporary files created by a custom build step should be generatedin the build tree (in or under the current directory). Such filesshould be given a <TTCLASS="FILENAME">.tmp</TT> file extension to ensurethat they are deleted during a <TTCLASS="LITERAL">make&nbsp;clean</TT> orequivalent operation.</P><P>If a package contains multiple custom build steps with the samepriority, it is possible that these build steps will be runconcurrently. Therefore these custom build steps must not accidentallyuse the same file names for intermediate files.</P></LI><LI><P>Care has to be taken to make sure that the commands in a custom buildstep will run on all host platforms, including Windows NT as well asLinux and other Unix systems. For example, all file paths should useforward slashes as the directory separator. It can be assumed thatWindows users will have a full set of CygWin tools installed andavailable on the path. The <AHREF="http://www.gnu.org/prep/standards.html"TARGET="_top">GNU codingstandards</A> provide some useful guidelines for writing portablebuild rules.</P></LI><LI><P>A custom build step must not make any assumptions concerning theversion of another package. This enforces package encapsulation,preventing one package from accessing the internals of another.</P></LI><LI><P>No assumptions should be made about the target platform, unless thepackage is inherently specific to that platform. Even then it isbetter to use the various tokens whenever possible, rather thanhard-coding in details such as the compiler. For example, given acustom build step such as:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">    arm-elf-gcc -c -mcpu=arm7di -o $@ $&lt;</PRE></TD></TR></TABLE><P>Even if this build step will only be invoked on ARM targets, it couldcause problems. For example the toolchain may have been installedusing a prefix other than <TTCLASS="LITERAL">arm-elf</TT>. Also, if theuser changes the compiler flags then this would not be reflected inthe build step. The correct way to write this rule would be:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">    $(CC) -c $(CFLAGS) -o $@ $&lt;</PRE></TD></TR></TABLE><P>Some commands such as the compiler, the archiver, and objcopy arerequired sufficiently often to warrant their own tokens, for example<TTCLASS="LITERAL">$(CC)</TT> and <TTCLASS="LITERAL">$(OBJCOPY)</TT>. Othertarget-specific commands are needed only rarely and the<TTCLASS="LITERAL">$(COMMAND_PREFIX)</TT> token can be used to constructthe appropriate command name, for example:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">&#13;    $(COMMAND_PREFIX)size $&lt; &gt; $@</PRE></TD></TR></TABLE></LI><LI><P>Custom build steps should not be used to build host-side executables,even if those executables are needed to build parts of the target sidecode. Support for building host-side executables will be added in afuture version of the component framework, although it will notnecessarily involve these custom build steps.</P></LI></OL><P>By default custom build steps defined in a <SPANCLASS="PROPERTY">make_object</SPAN> propertyhave a priority of 100, which means that they will be executed in the same phase as compilations resulting from a <SPANCLASS="PROPERTY">compile</SPAN> property.It is possible to change the priority using a property option, forexample:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">    make_object -priority 50 {        &#8230;    }</PRE></TD></TR></TABLE><P>Specifying a priority smaller than a 100 means that the custom buildstep happens before the normal compilations. Priorities between 100and 200 happen after normal compilations but before the libraries arearchived together. <SPANCLASS="PROPERTY">make_object</SPAN> properties should not specify apriority of 200 or later. </P><P>Custom build steps defined in a <SPANCLASS="PROPERTY">make</SPAN> property have a defaultpriority of 300, and so they will happen after the libraries have beenbuilt. Again this can be changed using a <TTCLASS="LITERAL">-priority</TT>property option.</P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="BUILD.STARTUP">Startup Code</H2><P>Linking an application requires the application code, a linker script,the eCos library or libraries, the <TTCLASS="LITERAL">extras.o</TT> file,and some startup code. Depending on the target hardware and how theapplication gets booted, this startup code may do little more thanbranching to <TTCLASS="LITERAL">main()</TT>, or it may have to perform aconsiderable amount of hardware initialization. The startup codegenerally lives in a file <TTCLASS="LITERAL">vectors.o</TT> which iscreated by a custom build step in a HAL package. As far as applicationdevelopers are concered the existence of this file is largelytransparent, since the linker script ensures that the file is part ofthe final executable.</P><P>This startup code is not generally of interest to component writers,only to HAL developers who are referred to one of the existing HALpackages for specific details. Other packages are not expected tomodify the startup in any way. If a package needs some work performedearly on during system initialization, before the application's mainentry point gets invoked, this can be achieved using a static objectwith a suitable constructor priority.</P><DIVCLASS="NOTE"><BLOCKQUOTECLASS="NOTE"><P><B>Note: </B>It is possible that the <TTCLASS="LITERAL">extras.o</TT> support, inconjunction with appropriate linker script directives, could be usedto eliminate the need for a special startup file. The details are notyet clear.</P></BLOCKQUOTE></DIV></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="BUILD.LINKERSCRIPT">The Linker Script</H2><DIVCLASS="CAUTION"><P></P><TABLECLASS="CAUTION"BORDER="1"WIDTH="100%"><TR><TDALIGN="CENTER"><B>Caution</B></TD></TR><TR><TDALIGN="LEFT"><P>This section is not finished, and the details are subject to change ina future release. Arguably linker script issues should be documentedin the HAL documentation rather than in this guide.</P></TD></TR></TABLE></DIV><P>Generating the linker script is the responsibility of the various HALpackages that are applicable to a given target. Developers ofcomponents other than HAL packages need not be concerned about what isinvolved. Developers of new HAL packages should use an existing HAL asa template.</P><DIVCLASS="NOTE"><BLOCKQUOTECLASS="NOTE"><P><B>Note: </B>It may be desirable for some packages to have some control over thelinker script, for example to add extra alignment details for aparticular section. This can be risky because it can result in subtleportability problems, and the current component framework has nosupport for any such operations. The issue may be addressed in afuture release.</P></BLOCKQUOTE></DIV></DIV></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="build.headers.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="cdl-guide.html"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="build.tests.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Configuration Header File Generation</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="build.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Building Test Cases</TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

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