📄 concepts.sgml
字号:
<!-- {{{ Banner --><!-- =============================================================== --><!-- --><!-- concepts.sgml --><!-- --><!-- Introductory chapter. --><!-- --><!-- =============================================================== --><!-- ####COPYRIGHTBEGIN#### --><!-- --><!-- =============================================================== --><!-- Copyright (C) 2000, 2001, 2002 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 obtained from the copyright holder --><!-- =============================================================== --><!-- --> <!-- ####COPYRIGHTEND#### --><!-- =============================================================== --><!-- #####DESCRIPTIONBEGIN#### --><!-- --><!-- Author(s): bartv --><!-- Contact(s): bartv --><!-- Date: 2000/02/06 --><!-- Version: 0.01 --><!-- --><!-- ####DESCRIPTIONEND#### --><!-- =============================================================== --><!-- }}} --><chapter id="overview"><title>Overview</title><!-- {{{ Introit --> <para>&eCos; was designed from the very beginning as a configurablecomponent architecture. The core &eCos; system consists of a number ofdifferent components such as the kernel, the C library, aninfrastructure package. Each of these provides a large number ofconfiguration options, allowing application developers to build asystem that matches the requirements of their particular application.To manage the potential complexity of multiple components and lots ofconfiguration options, &eCos; comes with a component framework: acollection of tools specifically designed to support configuringmultiple components. Furthermore this component framework isextensible, allowing additional components to be added to the systemat any time.</para><!-- }}} --><!-- {{{ Terminology --> <sect1 id="overview.terminology"><title>Terminology</title><para>The &eCos; component architecture involves a number of key concepts.</para><!-- {{{ Component Framework --><sect2 id="concepts.terminology.framework"><title>Component Framework</title><para>The phrase <phrase>component framework</phrase> is used to describethe collection of tools that allow users to configure a system andadminister a component repository. This includes the <applicationclass="software">ecosconfig</application> command line tool, thegraphical configuration tool, and the package administration tool.Both the command line and graphical tools are based on a singleunderlying library, the &CDL; library.</para></sect2><!-- }}} --><!-- {{{ Option --><sect2 id="concepts.terminology.option"><title>Configuration Option</title><para>The option is the basic unit of configurability. Typically each optioncorresponds to a single choice that a user can make. For example thereis an option to control whether or not assertions are enabled, and thekernel provides an option corresponding to the number of schedulingpriority levels in the system. Options can control very small amountsof code such as whether or not the C library's<function>strtok</function> gets inlined. They can also control quitelarge amounts of code, for example whether or not the<function>printf</function> supports floating point conversions.</para><para>Many options are straightforward, and the user only gets to choosewhether the option is enabled or disabled. Some options are morecomplicated, for example the number of scheduling priority levels is anumber that should be within a certain range. Options should alwaysstart off with a sensible default setting, so that it is not necessaryfor users to make hundreds of decisions before any work can start ondeveloping the application. Once the application is running thevarious configuration options can be used to tune the system for thespecific needs of the application.</para><para>The component framework allows for options that are not directlyuser-modifiable. Consider the case of processor endianness: someprocessors are always big-endian or always little-endian, while withother processors there is a choice. Depending on the user's choice oftarget hardware, endianness may or may not be user-modifiable.</para></sect2><!-- }}} --><!-- {{{ Component --><sect2 id="concepts.terminology.component"><title>Component</title><para>A component is a unit of functionality such as a particular kernelscheduler or a device driver for a specific device. A component isalso a configuration option in that users may want to enableor disable all the functionality in a component. For example, if aparticular device on the target hardware is not going to be used bythe application, directly or indirectly, then there is no point inhaving a device driver for it. Furthermore disabling the device drivershould reduce the memory requirements for both code and data.</para><para>Components may contain further configuration options. In the case of adevice driver, there may be options to control the exact behavior ofthat driver. These will of course be irrelevant if the driver as awhole is disabled. More generally options and components live in ahierarchy, where any component can contain options specific to thatcomponent and further sub-components. It is possible to view theentire &eCos; kernel as one big component, containing sub-componentsfor scheduling, exception handling, synchronization primitives, and soon. The synchronization primitives component can contain furthersub-components for mutexes, semaphores, condition variables, eventflags, and so on. The mutex component can contain configurationoptions for issues like priority inversion support.</para></sect2><!-- }}} --><!-- {{{ Package --><sect2 id="concepts.terminology.package"><title>Package</title><para>A package is a special type of component. Specifically, a package isthe unit of distribution of components. It is possible to create adistribution file for a package containing all of the source code,header files, documentation, and other relevant files. Thisdistribution file can then be installed using the appropriate tool.Afterwards it is possible to uninstall that package, or to install alater version. The core &eCos; distribution comes with a number ofpackages such as the kernel and the infrastructure. Other packagessuch as network stacks can come from various different sources and canbe installed alongside the core distribution.</para><para>Packages can be enabled or disabled, but the user experience is alittle bit different. Generally it makes no sense for the tools toload the details of every single package that has been installed. Forexample, if the target hardware uses an ARM processor then there is nopoint in loading the HAL packages for other architectures anddisplaying choices to the user which are not relevant. Thereforeenabling a package means loading its configuration data into theappropriate tool, and disabling a package is an unload operation. Inaddition, packages are not just enabled or disabled: it is alsopossible to select the particular version of a package that should beused.</para></sect2><!-- }}} --><!-- {{{ Configuration --><sect2 id="concepts.terminology.configuration"><title>Configuration</title><para>A configuration is a collection of user choices. The varioustools that make up the component framework deal with entireconfigurations. Users can create a new configuration, output asavefile (by default <filename>ecos.ecc</filename>), manipulate aconfiguration, and use a configuration to generate a build tree priorto building &eCos; and any other packages that have been selected.A configuration includes details such as which packages have beenselected, in addition to finer-grained information such as whichoptions in those packages have been enabled or disabled by the user. </para></sect2><!-- }}} --><!-- {{{ Target --><sect2 id="concepts.terminology.target"><title>Target</title><para>The target is the specific piece of hardware on which the applicationis 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.</para></sect2><!-- }}} --><!-- {{{ Template --><sect2 id="concepts.terminology.template"><title>Template</title><para>A template is a partial configuration, aimed at providing users withan appropriate starting point. &eCos; 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 &uITRON; 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.</para></sect2><!-- }}} --><!-- {{{ Properties --><sect2 id="concepts.terminology.properties"><title>Properties</title><para>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.</para></sect2><!-- }}} --><!-- {{{ Consequences --><sect2 id="concepts.terminology.consequences"><title>Consequences</title><para>Choices must have consequences. For an &eCos; 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 <literal>#define</literal> directives, and package sourcecode can <literal>#include</literal> 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 if
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -