Skip to content

Latest commit

 

History

History
702 lines (587 loc) · 41.1 KB

YML-CBuild-Format.md

File metadata and controls

702 lines (587 loc) · 41.1 KB

Build Information Files

CMSIS-Toolbox > Build Information Files

The following chapter explains the YAML CBuild format that describes how to build a complete application.

Table of Contents

CBuild Output Files

The following output files are generated by the csolution tool. Depending on options, the files *.cbuild-pack.yml and *.cbuild-set.yml are also used as input file.

File Description
*.cbuild-idx.yml Index file of all *.cbuild.yml build descriptions; contains also overall information for the application.
*.cbuild.<build-type>+<target-type>.yml Build description of a single *.cproject.yml input file; contains all information for the build step for a specific context including references to the content used from software packs.
*.cbuild-pack.yml Software packs recorded for the all input files (*.csolution.yml, cproject.yml, and .clayer.yml); used as input file to ensure reproducible builds that use the same software packs and pack versions.
*.cbuild-set.yml Context selection for the build process, enabled with option --context-set:.

Directory Structure

As csolution based projects should be portable across different host computers, relative file references are used within the directory structure.

  • All file references use relative paths to the base directory of the related *.yml file. Files that are within the file structure of the csolution base directory are also referenced using relative paths, i.e. ../layers/layer1/source-file1.c.

  • Files that are located in the CMSIS-Pack root directory are prefixed with ${CMSIS_PACK_ROOT}.

Note:

All file references to user source code should be relative paths. The prefixes ${CMSIS_PACK_ROOT} and ${CMSIS_COMPILER_ROOT} are used to refer to base directories of files that relate to software packs and compiler specific files. This base directories can also be on different filesystem drives.

  • Files outside of the directory structure of csolution based application use absolute paths. If absolute paths are used, a warning is issued in the *.cbuild-idx.yml file.

A typical directory structure of a csolution based application that uses common layers source files is shown below.

📦 # csolution base directory
 ┣ myapp.csolution.yml
 ┣ myapp.cbuild-idx.yml
 ┣ myapp.cbuild-pack.yml
 ┣ myapp.cbuild-set.yml
 ┣ 📂 project1
 ┃  ┣  mypro1.cproject.yml
 ┃  ┣  mypro1.cbuild.yml       # file references are relative to directory project1
 ┣ 📂 project2
 ┃  ┣  mypro2.cproject.yml
 ┃  ┣  mypro2.cbuild.yml       # file references are relative to directory project2
 ┣ 📂 layer
 ┃  ┣  mylayer.clayer.yml

Pack locking

An application contains a set of packs coming from different places, e.g. from the csolution directly, or indirectly from cprojects or clayers. In order to have consistent pack usage in the application, as well as allowing projects to evolve and add new target-types or build-types but still remain on the same shared pack versions, the cbuild-pack.yml is introduced.

It works in the following way. An entire application has a set of pack requirements. These requirements can come from many different locations or contexts, and may be:

  • specified exactly, e.g. ARM::[email protected]
  • specified with range, e.g. ARM::CMSIS@>=5.8.0
  • specified without version, e.g. ARM::CMSIS
  • specified with wildcards on the pack name, e.g. ARM::CMSI*
  • specified without pack name, e.g. ARM

All these pack requirements are resolved into exact versions in the cbuild-pack.yml file as a list of items on the following format:

cbuild-pack:
  resolved-packs:
    - resolved-pack: ARM::[email protected]
      selected-by-pack:
        - ARM
        - ARM::CMSI*
        - ARM::CMSIS
        - ARM::CMSIS@>=5.8.0
        - ARM::[email protected]

If a context is added or changed, the selected-by is used to ensure that the pack requirements are resolved to a consistent pack version, reducing surprising versions being selected in the entire application. If a pack requirement is no longer present in the application, then the cbuild-pack.yml file will be cleaned from the relevant entries during the cbuild-pack.yml-generation step.

The location of the cbuild-pack.yml file follows the csolution.yml file.

  • convert - Uses and updates cbuild-pack.yml
  • list ... - Uses cbuild-pack.yml
  • run - Uses cbuild-pack.yml
  • update-rte - Uses and updates cbuild-pack.yml
