Skip to content

[GPDSC Spec clarification]: Do "csolution" uses the GPDSC file content to override the PDSC definition of components ? #317

@BadreddineBJA

Description

@BadreddineBJA

GPDSC Spec clarification

1. Assumptions:

  • The GPDSC .xsd schema is the same as the PDSC schema, hence any PDSC element declared in the spec should be supported by the GPDSC.
  • The GPDSC is parsed by csolution and used as a mean to override the PDSC definition of components.

2. Scenario example description:

a. Use a packA PDSC definition like the following:

<?xml version="1.0" encoding="UTF-8" ?>
<package xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" schemaVersion="1.7.2" xs:noNamespaceSchemaLocation="https://github.com/Open-CMSIS-Pack/Open-CMSIS-Pack-Spec/blob/main/schema/PACK.xsd">
    <vendor>STMicro</vendor>
    <name>packA</name>
    <description>Pack A description</description>
    <generators>
        <generator id="GEN-1">
            <description>GEN1 generator</description>
            <exe>
                <command host="win">gen.bat</command>
                <command host="linux">gen.sh</command>
                <!-- Generator Id -->
                <argument>GEN-1</argument>
                <!-- Generator Input File absolute path -->
                <argument>$G</argument>
                <!-- GPDSC Template File Name -->
                <argument>template_model.gpdsc.hbs</argument>
            </exe>
            <gpdsc name="$P/template_model.gpdsc"/>
        </generator>
    </generators>
    <components>
        <component Cclass="Device" Cgroup="generated" Csub="compA" Cversion="0.0.1" generator="GEN-1">
            <description>compA description</description>
            <RTE_Components_h>
                <!-- the following content goes into file 'RTE_Components.h' -->
				#define _RTE_COMPA_FROM_PDSC
            </RTE_Components_h>
            <Pre_Include_Global_h>
                <!-- the following content goes into file 'Pre_Include_Global.h' -->
				#define PRE_INCLUDE_GLOBAL_COMPA_FROM_PDSC
            </Pre_Include_Global_h>
            <Pre_Include_Local_Component_h>
                <!-- the following content goes into file 'Pre_Include_Local_<ComponentId>.h' -->
				#define PRE_INCLUDE_LOCAL_COMPA_FROM_PDSC
            </Pre_Include_Local_Component_h>
            <files>
                <file category="genAsset" name="templates/compA/stm32_compA_template.c"/>
                <file category="genAsset" name="templates/compA/stm32_compA_template.h"/>
            </files>
        </component>
    </components>
</package>

b. Generate a GPDSC file with the following content:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- ******************************************************************************
 * File Name   : GPDSC_template.gpdsc
 * Description : Generator PDSC File generated (DO NOT EDIT!)
 ****************************************************************************** -->

<package xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" schemaVersion="1.0"
    xs:noNamespaceSchemaLocation="https://github.com/Open-CMSIS-Pack/Open-CMSIS-Pack-Spec/blob/main/schema/PACK.xsd">
    <vendor>STMicro</vendor>
    <name>packA</name>
    <description>Pack A description</description>
    <url>path</url>
    <generators>
        <generator id="GEN-1">
            <description>GEN1 generator</description>
            <exe>
                <command host="win">gen.bat</command>
                <command host="linux">gen.sh</command>
                <!-- Generator Id -->
                <argument>GEN-1</argument>
                <!-- Generator Input File absolute path -->
                <argument>$G</argument>
                <!-- GPDSC Template File Name -->
                <argument>template_model.gpdsc.hbs</argument>
            </exe>
            <gpdsc name="$P/template_model.gpdsc" />
        </generator>
    </generators>
    <components>
    	<component Cclass="Device" Cgroup="generated" Csub="compA" Cversion="1.0.0" generator="GEN-1">
            <description>compA description</description>
            <RTE_Components_h>
                <!-- the following content goes into file 'RTE_Components.h' -->
                #define USING_CompA_GPDSC
            </RTE_Components_h>
            <Pre_Include_Global_h>
                <!-- the following content goes into file 'Pre_Include_Global.h' -->
                #define PRE_INCLUDE_GLOBAL_compA_GPDSC
            </Pre_Include_Global_h>
            <Pre_Include_Local_Component_h>
                <!-- the following content goes into file 'Pre_Include_Local_<ComponentId>.h' -->
                #define PRE_INCLUDE_LOCAL_compA_GPDSC
            </Pre_Include_Local_Component_h>
            <files>
                <file category="source" name="stm32_compA.c" />
                <file category="header" name="stm32_compA.h" />
            </files>
        </component>
    </components>    
</package>

3. Observed Result:
The content of the RTE_<context_id> Generated files is the PDSC list of defines, the GPDSC definition of <RTE_Components_h>, <Pre_Include_Global_h>, <Pre_Include_Local_Component_h> for the same component is not taken into consideration by csolution.

RTE_Components.h generated file:

/*
 * CSOLUTION generated file: DO NOT EDIT!
 * Generated by: csolution version 2.0.0
 * Target:  'debug+main' 
 */
#ifndef RTE_COMPONENTS_H
#define RTE_COMPONENTS_H
/*
 * Define the Device Header File: 
 */
#define CMSIS_device_header "stm32u5xx.h"

/* STMicro::Device:generated:compA:0.0.1 */
#define _RTE_COMPA_FROM_PDSC**

#endif /* RTE_COMPONENTS_H */

Pre_Include_Global.h

/*
 * CSOLUTION generated file: DO NOT EDIT!
 * Generated by: csolution version 2.0.0
 * Target:  'debug+main' 
 */
#ifndef PRE_INCLUDE_GLOBAL_H
#define PRE_INCLUDE_GLOBAL_H
/* STMicro::Device:generated:compA:0.0.1 */
#define PRE_INCLUDE_GLOBAL_COMPA_FROM_PDSC**
#endif /* PRE_INCLUDE_GLOBAL_H */

Pre_Include_Local_compId.h

/*
 * CSOLUTION generated file: DO NOT EDIT!
 * Generated by: csolution version 2.0.0
 * Target:  'debug+main' 
 */

#ifndef PRE_INCLUDE_DEVICE_GENERATED_COMPA_H
#define PRE_INCLUDE_DEVICE_GENERATED_COMPA_H

/* STMicro::Device:generated:compA:0.0.1 */
#define PRE_INCLUDE_LOCAL_COMPA_FROM_PDSC

#endif /* PRE_INCLUDE_DEVICE_GENERATED_COMPA_H */

4. What is expected ?

  • GPDSC "component A" tags definitions ( <RTE_Components_h>, <Pre_Include_Global_h>, <Pre_Include_Local_Component_h> ) should override the PDSC definitions of the same component.
  • General use case: Any GPDSC component definition should override the same PDSC component definition at the convert step.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationquestionFurther information is requestedwontfixThis will not be worked on

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions