CMSIS-SVD  Version 1.3.3
CMSIS System View Description
 All Pages
SVDConv.exe

SVDConv.exe is a command-line utility to validate CMSIS-SVD files and to generate CMSIS-compliant device header files. SVDConv.exe is distributed with the ARM::CMSIS Pack (in the CMSIS\Utilities directory) together with the CMSIS-SVD schema file.

SVDConv.exe performs the following operations:

  • Checks the syntactical and structural compliance with the specified CMSIS-SVD format.
  • Checks the consistency, correctness, and completeness of the CMSIS-SVD file against the CMSIS-SVD schema file.
  • Generates CMSIS-compliant device header files, which can be used for software development.

Operation

SVDConv.exe is invoked form the command line. The general command format is:

SVDConv.exe <SVD_file> <options>

 

<options> Short Name Description
none Validation Perform a validation check of the SVD file. Errors and warnings are printed on screen.
-b Log File Specify the log file name for writing messages. Default: screen.
-o Output Path Specify an output path for the generated device header file or log file. Default: current directory.
--generate=header Generate Device Header File Generates the device header file. The name of the generated file is derived from the value of the tag <device<name> in the CMSIS-SVD file. Refer to device.
--generate=partition Generate Partition file for Cortex-M Security Extensions (ARMv8M) Generates the device partition file. The name of the generated file is composed of partition_ and the value of the device <name> (for example, partition_CMSDK_ARMv8MBL.h). Refer to /device element. The content of the file uses Configuration Wizard annotations and is derived from the SAU-specific information of the /device/cpu/sauRegionsConfig element and the interrupts specified in the /device/peripherals element.
--fields=enum Bit-field Enums Generates enum lists for each field value description contained in the CMSIS-SVD input file. Must be used in combination with --generate=header.
--fields=macro Bit-field Macros Generates position and mask C-Macros for each field description contained in the CMSIS-SVD input file. Must be used in combination with --generate=header.
--fields=struct Bit-field Structs Generates bit fields for each field description contained in the CMSIS-SVD input file. Must be used in combination with --generate=header.
--fields=struct-ansic ANSI Bit-field Structs Generates MISRA-compliant structures for each bitfield. The generated code is not CMSIS-compliant! Must be used in combination with --generate=header.

Return Codes

SVDConv.exe returns the following codes:

Code Description Action
0 OK No action required. Validation and conversion performed without errors.
1 WARNINGS Warnings should be checked an possibly removed. The header file is created and could be used.
2 ERRORS Errors in the SVD description file. Important elements are missing and must be corrected.
3 Error in command line Check and correct the command line arguments.

Examples

  1. Retrieve help information on screen.
    SVDConv.exe

  2. Perform a consistency check by passing only the SVD file name. Errors and warnings are printed on screen.
    SVDConv.exe ARM_Example.svd

    The result is printed on screen:
       MVCM3110.svd(1688) : info
       <description> missing for value '2 : MODE2'
       MVCM3110.svd(1692) : info
       <description> missing for value '3 : MODE3'
       MVCM3110.svd(1696) : info
       <description> missing for value '4 : MODE4'
       Area of improvements:
       * Description contains 267 <fields> defined without associated <enumeratedValues>
       Found 0 Errors and 1 Warnings
       Return Code: 1 (WARNINGS)

  3. Generate the header file. Performs a consistency check. Errors and warnings are printed on screen.
    SVDConv.exe ARM_Example.svd --generate=header

    Code snippet from the generated header file showing the structure for TIMER0.
    /* ================ TIMER0 ================ */
    typedef struct {
    __IO uint32_t CR;
    __IO uint16_t SR;
    __I uint16_t RESERVED0[5];
    __IO uint16_t INT;
    __I uint16_t RESERVED1[7];
    __IO uint32_t COUNT;
    __IO uint32_t MATCH;
    union {
    __O uint32_t PRESCALE_WR;
    __I uint32_t PRESCALE_RD;
    };
    __I uint32_t RESERVED2[9];
    __IO uint32_t RELOAD[4];
    } TIMER0_Type;

  4. Generate the header file containing bit fields. Performs a consistency check. Errors and warnings are printed on screen.
    SVDConv.exe ARM_Example.svd --generate=header --fields=struct

    Code snippet from the generated header file showing the structure for TIMER0.
    Compare to the code snippet above.
    /* ================ TIMER0 ================ */
    typedef struct {
    union {
    __IO uint32_t CR;
    struct {
    __IO uint32_t EN : 1;
    __O uint32_t RST : 1;
    __IO uint32_t CNT : 2;
    __IO uint32_t MODE : 3;
    __IO uint32_t PSC : 1;
    __IO uint32_t CNTSRC : 4;
    __IO uint32_t CAPSRC : 4;
    __IO uint32_t CAPEDGE : 2;
    uint32_t : 2;
    __IO uint32_t TRGEXT : 2;
    uint32_t : 2;
    __IO uint32_t RELOAD : 2;
    __IO uint32_t IDR : 2;
    uint32_t : 3;
    __IO uint32_t S : 1;
    } CR_b;
    };
    union {
    __IO uint16_t SR;
    struct {
    __I uint16_t RUN : 1;
    uint16_t : 7;
    __IO uint16_t MATCH : 1;
    __IO uint16_t UN : 1;
    __IO uint16_t OV : 1;
    uint16_t : 1;
    __I uint16_t RST : 1;
    uint16_t : 1;
    __I uint16_t RELOAD : 2;
    } SR_b;
    };
    __I uint16_t RESERVED0[5];
    union {
    __IO uint16_t INT;
    struct {
    __IO uint16_t EN : 1;
    uint16_t : 3;
    __IO uint16_t MODE : 3;
    } INT_b;
    };
    __I uint16_t RESERVED1[7];
    __IO uint32_t COUNT;
    __IO uint32_t MATCH;
    union {
    __O uint32_t PRESCALE_WR;
    __I uint32_t PRESCALE_RD;
    };
    __I uint32_t RESERVED2[9];
    __IO uint32_t RELOAD[4];
    } TIMER0_Type;