graph TD;
  csolution.yml
  cbuild-pack.yml
  cproject.yml

subgraph Loading
  res1["<center><u>Resolving step 1 (PopulateContexts)</u></center><ul><li>Reading the files</li><li>Adds cbuild-pack.yml\npack requirements to the solution</li></ul>"]
  res2["<center><u>Resolving step 2 (AddPackRequirements)</u></center><ul><li>Pack version ranges are matched to fully qualified versions using cbuild-pack.yml</li><li>Pack wildcards are matched to fully qualified versions using cbuild-pack.yml</li><li>Pack wildcards are kept for further expansion in the model</li><li>Local packs are left as-is</li></ul>"]
  style res1 text-align:left
  style res2 text-align:left
end

  action["<u>Some action</u>\ne.g. convert, list, run, update-rte, ..."]

subgraph Saving
  res3["<center><u>Resolving step 3 (GenerateCbuildPack)</u></center><ul><li>Rebuild list of packs required by all contexts</li><li>Ensure that original 'pack expression' are kept in cbuild-pack.yml</li></ul>"]
  write["<center><u>Potentially write cbuild-pack.yml</u></center><ul><li>Only done for the [convert, update-rte] commands</li></ul>"]
  style res3 text-align:left
end

  csolution.yml --> res1
  cbuild-pack.yml --> res1
  cproject.yml --> res1

  res1 --> res2
  res2 --> action
  action --> res3
  res3 --> write
Loading

This means that the cbuild-pack.yml information is used to load the appropriate fully qualified pack versions, matching previously used version ranges and pack wildcards. Subsequent runs, and newly added contexts, can therefore use the least surprising versions.

File Structure of *.cbuild-idx.yml

build-idx: Content
    generated-by: Reference to csolution tool along with version information used to generate this application.
    description: Brief description text copied from the *.csolution.yml input file used to generate this application.
    cdefault: Relative path and name of the *.cdefault.yml input file used to generate this application.
    csolution: Relative path and name of the *.csolution.yml input file used to generate this application.
    configurations: For reference applications with undefined layers: list of potential project configurations for a reference application with undefined layers
    cprojects: List of *.cproject.yml and *.clayer.yml input files used to generate this application.
    cbuilds: List of *.cbuild.yml output files that are generated for this application.
    select-compiler: For projects with unspecified compiler: list of available compilers for selection

Example:

build-idx:
  generated-by: csolution version 2.3.0
  description: USB application examples sharing board layers.
  cdefault: cdefault.yml
  csolution: USB.csolution.yml
  configurations:
    - target-type: B-U585I-IOT02A
      target-configurations:
        - configuration:
            - variables:
                - Board-Layer: /Users/.../Arm/Packs/Keil/B-U585I-IOT02A_BSP/2.0.0-dev0/Layers/IoT/Board.clayer.yml
  cprojects:
    - cproject: Device/HID/HID.cproject.yml
      clayers:
        - clayer: $Board-Layer$
    - cproject: Device/MassStorage/MassStorage.cproject.yml
      clayers:
        - clayer: $Board-Layer$
  cbuilds:
    - cbuild: Device/HID/HID.Debug+B-U585I-IOT02A.cbuild.yml
      project: HID
      configuration: .Debug+B-U585I-IOT02A
    - cbuild: Device/MassStorage/MassStorage.Release+B-U585I-IOT02A.cbuild.yml
      project: MassStorage
      configuration: .Release+B-U585I-IOT02A
  errors: true                  # indicates error
  packs-missing:                # lists missing packs 
    - pack: ARM::CMSIS-RTX      # with unspecified version
    - pack: ARM::[email protected]    # with specified version

File Structure of *.cbuild.yml

The cbuild.yml file is structured into several sections. The top-level structure is outlined below.

