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

📄 concepts.sgml

📁 ecos实时嵌入式操作系统
💻 SGML
📖 第 1 页 / 共 3 页
字号:
desired. There may be other consequences as well, for example thereare options to control the compiler flags that get used during thebuild process.</para></sect2><!-- }}} --><!-- {{{ Constraints            --><sect2 id="concepts.terminology.constraints"><title>Constraints</title><para>Configuration choices are not independent. The C library can providethread-safe implementations of functions like<function>rand</function>, 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 <literal>A</literal> requiresoption <literal>B</literal>, or option <literal>C</literal> precludesoption <literal>D</literal>. Other constraints can be morecomplicated, for example option <literal>E</literal> may require thepresence of a kernel scheduler but does not care whether it is thebitmap scheduler, the mlqueue scheduler, or something else.</para><para>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.</para></sect2><!-- }}} --><!-- {{{ Conflicts              --><sect2 id="concepts.terminology.conflicts"><title>Conflicts</title><para>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 &eCos;, 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&hellip; Typically users will want to resolveall conflicts before continuing.</para><para>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.</para></sect2><!-- }}} --><!-- {{{ CDL                    --><sect2 id="concepts.terminology.cdl"><title>CDL</title><para>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 &CDL; scripts. CDLis short for Component Definition Language, and is specificallydesigned as a way of describing configuration options.</para><para>A typical package contains the following:</para><orderedlist><listitem><para>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.</para></listitem><listitem><para>Exported header files which define the interface provided by thepackage. </para></listitem><listitem><para>On-line documentation, for example reference pages for each exportedfunction. </para></listitem><listitem><para>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.</para></listitem><listitem><para>One or more &CDL; scripts describing the package to the configurationsystem.</para></listitem></orderedlist><para>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 &CDL; script thatdescribes the package to the configuration tools.</para></sect2><!-- }}} --><!-- {{{ Component Repository   --><sect2 id="concepts.terminology.repo"><title>Component Repository</title><para>All &eCos; 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.</para><para>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.</para></sect2><!-- }}} --></sect1><!-- }}} --><!-- {{{ Why configurability ?  --> <sect1 id="overview.configurability"><title>Why Configurability?</title><para>The &eCos; component framework places a great deal of emphasis onconfigurability. The fundamental goal is to allow large parts ofembedded applications to be constructed from re-usable softwarecomponents, which does not a priori require that those components behighly configurable. However embedded application development ofteninvolves some serious constraints.</para><para>Many embedded applications have to work with very little memory, tokeep down manufacturing costs. The final application image that willget blown into EPROM's or used to manufacture ROMs should contain onlythe code that is absolutely necessary for the application to work, andnothing else. If a few tens of kilobytes are added unnecessarily to atypical desktop application then this is regrettable, but is quitelikely to go unnoticed. If an embedded application does not fit on thetarget hardware then the problem is much more serious. The componentframework must allow users to configure the components so that anyunnecessary functionality gets removed.</para><para>Many embedded applications need deterministic behavior so that theycan meet real-time requirements. Such deterministic behavior canoften be provided, but at a cost in terms of code size, sloweralgorithms, and so on. Other applications have no such real-timerequirements, or only for a small part of the overall system, and thebulk of the system should not suffer any penalties. Again thecomponent framework must allow the users control over the timingbehavior of components.</para><para>Embedded systems tend to be difficult to debug. Even when it ispossible to get information out of the target hardware by means otherthan flashing an LED, the more interesting debugging problems arelikely to be timing-related and hence very hard to reproduce and trackdown. The re-usable components can provide debugging assistance invarious ways. They can provide functionality that can be exploited bysource level debuggers such as gdb, for example per-thread debugginginformation. They can also contain various assertions so that problemscan be detected early on, tracing mechanisms to figure out whathappened before the assertion failure, and so on. Of course all ofthese involve overheads, especially code size, and affect the timing.Allowing users to control which debugging features are enabled for anygiven application build is very desirable.</para><para>However, although it is desirable for re-usable components to provideappropriate configuration options this is not required. It is possibleto produce a package which does not provide a single configurationoption&nbsp;&mdash;&nbsp;although the user still gets to choosewhether or not to use the package. In such cases it is still necessaryto provide a minimal CDL script, but its main purpose would be tointegrate the package with the component framework's build system.</para></sect1><!-- }}} --><!-- {{{ Approaches             --> <sect1 id="overview.approaches"><title>Approaches to Configurability</title><para>The purpose of configurability is to control the behavior ofcomponents. A scheduler component may or may not support time slicing;it may or may not support multiple priorities; it may or may notperform error checking on arguments passed to the scheduler routines.In the context of a desktop application a button widget may containsome text or it may contain a picture; the text may be displayed in avariety of fonts; the foreground and background color may vary. Whenan application uses a component there must be some way of specifyingthe desired behavior. The component writer has no way of knowing inadvance exactly how a particular component will end up being used.</para><para>One way to control the behavior is at run time. The applicationcreates an instance of a button object, and then instructs this objectto display either text or a picture. No special effort by theapplication developer is required, since a button can always supportall desired behavior. There is of course a major disadvantage interms of the size of the final application image: the code that getslinked with the application has to provide support for all possiblebehavior, even if the application does not require it.</para><para>Another approach is to control the behavior at link-time, typicallyby using inheritance in an object-oriented language. The buttonlibrary provides an abstract base class <classname>Button</classname>and derived classes <classname>TextButton</classname> and<classname>PictureButton</classname>. If an application only uses textbuttons then it will only create objects of type<classname>TextButton</classname>, and the code for the<classname>PictureButton</classname> class does not get used. Inmany cases this approach works rather well and reduces the final imagesize, but there are limitations. The main one is that you can onlyhave so many derived classes before the system gets unmanageable: aderived class<classname>TextButtonUsingABorderWidthOfOnePlusAWhiteBackgroundAndBlackForegroundAndATwelvePointTimesFontAndNoErrorCheckingOrAssertions</classname>is not particularly sensible as far as most application developers areconcerned.</para><para>The &eCos; component framework allows the behavior of components tobe controlled at an even earlier time: when the component source codegets compiled and turned into a library. The button component couldprovide options, for example an option that only text buttons need tobe supported. The component gets built and becomes part of a libraryintended specifically for the application, and the library willcontain only the code that is required by this application and nothingelse. A different application with different requirements would needits own version of the library, configured separately.</para><para>In theory compile-time configurability should give the best possibleresults in terms of code size, because it allows code to be controlledat the individual statement level rather than at the function orobject level. Consider an example more closely related to embeddedsystems, a package to support multi-threading. A standard routinewithin such a package allows applications to kill threadsasynchronously: the POSIX routine for this is<function>pthread_cancel</function>; the equivalent routine in &uITRON;is <function>ter_tsk</function>. These routines themselves tend toinvolve a significant amount of code, but that is not the realproblem: other parts of the system require extra code and data for the

⌨️ 快捷键说明

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