CMSIS-Pack: /package/conditions element

| CMSIS-Pack Version 1.4.1 Delivery Mechanism for Software Packs

- Main Page
- Usage and Description

All Pages
/package/conditions element

The grouping element /package/conditions contains all conditions defined for the Software Pack.

A condition describes dependencies on device, processor, and tool attributes as well as the presence of other components. The conditions are used to define AND and OR rules used to make components conditional and therefore only available under certain circumstances, e.g. for specific devices or processors. The conditions are also used to express dependencies between components.

Each condition has an id that is unique within the scope of a the description. An id can be referenced in the condition attribute of components, apis, examples, files and other conditions to become conditional. If a condition resolves to false during the processing of the description, the respective element will be ignored.

Example:

<conditions>
<condition id="CM4"> <!-- defines the condition with the ID "CM4" -->
<description>True if the active device has a Cortex-M4 processor</description>
<require Dcore="Cortex-M4"/> <!-- device has a Cortex-M4 processor -->
</condition>
<condition id="Cortex-M"> <!-- defines the condition with the ID "Cortex-M" -->
<description>True if the active device has a Cortex-M0 or Cortex-M0+ or Cortex-M3 or Cortex-M4 or SC000 or SC3000 processor </description>
<accept Dcore="Cortex-M0"/> <!-- any of the following cores will make the condition resolve to true -->
<accept Dcore="Cortex-M0+"/>
<accept Dcore="Cortex-M3"/>
<accept Dcore="Cortex-M4"/>
<accept Dcore="SC000"/>
<accept Dcore="SC300"/>
</condition>
<condition id="CMSIS-CORE"> <!-- defines the condition with the ID "CMSIS-CORE" -->
<description>True if the component Device Startup is selected and the device has a Cortex-M processor</description>
<require Cclass="Device" Cgroup="Startup"/> <!-- needs a software component Device Startup AND ... -->
<require condition="Cortex-M"/> <!-- ... needs that condition with ID=Cortex-M to be true. -->
</condition>
<condition id="CMSIS-DSP"> <!-- defines the condition with the ID "CMSIS-DSP" -->
<description>True if CMSIS-CORE == TRUE and either GCC or ARMCC and device running in little-endian byte ordering</description>
<require condition="CMSIS-CORE"/> <!-- needs a software component Device Startup AND ... -->
<accept Tcompiler="GCC"/> <!-- ... works either with the GCC compiler OR ... -->
<accept Tcompiler="ARMCC"/> <!-- ... the ARMCC compiler AND ... -->
<require Dendian="Little-endian"/> <!-- ... requires a device running in little-endian byte ordering -->
</condition>
<condition id="No STM32"> <!-- defines the condition with ID "No STM32" -->
<description>False if the device is from ST and the device name starts with "STM32"</description>
<deny Dvendor="STMicroelectronics:13" Dname="STM32*"/> <!-- device name must not start with STM32 and be from vendor ST-->
</condition>
</conditions>

# /package/conditions

This element groups all conditions used in the Software Pack.

Parent | Chain
--- | ---
package | /package
Child Elements | Description | Type | Occurrence
condition | Define the individual dependency condition. | xs:string | 1..*

# /package/conditions/condition

Conditions are dependency rules that can apply to elements such as a component or file. Other elements can refer to a rule using their attribute condition, which links to the attribute id of a condition. If a condition resolves to false, then the component or file description is ignored.

Parent | Chain
--- | ---
conditions | /package/conditions
Attributes | Description | Type | Use
id | Condition identifier which is unique within a Software Pack. The condition identifier is referenced by other elements with the attribute condition. | xs:string | required
Child Elements | Description | Type | Occurrence
description | Descriptive (comment) text that explains the condition in an human readable way. | xs:string | 0..1
accept1 | At least one accept must be true to signal a true for the complete condition (OR-Rule) | FilterType | 0..*
require1 | All require must be true to signal a true for the complete condition (AND-Rule). | FilterType | 0..*
deny1 | If one deny is true the complete condition becomes false. This element overrules require and accept (AND-NOT-Rule). | FilterType | 0..*

Note
  1: At least one of these elements must be present in any condition.

# /package/conditions/condition/accept

# /package/conditions/condition/require

# /package/conditions/condition/deny

All attributes set in an accept, require, or deny must resolve to true for the element to become true. A condition becomes true when:

- At least one accept element is true, AND
- all require elements are true, AND
- no deny element is true.

Parent | Chain
--- | ---
accept | /package/conditions/condition/accept
require | /package/conditions/condition/require
deny | /package/conditions/condition/deny
Attributes | Description | Type | Use
Dfamily* | Specifies the device family name (for example: STM32F2 Series). | xs:string | optional
DsubFamily* | Specifies the device sub-family name (for example: STM32F205 Series). | xs:string | optional
Dvariant* | Specifies the variant name of a device (for example: Step A). | xs:string | optional
Dvendor | Specifies the silicon vendor of the device. Use predefined values as listed in the table Device Vendor. | DeviceVendorEnum | optional
Dname* | Specifies the name of the device. | xs:string | optional
Pname | Specifies the processor instance in case of multi processor devices. This allows to describe distinct conditions for a specific processor. | xs:string | optional
Dcore | Specifies a processor core. Use predefined values as listed in the table Device Cores. | DcoreEnum | optional
Dfpu | Specifies whether a Floating Point Unit (FPU) must be present or not. Predefined values can be uses as listed in the table Device FPU. | DfpuEnum | optional
Dmpu | Specifies whether a Memory Protection Unit (MPU) must be present or not. Predefined values can be uses as listed in the table Device MPU. | DmpuEnum | optional
Dendian | Specifies the endianess of a device. Use predefined values as listed in the table Endianess. | DendianEnum | optional
Cvendor* | Specifies a component vendor name. | xs:string | optional
Cbundle* | Specifies a component class bundle name. | xs:string | optional
Cclass* | Specifies a component class name. Predefined values can be used as listed in the table Component Classes. | CclassType | optional
Cgroup* | Specifies a software Component Group. Predefined values can be used as listed in the table Component Groups. | CgroupType | optional
Csub* | Specifies a software component subgroup. The type is described in Component Subgroups. | CsubType | optional
Cvariant* | Specifies a software component variant. | xs:string | optional
Cversion | Specifies a software component version. require Cversion:condition is true if version of component is equal or higher than requested. deny Cversion: condition is true if version of component is lower than requested. Version ranges are specified with min_version: max_version. The condition is true if the version of the component is equal or higher than min_version and lower or equal than max_version. If min_version and max_version are equal the version must match. For more information refer to Version Type. | VersionType | optional
Capiversion | Specifies an API version. require Capiversion:condition is true if version of API is equal or higher than requested. deny Capiversion: condition is true if version of API is lower than requested. Version ranges are specified with min_version: max_version. The condition is true if the version of the API is equal or higher than min_version and lower or equal than max_version. If min_version and max_version are equal the version must match. For more information refer to Version Type. | VersionType | optional
Tcompiler | Specifies a compiler toolchain (ARMCC, GCC, IAR, Tasking, ...). Use predefined values as listed in table Compiler Types. | CompilerEnumType | optional
condition | Refers to another condition identified through the attribute id. | xs:string | optional

*) Wild-cards can be used to match names with the following defintions:

- '*' matches any substring
- '?' matches any single character
- [abc] matches any character in the set (a,b,c)

Table: Compiler Types

The tale list values representing a C/C++ compiler toolchains from a specific tool vendor. The tokens can be used in the elements:

- /package/conditions/condition/accept
- /package/conditions/condition/require
- /package/conditions/condition/deny

Tcompiler= | Description
--- | ---
GCC | GNU Tools for ARM Embedded Processors. Refer to ARM GCC.
G++ | Code Sourcery GCC compiler for C and C++ (is now Mentor Graphics CodeBench).
ARMCC | ARM compiler for C and C++. Refer to ARM Compiler from ARM.
IAR | IAR compiler for C and C++.
Tasking | TASKING compiler for C and C++.
GHS | Green Hills Software compiler for C, C++, and EC++.