build: Content
    generated-by: Reference to csolution tool along with version information used to generate this application.
    context: Project context of this build description.
    compiler: Compiler toolchain used for code generation.
    board: Board name used for this context.
    board-pack: BSP that is defining the Board name used for this context.
    device: Device name with processor core selection used in this project context.
    device-pack: DFP that is defining the Device name with processor core selection used in this project context.
    processor: List of processor attributes used in this project context.
    packs: List of software packs along with path information used to generate this project context.
    optimize: Generic optimize level for code generation.
    debug: Global control the generation of debug information.
    warnings: Global control warning level for compiler diagnostics.
    misc: Global control of miscellaneous literal tool-specific controls.
    define: List of global define symbol settings.
    add-path: List of global include path settings.
    output-type: Select the output type (exe or lib) for this project context.
    output-dirs: Specifies the directories used to generate the output files.
    linker: Specifies the linker script processing used to generate the output files.
    components: List of software components used.
    apis: List of API interfaces used.
    groups: List of source file groups along with source files.
    constructed-files: List of files that are generated by RTE management of csolution tool.

Example:

build:
  context: HelloWorld_cm0plus.Debug+FRDM-K32L3A6
  compiler: AC6
  device: K32L3A60VPJ1A:cm0plus
  processor:
    fpu: off
    endian: little
    trustzone: non-secure
  packs:
    - pack: ARM::[email protected]
      path: ${CMSIS_PACK_ROOT}/ARM/CMSIS/5.9.0
    - pack: NXP::[email protected]
      path: ${CMSIS_PACK_ROOT}/NXP/K32L3A60_DFP/15.0.0
  optimize: none
  debug: on
  misc:
    C:
      - -std=c99
      - -fno-builtin
    CPP:
      - -fno-builtin
    Link:
      - --diag_suppress 6314
      - --entry=Reset_Handler
  define:
    - CPU_K32L3A60VPJ1A_cm0plus
    - MCMGR_HANDLE_EXCEPTIONS=1
           :
    - _RTE_
  add-path:
    - ../middleware/multicore/mcmgr/src
    - RTE/Board_Support/K32L3A60VPJ1A_cm0plus
    - RTE/_HelloWorld_cm0plus.Debug_FRDM-K32L3A6
    - ${CMSIS_PACK_ROOT}/ARM/CMSIS/5.9.0/CMSIS/Core/Include
    - ${CMSIS_PACK_ROOT}/NXP/K32L3A60_DFP/15.0.0
            :
  output-type: exe
  output-dirs:
    gendir: generated
    intdir: ../tmp/HelloWorld_cm0plus/FRDM-K32L3A6/Debug
    outdir: ../out/HelloWorld_cm0plus/FRDM-K32L3A6/Debug
    rtedir: RTE
  components:
    - component: ARM::CMSIS:[email protected]
      condition: ARMv6_7_8-M Device
      from-pack: ARM::[email protected]
      selected-by: ARM::CMSIS:CORE
    - component: NXP::Device:CMSIS:[email protected]
      condition: device.K32L3A60_AND_device.K32L3A60_CMSIS
      from-pack: NXP::[email protected]
      selected-by: NXP::Device:CMSIS:K32L3A60_system
      files:
        - file: ${CMSIS_PACK_ROOT}/NXP/K32L3A60_DFP/15.0.0/system_K32L3A60_cm0plus.c
          category: sourceC
    - component: NXP::Device:SDK Drivers:[email protected]
      condition: device.K32L3A60_AND_driver.common
      from-pack: NXP::[email protected]
      selected-by: NXP::Device:SDK Drivers:clock
      files:
        - file: ${CMSIS_PACK_ROOT}/NXP/K32L3A60_DFP/15.0.0/drivers/fsl_clock.c
          category: sourceC
    - component: NXP::Device:SDK Drivers:[email protected]
      condition: device.K32L3A60_AND_device.K32L3A60_CMSIS_AND_driver.clock
      from-pack: NXP::[email protected]
      selected-by: NXP::Device:SDK Drivers:common
      files:
        - file: ${CMSIS_PACK_ROOT}/NXP/K32L3A60_DFP/15.0.0/drivers/fsl_common.c
          category: sourceC
        - file: ${CMSIS_PACK_ROOT}/NXP/K32L3A60_DFP/15.0.0/drivers/fsl_common_arm.c
          category: sourceC
            :
  groups:
    - group: Application
      files:
        - file: ./hello_world_core1.c
          category: sourceC
        - file: ./RTE/Device/K32L3A60VPJ1A_cm0plus/K32L3A60xxx_cm0plus_flash.scf
          category: linkerScript
    - group: Middleware
      files:
        - file: ../middleware/multicore/mcmgr/src/mcmgr.c
          category: sourceC
            :
  constructed-files:
    - file: RTE/_HelloWorld_cm0plus.Debug_FRDM-K32L3A6/RTE_Components.h
      category: header

File Structure of *.cbuild-pack.yml

The cbuild-pack.yml file is structured into several sections. The top-level structure is outlined below.

cbuild-pack: Content
    resolved-packs: List of packs used to create the project contexts.
resolved-packs: Content
- resolved-pack: pack name used.
    selected-by-pack: List of components included from the pack.

Example:

cbuild-pack:
  resolved-packs:
    - resolved-pack: ARM::[email protected]
      selected-by:
        - ARM::CMSIS
    - resolved-pack: ARM::[email protected]
      selected-by:
        - ARM::[email protected]
    - resolved-pack: Keil::[email protected]
      selected-by:
        - Keil::ARM_Compiler

File Structure of *.cbuild-set.yml

The cbuild-set.yml file is structured into several sections. The top-level structure is outlined below.

cbuild-set: Content
    generated-by: Reference to tool along with version information that generated this file.
    contexts: List of context names for the context-set: option.

Example:

cbuild-set:
  generated-by: csolution version 2.2.0
  contexts:
    - context: CM33_s.Release+AVH
    - context: CM33_ns.Debug+AVH

CBuild-specific Nodes

configurations:

The configurations: node lists possible configurations for reference applications that have undefined variable settings.

configurations: Content
- target-type: Name of target-type for which configurations are listed.
   target-configurations: List of possible configurations for the target-type.
   - configuration: Possible configuration for the reference application.
      - variables: List of variable names with configuration information.
         <layer-name>: Layer name with value that is the path to the clayer.yml file.
         description: Brief description text taken from *.clayer.yml.
         settings: Usage instructions for this layer.
         - set: Value of set and info taken from connect: in *.clayer.yml.
         path: Path to the directory that contains the layer (from *.PDSC file).
         file: Name of the *.clayer.yml file (optional with relative path to the directory specified with path) (from *.PDSC file).
         copy-to: Proposed directory for the layer in the csolution project (from *.PDSC file).

Example:

  configurations:
    - target-type: B-U585I-IOT02A
      target-configurations:
        - configuration:
            - variables:
              - Board-Layer: /Users/.../Arm/Packs/Keil/B-U585I-IOT02A_BSP/2.0.0-dev0/Layers/IoT/Board.clayer.yml
                description: "Configuration including FXLS8962 sensor"

    - target-type: MyBoard
        - configuration:
            - variables:
              - Board-Layer: ./layer/board/frdmk22f/frdmk22f.clayer.yml
                description: "Configuration: Ethernet, UART, and WiFi"
                settings:
                - set: set1.select1 (connect A - set 1 select 1)
                path: ./layer/board/frdmk22f
                file: frdmk22f.clayer.yml
                copy-to: board/frdmk22f
              - Shield-Layer: ./layer/shield/agmp03/agmp03.clayer.yml
                description: "Shield with FXLS8962 and FXAS21002"
                settings:
                - set: Bus.SPI (FXLS8962 SPI Bus - Jumper configuration: I2C/SPI=SPI)
                - set: Bus.SPI (FXAS21002 SPI Bus - Jumper configuration: I2C/SPI=SPI)
                path: ./layer/board/frdmk22f
                file: frdmk22f.clayer.yml
                copy-to: board/frdmk22f

cprojects:

The cprojects: node lists all *.cproject.yml input files along with *.clayer.yml files that are used to compose the application.

cprojects: Content
- cproject: Relative path and name of a *.cproject.yml input file.
   clayers: List of *.clayer.yml input files used by this *.cproject.yml file.

Example:

  cprojects:
    - cproject: AWS_MQTT_MutualAuth_SW_Framework/Demo.cproject.yml
      clayers:
        - clayer: AWS_MQTT_MutualAuth_SW_Framework/Socket/FreeRTOS+TCP/Socket.clayer.yml
        - clayer: AWS_MQTT_MutualAuth_SW_Framework/Socket/WiFi/Socket.clayer.yml
        - clayer: AWS_MQTT_MutualAuth_SW_Framework/Socket/VSocket/Socket.clayer.yml
             :

