Option Naming Convention

All the options in a given configuration live in the same namespace. Furthermore it is not possible for two separate options to have the same name, because this would make any references to those options in CDL expressions ambiguous. A naming convention exists to avoid problems. It is recommended that component writers observe some or all of this convention to reduce the probability of name clashes with other packages.

There is an important restriction on option names. Typically the component framework will output a #define for every active and enabled option, using the name as the symbol being defined. This requires that all names are valid C preprocessor symbols, a limitation that is enforced even for options which have the no_define property. Preprocessor symbols can be any sequence of lower case letters a-z, upper case letters, A-Z, the underscore character _, and the digits 0-9. The first character must be a non-digit. Using an underscore as the first character is discouraged, because that may clash with reserved language identifiers. In addition there is a convention that preprocessor symbols only use upper case letters, and some component writers may wish to follow this convention.

A typical option name could be something like CYGSEM_KERNEL_SCHED_BITMAP. This name consists of several different parts:

  1. The first few characters, in this case the three letters CYG, are used to identify the organization that produced the package. For historical reasons packages produced by Red Hat tend to use the prefix CYG rather than RHAT. Component writers should use their own prefix: even when cutting and pasting from an existing CDL script the prefix should be changed to something appropriate to their organization.

    It can be argued that a short prefix, often limited to upper case letters, is not sufficiently long to eliminate the possibility of name clashes. A longer prefix could be used, for example one based on internet domain names. However the C preprocessor has no concept of namespaces or import directives, so it would always be necessary to use the full option name in component source code which gets tedious - option names tend to be long enough as it is. There is a small increased risk of name clashes, but this risk is felt to be acceptable.

  2. The next three characters indicate the nature of the option, for example whether it affects the interface or just the implementation. A list of common tags is given below.

  3. The KERNEL_SCHED part indicates the location of the option within the overall hierarchy. In this case the option is part of the scheduling component of the kernel package. Having the hierarchy details as part of the option name can help in understanding configurable code and further reduces the probability of a name clash.

  4. The final part, BITMAP, identifies the option itself.

The three-character tag is intended to provide some additional information about the nature of the option. There are a number of pre-defined tags. However for many options there is a choice: options related to the platform should normally use HWR, but numerical options should normally use NUM; a platform-related numerical option such as the size of an interrupt stack could therefore use either tag. There are no absolute rules, and it is left to component writers to interpret the following guidelines:


The ARC tag is intended for options related to the processor architecture. Typically such options will only occur in architectural or variant HAL packages.


The HWR tag is intended for options related to the specific target board. Typically such options will only occur in platform HAL packages.


This tag is intended for packages or components, in other words options which extend the configuration hierarchy. Arguably a COM tag would be more appropriate for components, but this could be confusing because of the considerable number of computing terms that begin with com.


This is intended for global configuration options, especially preferences.


The DBG tag indicates that the option is in some way related to debugging, for example it may enable assertions in some part of the system.


This tag is for testing-related options. Typically these do not affect actual application code, instead they control the interaction between target-side test cases and a host-side testing infrastructure.


This is for configuration options which affect the interface of a package. There are a number of related tag which are also interface-related. xxxFUN_ is intended primarily for options that control whether or not one or more functions are provided by the package, but can also be used if none of the other interface-related tags is applicable.


This is analogous to FUN but controls the presence or absence of one or more variables or objects.


The CLS tag is intended only for packages that provide an object-oriented interface, and controls the presence or absence of an entire class.


This is also for object-orientated interfaces, and indicates the presence or absence of a member function rather than an entire class.


A SEM option does not affect the interface (or if does affect the interface, this is incidental). Instead it is used for options which have a fundamental effect on the semantic behavior of a package. For example the choice of kernel schedulers is semantic in nature: it does not affect the interface, in particular the function cyg_thread_create exists irrespective of which scheduler has been selected. However it does have a major impact on the system's behavior.


IMP is for implementation options. These do not affect either the interface or the semantic behavior (with the possible exception of timing-related changes). A typical implementation option controls whether or not a particular function or set of functions should get inlined.


This tag is for numerical options, for example the number of scheduling priority levels.


This is for data items that are not numerical in nature, for example a device name.


The BLD tag indicates an option that affects the build process, for example compiler flag settings.


This should normally be used for CDL interfaces, which is a language construct that is largely independent from the interface exported by a package via its header files. For more details of CDL interfaces see the Section called Interfaces.


This tag is not normally used for configuration options. Instead it is used by CDL scripts to pass additional private information to the source code via the configuration header files, typically inside a define_proc property.


This tag is not normally used for configuration options. Instead it can be used by package source code to interact with such options, especially in the context of the if_define property.

There is one special case of a potential name clash that is worth mentioning here. When the component framework generates a configuration header file for a given package, by default it will use a name derived from the package name (the define_header property can be used to override this). The file name is constructed from the package name by removing everything up to and including the first underscore, converting the remainder of the name to lower case, and appending a .h suffix. For example the kernel package CYGPKG_KERNEL will involve a header file pkgconf/kernel.h. If a configuration contained some other package XYZPKG_KERNEL then this would attempt to use the same configuration header file, with unfortunate effects. Case sensitivity could introduce problems as well, so a package xyzpkg_kernel would involve the same problem. Even if the header file names preserved the case of the package name, not all file systems are case sensitive. There is no simple solution to this problem. Changing the names of the generated configuration header files would involve a major incompatible change to the interface, to solve a problem which is essentially hypothetical in nature.