📄 overview.html
字号:
is expected to run. This may be an off-the-shelf evaluation board, apiece of custom hardware intended for a specific application, or itcould be something like a simulator. One of the steps when creating anew configuration is need to specify the target. The componentframework will map this on to a set of packages that are used topopulate the configuration, typically HAL and device driver packages,and in addition it may cause certain options to be changed from theirdefault settings to something more appropriate for thespecified target.</P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="CONCEPTS.TERMINOLOGY.TEMPLATE">Template</H2><P>A template is a partial configuration, aimed at providing users withan appropriate starting point. <SPANCLASS="APPLICATION">eCos</SPAN> is shipped with a small numberof templates, which correspond closely to common ways of using thesystem. There is a minimal template which provides very littlefunctionality, just enough to bootstrap the hardware and then jumpdirectly to application code. The default template adds additionalfunctionality, for example it causes the kernel and C library packagesto be loaded as well. The uitron template adds further functionalityin the form of a µITRON compatibility layer. Creating a newconfiguration typically involves specifying a template as well as atarget, resulting in a configuration that can be built and linked withthe application code and that will run on the actual hardware. It isthen possible to fine-tune configuration options to produce somethingthat better matches the specific requirements of the application.</P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="CONCEPTS.TERMINOLOGY.PROPERTIES">Properties</H2><P>The component framework needs a certain amount of information abouteach option. For example it needs to know what the legal values are,what the default should be, where to find the on-line documentation ifthe user needs to consult that in order to make a decision, and so on.These are all properties of the option. Every option (includingcomponents and packages) consists of a name and a set of properties.</P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="CONCEPTS.TERMINOLOGY.CONSEQUENCES">Consequences</H2><P>Choices must have consequences. For an <SPANCLASS="APPLICATION">eCos</SPAN> configuration the mainend product is a library that can be linked with application code, sothe consequences of a user choice must affect the build process. Thishappens in two main ways. First, options can affect which files getbuilt and end up in the library. Second, details of the current optionsettings get written into various configuration header files using Cpreprocessor <TTCLASS="LITERAL">#define</TT> directives, and package sourcecode can <TTCLASS="LITERAL">#include</TT> these configuration headers andadapt accordingly. This allows options to affect a package at a veryfine grain, at the level of individual lines in a source file ifdesired. There may be other consequences as well, for example thereare options to control the compiler flags that get used during thebuild process.</P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="CONCEPTS.TERMINOLOGY.CONSTRAINTS">Constraints</H2><P>Configuration choices are not independent. The C library can providethread-safe implementations of functions like<TTCLASS="FUNCTION">rand</TT>, but only if the kernel provides support forper-thread data. This is a constraint: the C library option has arequirement on the kernel. A typical configuration involves aconsiderable number of constraints, of varying complexity: manyconstraints are straightforward, option <TTCLASS="LITERAL">A</TT> requiresoption <TTCLASS="LITERAL">B</TT>, or option <TTCLASS="LITERAL">C</TT> precludesoption <TTCLASS="LITERAL">D</TT>. Other constraints can be morecomplicated, for example option <TTCLASS="LITERAL">E</TT> may require thepresence of a kernel scheduler but does not care whether it is thebitmap scheduler, the mlqueue scheduler, or something else.</P><P>Another type of constraint involves the values that can be used forcertain options. For example there is a kernel option related to thenumber of scheduling levels, and there is a legal values constraint onthis option: specifying zero or a negative number for the number ofscheduling levels makes no sense.</P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="CONCEPTS.TERMINOLOGY.CONFLICTS">Conflicts</H2><P>As the user manipulates options it is possible to end up with aninvalid configuration, where one or more constraints are notsatisfied. For example if kernel per-thread data is disabled but the Clibrary's thread-safety options are left enabled then there areunsatisfied constraints, also known as conflicts. Such conflicts willbe reported by the configuration tools. The presence of conflicts doesnot prevent users from attempting to build <SPANCLASS="APPLICATION">eCos</SPAN>, but theconsequences are undefined: there may be compile-time failures, theremay be link-time failures, the application may completely fail to run,or the application may run most of the time but once in a while therewill be a strange failure… Typically users will want to resolveall conflicts before continuing.</P><P>To make things easier for the user, the configuration tools contain aninference engine. This can examine a conflict in a particularconfiguration and try to figure out some way of resolving theconflict. Depending on the particular tool being used, the inferenceengine may get invoked automatically at certain times or the user mayneed to invoke it explicitly. Also depending on the tool, theinference engine may apply any solutions it finds automatically or itmay request user confirmation.</P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="CONCEPTS.TERMINOLOGY.CDL">CDL</H2><P>The configuration tools require information about the various optionsprovided by each package, their consequences and constraints, andother properties such as the location of on-line documentation. Thisinformation has to be provided in the form of <SPANCLASS="APPLICATION">CDL</SPAN> scripts. CDLis short for Component Definition Language, and is specificallydesigned as a way of describing configuration options.</P><P>A typical package contains the following:</P><P></P><OLTYPE="1"><LI><P>Some number of source files which will end up in a library. Theapplication code will be linked with this library to produce anexecutable. Some source files may serve other purposes, for example toprovide a linker script.</P></LI><LI><P>Exported header files which define the interface provided by thepackage. </P></LI><LI><P>On-line documentation, for example reference pages for each exportedfunction. </P></LI><LI><P>Some number of test cases, shipped in source format, allowing users tocheck that the package is working as expected on their particularhardware and in their specific configuration.</P></LI><LI><P>One or more <SPANCLASS="APPLICATION">CDL</SPAN> scripts describing the package to the configurationsystem.</P></LI></OL><P>Not all packages need to contain all of these. For example somepackages such as device drivers may not provide a new interface,instead they just provide another implementation of an existinginterface. However all packages must contain a <SPANCLASS="APPLICATION">CDL</SPAN> script thatdescribes the package to the configuration tools.</P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="CONCEPTS.TERMINOLOGY.REPO">Component Repository</H2><P>All <SPANCLASS="APPLICATION">eCos</SPAN> installations include a component repository. This is adirectory structure where all the packages get installed. Thecomponent framework comes with an administration tool that allows newpackages or new versions of a package to be installed, old packages tobe removed, and so on. The component repository includes a simpledatabase, maintained by the administration tool, which containsdetails of the various packages.</P><P>Generally application developers do not need to modify anything insidethe component repository, except by means of the administration tool.Instead their work involves separate build and install trees. Thisallows the component repository to be treated as a read-only resourcethat can be shared by multiple projects and multiple users. Componentwriters modifying one of the packages do need to manipulate files inthe component repository.</P></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="cdl-guide.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="overview.configurability.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">The <SPANCLASS="APPLICATION">eCos</SPAN> Component Writer's Guide</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"> </TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Why Configurability?</TD></TR></TABLE></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -