Open-CMSIS-Pack / Open-CMSIS-Pack-Spec

Common Microcontroller Software Interface Standard - Pack(age) based distribution system
https://open-cmsis-pack.github.io/Open-CMSIS-Pack-Spec/
Apache License 2.0
50 stars 19 forks source link

Provide full, readable and editable "condition" element directly in component and file element #279

Open tcsunhao opened 5 months ago

tcsunhao commented 5 months ago

In existing pdsc, the dependencies of components are specified through "condition" mechanism. On component level, just a condition refer id is provided, the detailed definitions of the condition are defined in "conditions" element. If user needs to know details of one component dependency, he needs to search up to down, down to up, many times in the "conditions" to figure out the whole picture which is quite inconvenient. When he/she tries to update it, sometimes it is possible. Here is snap of existing NXP DFP conditions: image

Suggested way to improve:

  1. Generally, put full picture of condition into component
  2. component dependencies shall be explicitly specified
  3. device, board and other hardware related dependency can still refer condition id. In this way, users can directly get full picture of the dependencies at the first glance with the most addressed component dependencies and without making the conditions too long and messy with too many hardware data. Here is one simple example: image

The same way applies to "files" element.

We believe that an human easily readable and editable pdsc files can better populate OCP solution especially in directly github repo daily development usage (not ready packs way)

GitHub repository as pack source

tcsunhao commented 5 months ago

The introduction of individual “conditions” element or something like that can be implemented in a backward compatible way.

Here is one NXP manifest dependency example: image

DavidJurajdaNXP commented 5 months ago

NXP manifest schema: sdk_manifest_v3.14.txt See line 1661: <complexType name="componentDependenciesType">

edriouk commented 5 months ago

Moving component dependencies directly into component description body is relatively easy to implement, however that will break backward and forward compatibility for several tools, in particular : uVision, CMSIS-Toolbox, packchk: all share the same C++ RTE Model
Arm DS , IAR Embedded Workbench (Java/Eclipse RTE Model)
MDK Arm CMSIS csolution VS Code Extension

edriouk commented 5 months ago

Readability can be improved by applying the following rules when constructing conditions:

  1. Use component ID as component condition
  2. Separate different types and domains of condition expressions into dedicated sub-conditions
  3. Avoid/minimize further nesting of conditions - use short but descriptive names

Here is an example of readable conditions:

<component Cclass="Device" Cgroup="SDK Drivers" CSub="common" Cversion="2.4.0" condition="Device.SDK_Drivers.common">
 <!-- component body -->
</component>
<!-- ... -->
<conditions>
  <condition id="Device.SDK_Drivers.common">
    <description> Dedicated condition for Device.SDK Drivers.common component</description>
    <require condition="Device.SDK_Drivers.common_Device"/>
    <require condition="Device.SDK_Drivers.common_Toolchain"/>
    <!-- component dependencies -->
    <require condition="Device.SDK_Drivers.common_Dependencies_Require"/>
    <require condition="Device.SDK_Drivers.common_Dependencies_Accept"/>
    <require condition="Device.SDK_Drivers.common_Dependencies_Deny"/>
  </condition>

  <condition id="Device.SDK_Drivers.common_Device">
    <description> Optional device condition to enable Device.SDK Drivers.common component</description>
    <require Dname="MIMXRT1064*"/>
  </condition>
  <condition id="Device.SDK_Drivers.common_Toolchain">
    <description> Toolchain condition to enable Device.SDK Drivers.common component or its files </description>
    <accept Tcompiler="ARM"/>
    <accept Tcompiler="GCC"/>
  </condition>
  <condition id="Device.SDK_Drivers.common_Dependencies_Require">
    <description> Required dependencies by Device.SDK Drivers.common component </description>
    <require Class="CMSIS" Cgroup="Core"/>
    <require Class="Device" Cgroup="SDK Drivers" Csub="clock"/>
  </condition>
  <condition id="Device.SDK_Drivers.common_Dependencies_accept">
    <description> Accepted dependencies by Device.SDK Drivers.common component </description>
    <accept Class="Device" Cgroup="SDK Utilities" Csub="assert"/>
    <accept Class="Device" Cgroup="SDK Utilities" Csub="assert_lite"/>
  </condition>
  <condition id="Device.SDK_Drivers.common_Dependencies_deny">
    <description> Denied dependencies by Device.SDK Drivers.common component</description>
    <deny Class="CMSIS" Cgroup="SDK Drivers" CSub="another_common"/>
  </condition>
</conditions>
tcsunhao commented 5 months ago

Thanks @edriouk, your suggestions indeed improve the readability to a certain extent. About op3, honestly, we cannot guarantee about that.