The eCos Component Writer's Guide
Prev |  | Next

# `cdl_component`

## Name

Command `cdl_component` -- Define a component, a collection of configuration options

## Synopsis

    cdl_component <name> {
        …
    }

## Description

A component is a configuration option that can contain additional options and sub-components. The body of a `cdl_component` can contain the same properties as that of a `cdl_option`. There is an additional property, script which allows configuration data to be split into multiple files. It is also possible for a component body to include `cdl_component`, `cdl_option` and `cdl_interface` entities that should go below this component in the configuration hierarchy.

`cdl_component` is implemented as a Tcl command that takes two arguments, a name and a body. The name must be a valid C preprocessor identifier: a sequence of upper or lower case letters, digits or underscores, starting with a non-digit character; identifiers beginning with an underscore should normally be avoided because they may clash with system packages or with identifiers reserved for use by the compiler. Within a single configuration, names must be unique. If a configuration contained two packages which defined the same entity `CYGIMP_SOME_OPTION`, any references to that entity in a requires property or any other expression would be ambiguous. It is possible for a given name to be used by two different packages if those packages should never be loaded into a single configuration. For example, architectural HAL packages are allowed to re-use certain names because a single configuration cannot target two different architectures. For a recommended naming convention see the Section called Package Contents and Layout in Chapter 2.

The second argument to `cdl_component` is a body of properties and other commands, typically surrounded by braces so that the Tcl interpreter treats it as a single argument. This body will be processed by a recursive invocation of the Tcl interpreter, extended with additional commands for the various properties that are allowed inside a `cdl_component`. The valid commands are:

active_if

  Allow additional control over the active state of this component.

calculated

  The component's value is not directly user-modifiable, it is calculated using a suitable CDL expression.

`cdl_component`

  Define a sub-component.

`cdl_interface`

  Define an interface which should appear immediately below this component in the configuration hierarchy.

`cdl_option`

  Define a configuration option which should appear immediately below this component in the configuration hierarchy.

compile

  List the source files that should be built if this component is active and enabled.

default_value

  Provide a default value for this component using a CDL expression.

define

  Specify additional `#define` symbols that should go into the owning package's configuration header file.

define_format

  Control how the component's value will appear in the configuration header file.

define_proc

  Use a fragment of Tcl code to output additional data to configuration header files.

description

  Provide a textual description for this component.

display

  Provide a short string describing this component.

doc

  The location of on-line documentation for this component.

flavor

  Specify the nature of this component.

if_define

  Output a common preprocessor construct to a configuration header file.

implements

  Enabling this component provides one instance of a more general interface.

legal_values

  Impose constraints on the possible values for this component.

make

  An additional custom build step associated with this component, resulting in a target that should not go directly into a library.

make_object

  An additional custom build step associated with this component, resulting in an object file that should go into a library.

no_define

  Suppress the normal generation of a preprocessor `#define` symbol in a configuration header file.

parent

  Control the location of this component in the configuration hierarchy.

requires

  List constraints that the configuration should satisfy if this component is active and enabled.

script

  Include additional configuration information from another CDL script

## Example

    cdl_component CYGDBG_USE_ASSERTS {
        display       "Use asserts"
        default_value 1
        description   "
            If this component is enabled, assertions in the code are
            tested at run-time. Assert functions (CYG_ASSERT()) are
            defined in 'include/cyg/infra/cyg_ass.h' within the 'install'
            tree. If the component is disabled, these result in no
            additional object code and no checking of the asserted
            conditions."
        script        assert.cdl
    }

## See Also

Command `cdl_option`, command `cdl_package`, command `cdl_interface`.

Prev | Home | Next
`cdl_option` | Up | `cdl_package`