cbuilds:

The cbuilds: node lists all project context configurations that are generated with this build.

cbuilds: Content
- cbuild: Build description file of a single context for a *.cproject.yml input file;
   project: Project name
   configuration: Context configuration for this build description file
    errors: Error indication
    packs-missing: List of missing packs
    messages: List of errors:, warnings:, or info: messages

Example:

  cbuilds:
    - cproject: AWS_MQTT_MutualAuth_SW_Framework/Demo.cproject.yml
      project: Demo
      configuration: .Debug+AVH
      errors: true
      messages:
        errors:
          - no compatible software layer found. Review required connections of the project
        info:
          - test.cbuild-set.yml - file is already up-to-date

select-compiler:

If no compiler is specified in the csolution project, the cbuild setup command lists the available compilers based on the compiler registration and select-compiler: node in the file *.csolution.yml or cdefault.yml.

Note: New in CMSIS-Toolbox 2.5.0

select-compiler: Content
- compiler: Name (optionally with version) of the compiler toolchain; copied from the select-compiler: node in the csolution project.

packs:

The packs: node is the start of a pack list that is used for the project context.

packs: Content
- pack: Explicit pack specification with exact version information used.
   path: Path name that stores the software pack (see note).

Note:

Packs that are located in the CMSIS-Pack root directory are prefixed with %CMSIS_PACK_ROOT%.

Example:

  packs:
    - pack: ARM::[email protected]
      path: ${CMSIS_PACK_ROOT}/ARM/CMSIS-FreeRTOS/10.4.6
    - pack: ARM::[email protected]
      path: ${CMSIS_PACK_ROOT}/ARM/CMSIS/5.9.0
       :
    - pack: MDK-Packs::[email protected]
      path: ../IoT_Socket

generators:

The generators: node contains information for calling a generator.

generators: Content
- generator: Section for a specific generator.
    path: Path name for storing the files generated.
    gdpsc: File name of the *.GDPSC file that stores the information in path:.
    command: Section for invoking the generator on different Host operating systems.

Example:

  generators:
    - generator: STM32CubeMX
      path: RTE/Device
      gpdsc: RTE/Device/STM32L475VGTx/FrameworkCubeMX.gpdsc
      command:
        win:
          file: ${CMSIS_PACK_ROOT}/Keil/STM32L4xx_DFP/2.6.1/MDK/CubeMX/STM32CubeMxLauncher.exe
          arguments:
            - STM32L475VGTx
            - ../../Release+STM32L4.cprj
            - ${CMSIS_PACK_ROOT}/Keil/STM32L4xx_DFP/2.6.1

Source File Management

Keyword Description
groups: Start of a list that adds source groups and files.
components: Start of a list that adds software components.

linker:

linker: Content
- regions: Path and file name of regions_<device_or_board>.h, used to generate a Linker Script via pre-processor.
- script: Path and file name of the Linker Script template that is pre-processed.
- define: Define symbol settings for the linker script file preprocessor.

groups:

groups: Content
- group: Name of the group.
    optimize: Optimize level for code generation.
    debug: Generation of debug information.
    warnings: Control generation of compiler diagnostics.
    define: Define symbol settings for code generation.
    add-path: Additional include file paths.
    misc: Literal tool-specific controls.
    groups: Start a nested list of groups.
    files: List of files that belong to a group

files: of a group

files: Content
- file: Name of the file.
    category: File category according Open-CMSIS-Pack specification
    optimize: Optimize level for code generation.
    debug: Generation of debug information.
    warnings: Control generation of compiler diagnostics.
    define: Define symbol settings for code generation.
    add-path: Additional include file paths.
    misc: Literal tool-specific controls.

components:

components: Content
- component: Name of the software component.
    condition: Reference to the condition ID of the software pack that triggered inclusion of this component.
    from-pack: Pack that defines this component.
    selected-by: The original component name used in cproject/clayer.YML.
    optimize: Optimize level for code generation.
    debug: Generation of debug information.
    warnings: Control generation of compiler diagnostics.
    define: Define symbol settings for code generation.
    add-path: Additional include file paths.
    misc: Literal tool-specific controls.
    instances: Number of component instances configured.
    generator: Generator information for components that are configurable via a generator.
    implements: Refers to the API that the component is based on.
    files: List of files that belong to this component.

