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

📄 build.make.html

📁 有关ecos2。0介绍了实时嵌入式的结构以及线程调度的实现和内存的管理等
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<!-- Copyright (C) 2003 Red Hat, Inc.                                --><!-- This material may be distributed only subject to the terms      --><!-- and conditions set forth in the Open Publication License, v1.0  --><!-- or later (the latest version is presently available at          --><!-- http://www.opencontent.org/openpub/).                           --><!-- Distribution of the work or derivative of the work in any       --><!-- standard (paper) book form is prohibited unless prior           --><!-- permission is obtained from the copyright holder.               --><HTML><HEAD><TITLE>Building eCos</TITLE><meta name="MSSmartTagsPreventParsing" content="TRUE"><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+"><LINKREL="HOME"TITLE="The eCos Component Writer's Guide"HREF="cdl-guide.html"><LINKREL="UP"TITLE="The Build Process"HREF="build.html"><LINKREL="PREVIOUS"TITLE="Configuration Header File Generation"HREF="build.headers.html"><LINKREL="NEXT"TITLE="Building Test Cases"HREF="build.tests.html"></HEAD><BODYCLASS="SECT1"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">The <SPANCLASS="APPLICATION">eCos</SPAN> Component Writer's Guide</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="build.headers.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Chapter 4. The Build Process</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="build.tests.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="BUILD.MAKE">Building eCos</H1><P>The primary goal of an eCos build is to produce the library<TTCLASS="FILENAME">libtarget.a</TT>. A typical <SPANCLASS="APPLICATION">eCos</SPAN> build will alsogenerate a number of other targets: <TTCLASS="FILENAME">extras.o</TT>,startup code <TTCLASS="FILENAME">vectors.o</TT>, and a linker script. Somepackages may cause additional libraries or targets to be generated.The basic build process involves a number of different phases withcorresponding priorities. There are a number of predefined priorities:</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN2457"><P></P><TABLEBORDER="1"CLASS="CALSTABLE"><THEAD><TR><THWIDTH="50%"ALIGN="RIGHT"VALIGN="TOP">Priority</TH><THWIDTH="50%"ALIGN="LEFT"VALIGN="TOP">Action</TH></TR></THEAD><TBODY><TR><TDWIDTH="50%"ALIGN="RIGHT"VALIGN="TOP">0</TD><TDWIDTH="50%"ALIGN="LEFT"VALIGN="TOP">Export header files</TD></TR><TR><TDWIDTH="50%"ALIGN="RIGHT"VALIGN="TOP">100</TD><TDWIDTH="50%"ALIGN="LEFT"VALIGN="TOP">Process <SPANCLASS="PROPERTY">compile</SPAN> properties</TD></TR><TR><TDWIDTH="50%"ALIGN="RIGHT"VALIGN="TOP">&nbsp;</TD><TDWIDTH="50%"ALIGN="LEFT"VALIGN="TOP">and most <SPANCLASS="PROPERTY">make_object</SPAN> custom build steps</TD></TR><TR><TDWIDTH="50%"ALIGN="RIGHT"VALIGN="TOP">200</TD><TDWIDTH="50%"ALIGN="LEFT"VALIGN="TOP">Generate libraries</TD></TR><TR><TDWIDTH="50%"ALIGN="RIGHT"VALIGN="TOP">300</TD><TDWIDTH="50%"ALIGN="LEFT"VALIGN="TOP">Process <SPANCLASS="PROPERTY">make</SPAN> custom build steps</TD></TR></TBODY></TABLE><P></P></DIV><P>Generation of the <TTCLASS="FILENAME">extras.o</TT> file, the startup codeand the linker script actually happens via <SPANCLASS="PROPERTY">make</SPAN> custom build steps,typically defined in appropriate HAL packages. The component frameworkhas no special knowledge of these targets.</P><P>By default custom build steps for a <SPANCLASS="PROPERTY">make_object</SPAN> property happenduring the same phase as most compilations, but this can be changedusing a <TTCLASS="LITERAL">-priority</TT> option. Similarly custom buildsteps for a <SPANCLASS="PROPERTY">make</SPAN> property happen at the end of a build, but this canalso be changed with a <TTCLASS="LITERAL">-priority</TT> option. Forexample a priority of 50 can be used to run a custom build stepbetween the header file export phase and the main compilation phase.Custom build steps are discussed in more detail below.</P><P>Some build systems may run several commands of the same priority inparallel. For example files listed in <SPANCLASS="PROPERTY">compile</SPAN> properties may getcompiled in parallel, concurrently with <SPANCLASS="PROPERTY">make_object</SPAN> custom buildsteps with default priorities. Since most of the time for an <SPANCLASS="APPLICATION">eCos</SPAN>build involves processing <SPANCLASS="PROPERTY">compile</SPAN> properties, this allows builds tobe speeded up on suitable host hardware. All build steps for a givenphase will complete before the next phase is started.</P><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="BUILD.MAKE.UPDATE">Updating the Build Tree</H2><P>Some build systems may involve a phase before the header files getexported, to update the build and install trees automatically whenthere has been a change to the configuration savefile<TTCLASS="FILENAME">ecos.ecc</TT>. This is useful mainly for applicationdevelopers using the command line tools: it would allow users tocreate the build tree only once, and after any subsequentconfiguration changes the tree would be updated automatically by thebuild system. The facility would be analogous to the<TTCLASS="LITERAL">--enable-maintainer-mode</TT> option provide by the<SPANCLASS="APPLICATION">autoconf</SPAN> and <SPANCLASS="APPLICATION">automake</SPAN> programs. At present no <SPANCLASS="APPLICATION">eCos</SPAN>build system implements this functionality, but it is likely to beadded in a future release.</P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="BUILD.MAKE.EXPORT">Exporting Public Header Files</H2><P>The first compulsory phase involves making sure that there is an up todate set of header files in the install tree. Each package can containsome number of header files defining the exported interface.Applications should only use exported functionality. A package canalso contain some number of private header files which are only ofinterest to the implementation, and which should not be visible toapplication code. The various packages that go into a particularconfiguration can be spread all over the component repository. Intheory it might be possible to make all the exported header filesaccessible by having a lengthy <TTCLASS="LITERAL">-I</TT> header filesearch path, but this would be inconvenient both for building eCos andfor building applications. Instead all the relevant header files arecopied to a single location, the <TTCLASS="FILENAME">include</TT> subdirectory of the install tree.The process involves the following:</P><P></P><OLTYPE="1"><LI><P>The install tree, for example <TTCLASS="FILENAME">/usr/local/ecos/install</TT>, and its <TTCLASS="FILENAME">include</TT> subdirectory <TTCLASS="FILENAME">/usr/local/ecos/install/include</TT> will typically becreated when the build tree is generated or updated. At the same timeconfiguration header files will be written to the <TTCLASS="FILENAME">pkgconf</TT> subdirectory, for example<TTCLASS="FILENAME">/usr/local/ecos/include/pkgconf</TT>, so thatthe configuration data is visible to all the packages and toapplication code that may wish to examine some of the configurationoptions.</P></LI><LI><P>Each package in the configuration is examined for exported headerfiles. The exact order in which the packages are processed is notdefined, but should not matter.</P><P></P><OLTYPE="a"><LI><P>If the package has an <AHREF="ref.include-files.html"><SPANCLASS="PROPERTY">include_files</SPAN></A> property then thislists all the exported header files:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cdl_package &lt;some_package&gt; {    &#8230;    include_files header1.h header2.h}    </PRE></TD></TR></TABLE><P>If no arguments are given then the package does not export any headerfiles.</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cdl_package &lt;some_package&gt; {    &#8230;    include_files}    </PRE></TD></TR></TABLE><P>The listed files may be in an <TTCLASS="FILENAME">include</TT> subdirectory within the package'shierarchy, or they may be relative to the package's topleveldirectory. The <SPANCLASS="PROPERTY">include_files</SPAN> property is intended mainly for verysimple packages. It can also be useful when converting existing codeto an <SPANCLASS="APPLICATION">eCos</SPAN> package, to avoid rearranging the sources.</P></LI><LI><P>If there is no <SPANCLASS="PROPERTY">include_files</SPAN> property then the component frameworkwill look for an <TTCLASS="FILENAME">include</TT>subdirectory in the package, as per the layout conventions. All files,including those in subdirectories, will be treated as exported headerfiles. For example, the math library package contains files <TTCLASS="FILENAME">include/math.h</TT> and <TTCLASS="FILENAME">include/sys/ieeefp.h</TT>, both of which willbe exported to the install tree.</P></LI><LI><P>As a last resort, if there is neither an <SPANCLASS="PROPERTY">include_files</SPAN> property noran <TTCLASS="FILENAME">include</TT> subdirectory, thecomponent framework will search the package's toplevel directory andall of its subdirectories for files with one of the followingsuffixes: <TTCLASS="LITERAL">.h</TT>, <TTCLASS="LITERAL">.hxx</TT>,<TTCLASS="LITERAL">.inl</TT> or <TTCLASS="LITERAL">.inc</TT>. All such fileswill be interpreted as exported header files.</P><P>This last resort rule could cause confusion for packages which have noexported header files but which do contain one or more private headerfiles. For example a typical device driver simply implements anexisting interface rather than define a new one, so it does not needto export a header file. However it may still have one or more privateheader files. Such packages should use an <SPANCLASS="PROPERTY">include_files</SPAN> propertywith no arguments.</P></LI></OL></LI><LI><P>If the package has one or more exported header files, the next step isto determine where the files should end up. By default all exportedheader files will just end up relative to the install tree's <TTCLASS="FILENAME">include</TT> subdirectory. For example themath library's <TTCLASS="FILENAME">math.h</TT> headerwould end up as <TTCLASS="FILENAME">/usr/local/ecos/include/math.h</TT>,and the <TTCLASS="FILENAME">sys/ieeefp.h</TT> headerwould end up as<TTCLASS="FILENAME">/usr/local/ecos/include/sys/ieeefp.h</TT>. Thisbehaviour is correct for packages like the C library where theinterface is defined by appropriate standards. For other packages thisbehaviour can lead to file name clashes, and the <AHREF="ref.include-dir.html"><SPANCLASS="PROPERTY">include_dir</SPAN></A> property should be usedto avoid this:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cdl_package CYGPKG_KERNEL {    include_dir cyg/kernel}</PRE></TD></TR></TABLE><P>This means that the kernel's exported header file<TTCLASS="FILENAME">include/kapi.h</TT> should be copied to<TTCLASS="FILENAME">/usr/local/ecos/include/cyg/kernel/kapi.h</TT>, whereit is very unlikely to clash with a header file from some otherpackage.</P></LI><LI><P>For typical application developers there will be little or no need forthe installed header files to change after the first build. Changeswill be necessary only if packages are added to or removed from theconfiguration. For component writers, the build system should detectchanges to the master copy of the header file source code and updatethe installed copies automatically during the next build. The buildsystem is expected to perform a header file dependency analysis, soany source files affected should get rebuilt as well.</P></LI><LI><P>Some build systems may provide additional support for applicationdevelopers who want to make minor changes to a package, especially fordebugging purposes. A header file could be copied from thecomponent repository (which for application developers is assumed tobe a read-only resource) into the build tree and edited there. Thebuild system would detect a more recent version of such a header filein the build tree and install it. Care would have to be taken torecover properly if the modified copy in the build tree issubsequently removed, in order to revert to the original behaviour.</P></LI><LI><P>When updating the install tree's <TTCLASS="FILENAME">include</TT> subdirectory, the build tree mayalso perform a clean-up operation. Specifically, it may check for anyfiles which do not correspond to known exported header files and

⌨️ 快捷键说明

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