📄 language.properties.html
字号:
<AHREF="ref.define.html"><SPANCLASS="PROPERTY">define</SPAN></A>,<AHREF="ref.if-define.html"><SPANCLASS="PROPERTY">if_define</SPAN></A>, and<AHREF="ref.define-proc.html"><SPANCLASS="PROPERTY">define_proc</SPAN></A>.</P><P>By default the component framework will generate a configurationheader file for each package based on the package's name: everythingup to and including the first underscore is discarded, the rest of thename is lower-cased, and a <TTCLASS="LITERAL">.h</TT> suffix is appended.For example the configuration header file for the kernel package<TTCLASS="VARNAME">CYGPKG_KERNEL</TT> is <TTCLASS="FILENAME">pkgconf/kernel.h</TT>. The <SPANCLASS="PROPERTY">define_header</SPAN>property can be used to specify an alternative filename. This appliesto all the components and options within a package, so it can only beused in the body of a <TTCLASS="LITERAL">cdl_package</TT> command. For example the followingspecifies that the configuration header file for the SPARClite HALpackage is <TTCLASS="FILENAME">pkgconf/hal_sparclite.h</TT>.</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cdl_package CYGPKG_HAL_SPARCLITE { display "SPARClite architecture" parent CYGPKG_HAL hardware define_header hal_sparclite.h …}</PRE></TD></TR></TABLE><DIVCLASS="NOTE"><BLOCKQUOTECLASS="NOTE"><P><B>Note: </B>At present the main use for the <SPANCLASS="PROPERTY">define_header</SPAN> property is related to hardware packages, see the <AHREF="ref.hardware.html">referencepages</A> for more details.</P></BLOCKQUOTE></DIV><P>The <SPANCLASS="PROPERTY">no_define</SPAN> property is used to suppress the generation of thedefault <TTCLASS="LITERAL">#define</TT>. This can be useful if an option'sconsequences are all related to the build process or to constraints,and the option is never actually checked in any source code. It canalso be useful in conjunction with the <SPANCLASS="PROPERTY">define</SPAN>, <SPANCLASS="PROPERTY">if_define</SPAN> or<SPANCLASS="PROPERTY">define_proc</SPAN> properties. The <SPANCLASS="PROPERTY">no_define</SPAN> property does not take anyarguments. </P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cdl_component CYG_HAL_STARTUP { display "Startup type" flavor data legal_values { "RAM" "ROM" } default_value {"RAM"} no_define define -file system.h CYG_HAL_STARTUP …}</PRE></TD></TR></TABLE><P>This example also illustrates the <SPANCLASS="PROPERTY">define</SPAN> property, which can be usedto generate a <TTCLASS="LITERAL">#define</TT> in addition to the defaultone. It takes a single argument, the name of the symbol to be defined.It also takes options to control the configuration header file inwhich the symbol should be defined and the format to be used.</P><P>The <SPANCLASS="PROPERTY">define_format</SPAN> property can be used to control how the value partof the default <TTCLASS="LITERAL">#define</TT> gets formatted. For examplea format string of <TTCLASS="LITERAL">"0x%04x"</TT> could be used togenerate a four-digit hexadecimal number. </P><P>The <SPANCLASS="PROPERTY">if_define</SPAN> property is intended for use primarily to controlassertions, tracing, and similar functionality. It supports a specificimplementation model for these, allowing control at the grain ofpackages or even individual source files. The <AHREF="ref.if-define.html">reference pages</A> provide additionalinformation.</P><P>The <SPANCLASS="PROPERTY">define_proc</SPAN> property provides an escape mechanism for thosecases where something special has to happen at configuration headerfile generation time. It takes a single argument, a fragment of <SPANCLASS="APPLICATION">Tcl</SPAN>code, which gets executed when the header file is generated. This codecan output arbitrary data to the header file, or perform any otheractions that might be appropriate.</P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="LANGUAGE.PROPERTIES.BUILD">Controlling what gets Built</H2><P>There are six properties which affect the build process:<AHREF="ref.compile.html"><SPANCLASS="PROPERTY">compile</SPAN></A>,<AHREF="ref.make.html"><SPANCLASS="PROPERTY">make</SPAN></A>,<AHREF="ref.make-object.html"><SPANCLASS="PROPERTY">make_object</SPAN></A>,<AHREF="ref.library.html"><SPANCLASS="PROPERTY">library</SPAN></A>,<AHREF="ref.include-dir.html"><SPANCLASS="PROPERTY">include_dir</SPAN></A>, and<AHREF="ref.include-files.html"><SPANCLASS="PROPERTY">include_files</SPAN></A>.The last three apply to a package as a whole, and can only occur inthe body of a <TTCLASS="LITERAL">cdl_package</TT> command.</P><P>Most of the source files that go into a package should simply becompiled with the appropriate compiler, selected by the targetarchitecture, and with the appropriate flags, with an additional setdefined by the target hardware and possible modifications on aper-package basis. The resulting object files will go into the library<TTCLASS="FILENAME">libtarget.a</TT>, which can then be linked againstapplication code. The <SPANCLASS="PROPERTY">compile</SPAN> property is used to list these sourcefiles: </P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cdl_package CYGPKG_ERROR { display "Common error code support" compile strerror.cxx include_dir cyg/error …}</PRE></TD></TR></TABLE><P>The arguments to the <SPANCLASS="PROPERTY">compile</SPAN> property should be one or more sourcefiles. Typically most of the sources will be needed for the package asa whole, and hence they will be listed in one or more <SPANCLASS="PROPERTY">compile</SPAN>properties in the body of the <TTCLASS="LITERAL">cdl_package</TT>. Some sources may bespecific to particular configuration options, in other words there isno point in compiling them unless that option is enabled, in whichcase the sources should be listed in a <SPANCLASS="PROPERTY">compile</SPAN> property in thecorresponding <TTCLASS="LITERAL">cdl_option</TT>, <TTCLASS="LITERAL">cdl_component</TT> or <TTCLASS="LITERAL">cdl_interface</TT> body.</P><P>Some packages may have more complicated build requirements, forexample they may involve a special target such as a linker scriptwhich should not end up in the usual library, or they may involvespecial build steps for generating an object file. The <SPANCLASS="PROPERTY">make</SPAN> and<SPANCLASS="PROPERTY">make_object</SPAN> properties provide support for such requirements, forexample:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cdl_package CYGPKG_HAL_MN10300_AM33 { display "MN10300 AM33 variant" … make { <PREFIX>/lib/target.ld: <PACKAGE>/src/mn10300_am33.ld $(CC) -E -P -Wp,-MD,target.tmp -DEXTRAS=1 -xc $(INCLUDE_PATH) \ $(CFLAGS) -o $@ $< @echo $@ ": \\" > $(notdir $@).deps @tail +2 target.tmp >> $(notdir $@).deps @echo >> $(notdir $@).deps @rm target.tmp }}</PRE></TD></TR></TABLE><P>For full details of custom build steps and the build processgenerally, see <AHREF="build.html">Chapter 4</A>.</P><P>By default all object files go into the library<TTCLASS="FILENAME">libtarget.a</TT>. It is possible to override this atthe package level using the <SPANCLASS="PROPERTY">library</SPAN> property, but this should beavoided since it complicates application development: instead of justlinking with a single library for all <SPANCLASS="APPLICATION">eCos</SPAN>-related packages, itsuddenly becomes necessary to link with several libraries.</P><P>The <SPANCLASS="PROPERTY">include_dir</SPAN> and <SPANCLASS="PROPERTY">include_files</SPAN> properties relate to a package'sexported header files. By default a package's header files will beexported to the <TTCLASS="FILENAME">install/include</TT>directory. This is the desired behavior for some packages like the Clibrary, since headers like <TTCLASS="FILENAME">stdio.h</TT> should exist at that level.However if all header files were to end up in that directory thenthere would be a significant risk of a name clash. Instead it isbetter for packages to specify some sub-directory for their exportedheader files, for example:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cdl_package CYGPKG_INFRA { display "Infrastructure" include_dir cyg/infra …}</PRE></TD></TR></TABLE><P>The various header files exported by the infrastructure, for example<TTCLASS="FILENAME">cyg_ass.h</TT> and <TTCLASS="FILENAME">cyg_trac.h</TT> will now end up in the<TTCLASS="FILENAME">install/include/cyg/infra</TT>sub-directory, where a name clash is very unlikely.</P><P>For packages which follow the <AHREF="package.html#PACKAGE.HIERARCHY">directory layout conventions</A> thecomponent framework will assume that the package's<TTCLASS="FILENAME">include</TT> sub-directory containsall exported header files. If this is not the case, for examplebecause the package is sufficiently simple that the layout conventionis inappropriate, then the exported header files can be listedexplicitly in an <SPANCLASS="PROPERTY">include_files</SPAN> property.</P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="LANGUAGE.PROPERTIES.MISCELLANEOUS">Miscellaneous Properties</H2><P>The <AHREF="ref.hardware.html"><SPANCLASS="PROPERTY">hardware</SPAN></A> property isonly relevant to packages. Some packages such as device drivers andHAL packages are hardware-specific, and generally it makes no sense toadd such packages to a configuration unless the corresponding hardwareis present on your target system. Typically hardware package selectionhappens automatically when you select your target. The <SPANCLASS="PROPERTY">hardware</SPAN>property should be used to identify a hardware-specific package, anddoes not take any arguments.</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cdl_package CYGPKG_HAL_MIPS { display "MIPS architecture" parent CYGPKG_HAL hardware include_dir cyg/hal define_header hal_mips.h …}</PRE></TD></TR></TABLE><P>At present the <SPANCLASS="PROPERTY">hardware</SPAN> property is largely ignored by the componentframework. This may change in future releases.</P></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="language.commands.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="language.naming.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">CDL Commands</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="language.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Option Naming Convention</TD></TR></TABLE></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -