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

📄 language.commands.html

📁 有关ecos2。0介绍了实时嵌入式的结构以及线程调度的实现和内存的管理等
💻 HTML
字号:
<!-- 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>CDL Commands</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 CDL Language"HREF="language.html"><LINKREL="PREVIOUS"TITLE="The CDL Language"HREF="language.html"><LINKREL="NEXT"TITLE="CDL Properties"HREF="language.properties.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="language.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Chapter 3. The CDL Language</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="language.properties.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="LANGUAGE.COMMANDS">CDL Commands</H1><P>There are four <SPANCLASS="APPLICATION">CDL</SPAN>-related commands which can occur at the top-levelof a <SPANCLASS="APPLICATION">CDL</SPAN> script: <TTCLASS="LITERAL">cdl_package</TT>, <TTCLASS="LITERAL">cdl_component</TT>, <TTCLASS="LITERAL">cdl_option</TT> and<TTCLASS="LITERAL">cdl_interface</TT>. These correspond to the basic building blocks of thelanguage (CDL interfaces are described in <AHREF="language.interface.html">the Section called <I>Interfaces</I></A>). All of these take the same basic form:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cdl_package &lt;name&gt; {    &#8230;}cdl_component &lt;name&gt; {    &#8230;}cdl_option &lt;name&gt; {    &#8230;}cdl_interface &lt;name&gt; {    &#8230;}</PRE></TD></TR></TABLE><P>The command is followed by a name and by a body of properties, thelatter enclosed in braces. Packages and components can contain otherentities, so the <TTCLASS="LITERAL">cdl_package</TT> and <TTCLASS="LITERAL">cdl_component</TT> can also havenested commands in their bodies. All names must be unique within agiven configuration. If say the C library package and a TCP/IP stackboth defined an option with the same name then it would not bepossible to load both of them into a single configuration. There is a<AHREF="language.naming.html">naming convention</A> which shouldmake accidental name clashes very unlikely.</P><P>It is possible for two packages to use the same name if there are noreasonable circumstances under which both packages could be loaded atthe same time. One example would be architectural HAL packages: agiven <SPANCLASS="APPLICATION">eCos</SPAN> configuration can be used on only one processor, so thearchitectural HAL packages <TTCLASS="VARNAME">CYGPKG_HAL_ARM</TT> and<TTCLASS="VARNAME">CYGPKG_HAL_I386</TT> can re-use option names; in factin some cases they are expected to.</P><P>Each package has one top-level <SPANCLASS="APPLICATION">CDL</SPAN> script, which is specified in thepackages <AHREF="language.database.html"><SPANCLASS="DATABASE">ecos.db</SPAN> databaseentry</A>. Typically the name of this top-level script is related tothe package, so the kernel package uses<TTCLASS="FILENAME">kernel.cdl</TT>, but this is just a convention. Thefirst command in the top-level script should be <TTCLASS="LITERAL">cdl_package</TT>, and thename used should be the same as in the <SPANCLASS="DATABASE">ecos.db</SPAN>database. There should be only one <TTCLASS="LITERAL">cdl_package</TT> command per package.</P><P>The various <SPANCLASS="APPLICATION">CDL</SPAN> entities live in a hierarchy. For example the kernelpackage contains a scheduling component, a synchronization primitivescomponent, and a number of others. The synchronization componentcontains various options such as whether or not mutex priorityinheritance is enabled. There is no upper bound on how far componentscan be nested, but it is rarely necessary to go more than three orfour levels deeper than the package level. Since the naming conventionincorporates bits of the hierarchy, this has the added advantage ofkeeping the names down to a more manageable size.</P><P>The hierarchy serves two purposes. It allows options to be controlleden masse, so disabling a component automatically disables all theoptions below it in the hierarchy. It also permits a much simplerrepresentation of the configuration in the graphical configurationtool, facilitating navigation and modification.</P><P>By default a package is placed at the top-level of the hierarchy, butit is possible to override this using a <SPANCLASS="PROPERTY">parent</SPAN> property. For examplean architectural HAL package such as <TTCLASS="VARNAME">CYGPKG_HAL_SH</TT>typically re-parents itself below <TTCLASS="VARNAME">CYGPKG_HAL</TT>, and aplatform HAL package would then re-parent itself below thearchitectural HAL. This makes it a little bit easier for users tonavigate around the hierarchy. Components, options and interfaces canalso be re-parented, but this is less common.</P><P>All components, options and interfaces that are defined directly inthe top-level script will be placed below the package in the hierarchy.Alternatively they can be nested in the body of the <TTCLASS="LITERAL">cdl_package</TT>command. The following two script fragments are equivalent:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cdl_package CYGPKG_LIBC {    &#8230;}cdl_component CYGPKG_LIBC_STRING {    &#8230;}cdl_option CYGPKG_LIBC_CTYPE_INLINES {    &#8230;}</PRE></TD></TR></TABLE><P>and:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cdl_package CYGPKG_LIBC {    &#8230;    cdl_component CYGPKG_LIBC_STRING {        &#8230;    }    cdl_option CYGPKG_LIBC_CTYPE_INLINES {        &#8230;    }}</PRE></TD></TR></TABLE><P>If a script defines options both inside and outside the body of the<TTCLASS="LITERAL">cdl_package</TT> then the ones inside will be processed first. Languagepurists may argue that it would have been better if all containedoptions and components had to go into the body, but in practice it isoften convenient to be able to skip this level of nesting and theresulting behavior is still well-defined.</P><P>Components can also contain options and other <SPANCLASS="APPLICATION">CDL</SPAN> entities, in factthat is what distinguishes them from options. These can be defined inthe body of the <TTCLASS="LITERAL">cdl_component</TT> command:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cdl_component CYGPKG_LIBC_STDIO {    cdl_component CYGPKG_LIBC_STDIO_FLOATING_POINT {        &#8230;    }    cdl_option CYGSEM_LIBC_STDIO_THREAD_SAFE_STREAMS {        &#8230;    }}</PRE></TD></TR></TABLE><P>Nesting options inside the bodies of components like this is fine forsimple packages with only a limited number of configuration options,but it becomes unsatisfactory as the number of options increases.Instead it is possible to split the <SPANCLASS="APPLICATION">CDL</SPAN> data into multiple <SPANCLASS="APPLICATION">CDL</SPAN>scripts, on a per-component basis. The <SPANCLASS="PROPERTY">script</SPAN> property should beused for this. For example, in the case of the C library allstdio-related configuration options could be put into<TTCLASS="FILENAME">stdio.cdl</TT>, and the top-level CDL script<TTCLASS="FILENAME">libc.cdl</TT> would contain the following:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cdl_package CYGPKG_LIBC {    &#8230;    cdl_component CYGPKG_LIBC_STDIO {        &#8230;        script stdio.cdl    }}</PRE></TD></TR></TABLE><P>The <TTCLASS="VARNAME">CYGPKG_LIBC_STDIO_FLOATING_POINT</TT> component andthe <TTCLASS="VARNAME">CYGSEM_LIBC_STDIO_THREAD_SAFE_STREAMS</TT> optioncan then be placed at the top-level of <TTCLASS="FILENAME">stdio.cdl</TT>.It is possible to have some options nested in the body of a<TTCLASS="LITERAL">cdl_component</TT> command and other options in a separate file accessedby the <SPANCLASS="PROPERTY">script</SPAN> property. In such a case the nested options would beprocessed first, and then the other script would be read in. A scriptspecified by a <SPANCLASS="PROPERTY">script</SPAN> property should only define new options,components or interfaces: it should not contain any additionalproperties for the current component.</P><P>It is possible for a component's <SPANCLASS="APPLICATION">CDL</SPAN> script to have a sub-componentwhich also has a <SPANCLASS="PROPERTY">script</SPAN> property, and so on. In practice excessivenesting like this is rarely useful. It is also possible to ignore the<SPANCLASS="APPLICATION">CDL</SPAN> language support for constructing hierarchies automatically anduse the <SPANCLASS="PROPERTY">parent</SPAN> property explicitly for every single option andcomponent. Again this is not generally useful.</P><DIVCLASS="NOTE"><BLOCKQUOTECLASS="NOTE"><P><B>Note: </B>At the time of writing interfaces cannot act as containers. This maychange in a future version of the component framework. If the changeis made then interfaces would support the <SPANCLASS="PROPERTY">script</SPAN> property, just likecomponents.</P></BLOCKQUOTE></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.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.properties.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">The CDL Language</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="language.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">CDL Properties</TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

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