apis:

apis: Content
- api: Name of the API.
    condition: Reference to the condition ID of the software pack that triggered inclusion of this API.
    from-pack: Pack that defines this API.
    implemented-by: Refers to the software componeent that implements the API.
    files: List of files that belong to this API.

generator:

generator: Content
- id: Generator identifier used for this component
    path: File name and path to the *.cgen.yml file that is generated.

files: of a component

files: Content
- file: Name and path to the file.
    category: File category according Open-CMSIS-Pack specification
    attr: File category according Open-CMSIS-Pack specification; api refers to header files that define the api of a component.
    condition: Reference to the condition ID of the software pack that triggered inclusion of this file.
    select: Selection text for user code template files and api header files.
    version: For files that belong to components the version specified in the PDSC file.
    base: Unmodified configuration file (base file from the software pack) that is currently in use.
    update: New configuration file from an updated software pack.
    status: Action for configuration file update: suggested, recommended, required.

constructed-files:

A list of files that are generated by the RTE management of the csolution tool.

constructed-files: Content
- file: Name and path to the file.
    category: File category according Open-CMSIS-Pack specification

Generator Information Files

The run command of the csolution tool generates the following build information files in the intdir: of the related context. These files are the input to a generator and provide the information about the csolution project to the generator. The files are generated in the tmp directory of the project and contain absolute paths.

File Description
*.cbuild-gen-idx.yml Index file of all *.cbuild-gen.yml build descriptions; contains also overall information for the application.
*.cbuild-gen.yml Build description of a single *.cproject.yml input file. The format is identical with the *.cbuild.yml file.

File Structure of *.cbuild-gen-idx.yml

build-gen-idx: Content
    generated-by: Reference to csolution tool along with version information used to generate this application.
    generators: List of generators that are called with the run command
generators: Content
- id: generator identifier specified with the option --generator in the csolution run command.
    output: Specifies the directory for generated files
    board: Board name used for the generator
    device: Device name used for the generator
    project-type: Describes the project type "single-core", "multi-core", "trustzone"
    cbuild-gens: List of *.cbuild-gen.yml files with options that are generated for the generator run
cbuild-gens: Content
- cbuild-gen: Build information file with name <context>.cbuild-gen.yml; structure identical with *.cbuild.yml.
    project: Project name (used as name for *.cgen.yml when name: is not specified)
    configuration: Specifies .build-type+target-type of this context.
    name: Explicit name for the *.cgen.yml generator import file specified by generator options.
    map: Mapping to a generator specific run-time context name specified by generator options.

Example:

build-gen-idx:
  generated-by: csolution version 2.3.0
  generators:
    - id: CubeMX
      output: C:/w/csolution-examples/CubeMX/STM32CubeMX/MyBoard  # output directory
      device: STM32U585AIIx
      board: B-U585I-IOT02A
      project-type: single-core
      cbuild-gens:
        - cbuild-gen: C:/w/csolution-examples/CubeMX/tmp/CubeMX/MyBoard/Debug/CubeMX.Debug+MyBoard.cbuild-gen.yml
          project: CubeMX     # user selected name of the project
          configuration: .Debug+MyBoard
          name: BoardLayer    # create BoardLayer.cgen.yml in output directory (new in CMSIS-Toolbox 2.4.0)
          map: Boot           # map to STM32CubeMX run-time context (new in CMSIS-Toolbox 2.4.0)

Generator Import File

The *.cgen.yml file is lists the generated csolution project part and starts with the node generator-import:. It defines similar to a Software Layer additional parameters, files, and components that are included in the project.

File Structure of *.cgen.yml

generator-import: Content
    generated-by: Tool name that generated this file
    for-device: Device information, used for consistency check (device selection is in *.csolution.yml).
    for-board: Board information, used for consistency check (board selection is in *.csolution.yml).
    packs: Defines packs that are required for this layer.
    define: Define symbol settings for code generation.
    undefine: Remove define symbol settings for code generation.
    add-path: Additional include file paths.
    del-path: Remove specific include file paths.
    groups: List of source file groups along with source files.
    components: List of software components used.