svdsuite


Namesvdsuite JSON
Version 0.0.1 PyPI version JSON
download
home_pageNone
SummaryA Python package to parse, process, manipulate, validate, and generate CMSIS SVD files
upload_time2024-05-03 23:29:18
maintainerNone
docs_urlNone
authorChristian Kudera
requires_python>=3.10
licenseMIT License Copyright (c) 2024 ARMify Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords cmsis svd embedded systems arm cortex-m microcontroller
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # SVDSuite

**SVDSuite** is a Python package to parse, process, manipulate, validate, and generate [CMSIS SVD](https://open-cmsis-pack.github.io/svd-spec/main/index.html) files. Currently, the suite supports CMSIS-SVD standard 1.3.10-dev11, whereas the validation supports additionally standard 1.3.9.

> The CMSIS System View Description format(CMSIS-SVD) formalizes the description of the system contained in Arm Cortex-M processor-based microcontrollers, in particular, the memory mapped registers of peripherals. The detail contained in system view descriptions is comparable to the data in device reference manuals. The information ranges from high level functional descriptions of a peripheral all the way down to the definition and purpose of an individual bit field in a memory mapped register.
>
>CMSIS-SVD files are developed and maintained by silicon vendors. Silicon vendors distribute their descriptions as part of CMSIS Device Family Packs. Tool vendors use CMSIS-SVD files for providing device-specific debug views of peripherals in their debugger. Last but not least, CMSIS-compliant device header files are generated from CMSIS-SVD files. [^1]

[^1]: https://open-cmsis-pack.github.io/svd-spec/main/index.html

> [!CAUTION]
> This Python package is in early development. Code-breaking changes are to be expected!

## Installation

Install **SVDSuite** with `pip`:

```bash
  pip install svdsuite
```
    
## Usage/Examples

### Parse

To parse a CMSIS-SVD file you can utilize the `SVDParser` class.

```python
import pprint
from svdsuite import SVDParser

svd_str = """\
    <device xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
        xs:noNamespaceSchemaLocation="CMSIS-SVD.xsd" schemaVersion="1.3">
        <name>STM32F0</name>
        <version>1.0</version>
        <description>STM32F0 device</description>
        <cpu>
            <name>CM52</name>
            <revision>r0p0</revision>
            <endian>little</endian>
            <mpuPresent>false</mpuPresent>
            <fpuPresent>false</fpuPresent>
            <fpuDP>false</fpuDP>
            <dspPresent>false</dspPresent>
            <icachePresent>false</icachePresent>
            <dcachePresent>false</dcachePresent>
            <itcmPresent>false</itcmPresent>
            <dtcmPresent>false</dtcmPresent>
            <vtorPresent>false</vtorPresent>
            <nvicPrioBits>2</nvicPrioBits>
            <vendorSystickConfig>false</vendorSystickConfig>
            <deviceNumInterrupts>6</deviceNumInterrupts>
            <sauNumRegions>2</sauNumRegions>
            <sauRegionsConfig enabled="true" protectionWhenDisabled="s">
                <region enabled="true" name="Region1">
                    <base>0x1000</base>
                    <limit>0x2000</limit>
                    <access>n</access>
                </region>
            </sauRegionsConfig>
        </cpu>
        <addressUnitBits>8</addressUnitBits>
        <width>32</width>
        <peripherals>
            <peripheral derivedFrom="test">
                <name>Timer1</name>
                <version>1.0</version>
                <description>Timer 1 is a standard timer</description>
                <alternatePeripheral>Timer1_Alt</alternatePeripheral>
                <groupName>group_name</groupName>
                <prependToName>prepend</prependToName>
                <appendToName>append</appendToName>
                <headerStructName>headerstruct</headerStructName>
                <disableCondition>discond</disableCondition>
                <baseAddress>0x40002000</baseAddress>
            </peripheral>
        </peripherals>
    </device>
    """

# Parse the SVD string. Alternatively, you can use the `for_xml_file` method to parse a SVD file
# or the `for_xml_content` method to parse svd byte content.
parser = SVDParser.for_xml_str(svd_str)
# parser = SVDParser.for_xml_file("path/to/svd_file.svd")
# parser = SVDParser.for_xml_content(svd_str.encode())

# Get the SVDDevice object
device = parser.get_device()

# Print the device object
pprint.pprint(device)
```

Output:
```python
SVDDevice(
  size=None,
  access=None,
  protection=None,
  reset_value=None,
  reset_mask=None,
  xs_no_namespace_schema_location='CMSIS-SVD.xsd',
  schema_version='1.3',
  vendor=None,
  vendor_id=None,
  name='STM32F0',
  series=None,
  version='1.0',
  description='STM32F0 device',
  license_text=None,
  cpu=SVDCPU(
    name=<CPUNameType.CM52: 'CM52'>,
    revision='r0p0',
    endian=<EndianType.LITTLE: 'little'>,
    mpu_present=False,
    fpu_present=False,
    fpu_dp=False,
    dsp_present=False,
    icache_present=False,
    dcache_present=False,
    itcm_present=False,
    dtcm_present=False,
    vtor_present=False,
    nvic_prio_bits=2,
    vendor_systick_config=False,
    device_num_interrupts=6,
    sau_num_regions=2,
    sau_regions_config=SVDSauRegionsConfig(
      enabled=True,
      protection_when_disabled=<ProtectionStringType.SECURE: 's'>,
      regions=[
        SVDSauRegion(
          enabled=True,
          name='Region1',
          base=4096,
          limit=8192,
          access=<SauAccessType.NON_SECURE: 'n'>
        )
      ]
    )
  ),
  header_system_filename=None,
  header_definitions_prefix=None,
  address_unit_bits=8,
  width=32,
  peripherals=[
    SVDPeripheral(
      size=None,
      access=None,
      protection=None,
      reset_value=None,
      reset_mask=None,
      dim=None,
      dim_increment=None,
      dim_index=None,
      dim_name=None,
      dim_array_index=None,
      name='Timer1',
      version='1.0',
      description='Timer 1 is a standard timer',
      alternate_peripheral='Timer1_Alt',
      group_name='group_name',
      prepend_to_name='prepend',
      append_to_name='append',
      header_struct_name='headerstruct',
      disable_condition='discond',
      base_address=1073750016,
      address_blocks=[],
      interrupts=[],
      registers_clusters=[],
      derived_from='test'
    )
  ]
)
```

Have a look into `svdsuite/svd_model.py` for all the models (dataclasses).

### Process

Not implemented yet!

### Create/Manipulate

To create or manipulate a CMSIS-SVD file you can utilize the `SVDSerializer` class.

```python
from svdsuite import (
    SVDDevice,
    SVDCPU,
    CPUNameType,
    EndianType,
    SVDSauRegionsConfig,
    ProtectionStringType,
    SVDSauRegion,
    SauAccessType,
    SVDPeripheral,
    SVDSerializer,
)

# Create an example device. Alternatevily, you can parse a CMSIS-SVD file and manipulate it.
device = SVDDevice(
    size=None,
    access=None,
    protection=None,
    reset_value=None,
    reset_mask=None,
    xs_no_namespace_schema_location="CMSIS-SVD.xsd",
    schema_version="1.3",
    vendor=None,
    vendor_id=None,
    name="STM32F0",
    series=None,
    version="1.0",
    description="STM32F0 device",
    license_text=None,
    cpu=SVDCPU(
        name=CPUNameType.CM52,
        revision="r0p0",
        endian=EndianType.LITTLE,
        mpu_present=False,
        fpu_present=False,
        fpu_dp=False,
        dsp_present=False,
        icache_present=False,
        dcache_present=False,
        itcm_present=False,
        dtcm_present=False,
        vtor_present=False,
        nvic_prio_bits=2,
        vendor_systick_config=False,
        device_num_interrupts=6,
        sau_num_regions=2,
        sau_regions_config=SVDSauRegionsConfig(
            enabled=True,
            protection_when_disabled=ProtectionStringType.SECURE,
            regions=[
                SVDSauRegion(
                    enabled=True,
                    name="Region1",
                    base=4096,
                    limit=8192,
                    access=SauAccessType.NON_SECURE,
                )
            ],
        ),
    ),
    header_system_filename=None,
    header_definitions_prefix=None,
    address_unit_bits=8,
    width=32,
    peripherals=[
        SVDPeripheral(
            size=None,
            access=None,
            protection=None,
            reset_value=None,
            reset_mask=None,
            dim=None,
            dim_increment=None,
            dim_index=None,
            dim_name=None,
            dim_array_index=None,
            name="Timer1",
            version="1.0",
            description="Timer 1 is a standard timer",
            alternate_peripheral="Timer1_Alt",
            group_name="group_name",
            prepend_to_name="prepend",
            append_to_name="append",
            header_struct_name="headerstruct",
            disable_condition="discond",
            base_address=1073750016,
            address_blocks=[],
            interrupts=[],
            registers_clusters=[],
            derived_from="test",
        )
    ],
)

# Serialize the device object. Alternatively, you can use the `device_to_svd_file` method to serialize the device
# object to an SVD file, or the `device_to_svd_content` method to serialize the device object to bytes string.
svd_str = SVDSerializer.device_to_svd_str(device, pretty_print=True)
# SVDSerializer.device_to_svd_file("path/to/svd_file.svd", device)
# svd_str = SVDSerializer.device_to_svd_content(device, pretty_print=True).decode()

# Print the serialized device object
print(svd_str)
```

Output:
```xml
<device xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="CMSIS-SVD.xsd" schemaVersion="1.3">
  <name>STM32F0</name>
  <version>1.0</version>
  <description>STM32F0 device</description>
  <cpu>
    <name>CM52</name>
    <revision>r0p0</revision>
    <endian>little</endian>
    <mpuPresent>false</mpuPresent>
    <fpuPresent>false</fpuPresent>
    <fpuDP>false</fpuDP>
    <dspPresent>false</dspPresent>
    <icachePresent>false</icachePresent>
    <dcachePresent>false</dcachePresent>
    <itcmPresent>false</itcmPresent>
    <dtcmPresent>false</dtcmPresent>
    <vtorPresent>false</vtorPresent>
    <nvicPrioBits>2</nvicPrioBits>
    <vendorSystickConfig>false</vendorSystickConfig>
    <deviceNumInterrupts>6</deviceNumInterrupts>
    <sauNumRegions>2</sauNumRegions>
    <sauRegionsConfig enabled="true" protectionWhenDisabled="s">
      <region enabled="true" name="Region1">
        <base>0x1000</base>
        <limit>0x2000</limit>
        <access>n</access>
      </region>
    </sauRegionsConfig>
  </cpu>
  <addressUnitBits>8</addressUnitBits>
  <width>32</width>
  <peripherals>
    <peripheral derivedFrom="test">
      <name>Timer1</name>
      <version>1.0</version>
      <description>Timer 1 is a standard timer</description>
      <alternatePeripheral>Timer1_Alt</alternatePeripheral>
      <groupName>group_name</groupName>
      <prependToName>prepend</prependToName>
      <appendToName>append</appendToName>
      <headerStructName>headerstruct</headerStructName>
      <disableCondition>discond</disableCondition>
      <baseAddress>0x40002000</baseAddress>
    </peripheral>
  </peripherals>
</device>
```

### Validate

To validate a CMSIS-SVD file you can utilize the `SVDValidator` class.

```python
from svdsuite import SVDValidator

xml_str = """\
<device xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
    xs:noNamespaceSchemaLocation="CMSIS-SVD.xsd" schemaVersion="1.3">
    <name>STM32F0</name>
    <version>1.0</version>
    <description>STM32F0 device</description>
    <addressUnitBits>8</addressUnitBits>
    <width>32</width>
    <peripherals>
        <peripheral derivedFrom="test">
            <name>Timer1</name>
            <baseAddress>0x40002000</baseAddress>
        </peripheral>
    </peripherals>
</device>
"""

# Validate the XML string. If the XML is invalid, an exception is raised, since get_exception=True.
# If get_exception=False, the function returns False on invalid XML without an exception.
# Alternatively, you can use the `validate_xml_file` method to validate an SVD file.
if SVDValidator.validate_xml_str(xml_str, get_exception=True):
    print("SVD is valid")
```

Output:
```
SVD is valid
```


## Roadmap

- [x] Parse svd files from XML to Python dataclasses ✅
- [x] Serialize the Python SVD dataclasses to XML svd files ✅
- [x] Validate svd files against the xsd schema files ✅
- [ ] Process parsed svd files (derivedFrom, nested clusters, ...)


## Running Tests

To run tests, run the following command:

```
  git clone https://github.com/ARMify-Project/SVDSuite.git svdsuite
  cd svdsuite/
  pytest tests/
```


## Acknowledgement

This project was made possible with funding from [NGI Zero Entrust Fund](https://nlnet.nl/thema/NGI0Entrust.html). NGI Zero Entrust Fund is part of the European Commission's [Next Generation Internet](https://www.ngi.eu/) initiative.

Project webpage: https://nlnet.nl/project/ARMify/

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "svdsuite",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "CMSIS, SVD, Embedded Systems, ARM, Cortex-M, Microcontroller",
    "author": "Christian Kudera",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/f0/51/fd0a9a21ff84e857f4d0366c48b18154f1b48a0f28c06e37924b204e8628/svdsuite-0.0.1.tar.gz",
    "platform": null,
    "description": "# SVDSuite\n\n**SVDSuite** is a Python package to parse, process, manipulate, validate, and generate [CMSIS SVD](https://open-cmsis-pack.github.io/svd-spec/main/index.html) files. Currently, the suite supports CMSIS-SVD standard 1.3.10-dev11, whereas the validation supports additionally standard 1.3.9.\n\n> The CMSIS System View Description format(CMSIS-SVD) formalizes the description of the system contained in Arm Cortex-M processor-based microcontrollers, in particular, the memory mapped registers of peripherals. The detail contained in system view descriptions is comparable to the data in device reference manuals. The information ranges from high level functional descriptions of a peripheral all the way down to the definition and purpose of an individual bit field in a memory mapped register.\n>\n>CMSIS-SVD files are developed and maintained by silicon vendors. Silicon vendors distribute their descriptions as part of CMSIS Device Family Packs. Tool vendors use CMSIS-SVD files for providing device-specific debug views of peripherals in their debugger. Last but not least, CMSIS-compliant device header files are generated from CMSIS-SVD files. [^1]\n\n[^1]: https://open-cmsis-pack.github.io/svd-spec/main/index.html\n\n> [!CAUTION]\n> This Python package is in early development. Code-breaking changes are to be expected!\n\n## Installation\n\nInstall **SVDSuite** with `pip`:\n\n```bash\n  pip install svdsuite\n```\n    \n## Usage/Examples\n\n### Parse\n\nTo parse a CMSIS-SVD file you can utilize the `SVDParser` class.\n\n```python\nimport pprint\nfrom svdsuite import SVDParser\n\nsvd_str = \"\"\"\\\n    <device xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n        xs:noNamespaceSchemaLocation=\"CMSIS-SVD.xsd\" schemaVersion=\"1.3\">\n        <name>STM32F0</name>\n        <version>1.0</version>\n        <description>STM32F0 device</description>\n        <cpu>\n            <name>CM52</name>\n            <revision>r0p0</revision>\n            <endian>little</endian>\n            <mpuPresent>false</mpuPresent>\n            <fpuPresent>false</fpuPresent>\n            <fpuDP>false</fpuDP>\n            <dspPresent>false</dspPresent>\n            <icachePresent>false</icachePresent>\n            <dcachePresent>false</dcachePresent>\n            <itcmPresent>false</itcmPresent>\n            <dtcmPresent>false</dtcmPresent>\n            <vtorPresent>false</vtorPresent>\n            <nvicPrioBits>2</nvicPrioBits>\n            <vendorSystickConfig>false</vendorSystickConfig>\n            <deviceNumInterrupts>6</deviceNumInterrupts>\n            <sauNumRegions>2</sauNumRegions>\n            <sauRegionsConfig enabled=\"true\" protectionWhenDisabled=\"s\">\n                <region enabled=\"true\" name=\"Region1\">\n                    <base>0x1000</base>\n                    <limit>0x2000</limit>\n                    <access>n</access>\n                </region>\n            </sauRegionsConfig>\n        </cpu>\n        <addressUnitBits>8</addressUnitBits>\n        <width>32</width>\n        <peripherals>\n            <peripheral derivedFrom=\"test\">\n                <name>Timer1</name>\n                <version>1.0</version>\n                <description>Timer 1 is a standard timer</description>\n                <alternatePeripheral>Timer1_Alt</alternatePeripheral>\n                <groupName>group_name</groupName>\n                <prependToName>prepend</prependToName>\n                <appendToName>append</appendToName>\n                <headerStructName>headerstruct</headerStructName>\n                <disableCondition>discond</disableCondition>\n                <baseAddress>0x40002000</baseAddress>\n            </peripheral>\n        </peripherals>\n    </device>\n    \"\"\"\n\n# Parse the SVD string. Alternatively, you can use the `for_xml_file` method to parse a SVD file\n# or the `for_xml_content` method to parse svd byte content.\nparser = SVDParser.for_xml_str(svd_str)\n# parser = SVDParser.for_xml_file(\"path/to/svd_file.svd\")\n# parser = SVDParser.for_xml_content(svd_str.encode())\n\n# Get the SVDDevice object\ndevice = parser.get_device()\n\n# Print the device object\npprint.pprint(device)\n```\n\nOutput:\n```python\nSVDDevice(\n  size=None,\n  access=None,\n  protection=None,\n  reset_value=None,\n  reset_mask=None,\n  xs_no_namespace_schema_location='CMSIS-SVD.xsd',\n  schema_version='1.3',\n  vendor=None,\n  vendor_id=None,\n  name='STM32F0',\n  series=None,\n  version='1.0',\n  description='STM32F0 device',\n  license_text=None,\n  cpu=SVDCPU(\n    name=<CPUNameType.CM52: 'CM52'>,\n    revision='r0p0',\n    endian=<EndianType.LITTLE: 'little'>,\n    mpu_present=False,\n    fpu_present=False,\n    fpu_dp=False,\n    dsp_present=False,\n    icache_present=False,\n    dcache_present=False,\n    itcm_present=False,\n    dtcm_present=False,\n    vtor_present=False,\n    nvic_prio_bits=2,\n    vendor_systick_config=False,\n    device_num_interrupts=6,\n    sau_num_regions=2,\n    sau_regions_config=SVDSauRegionsConfig(\n      enabled=True,\n      protection_when_disabled=<ProtectionStringType.SECURE: 's'>,\n      regions=[\n        SVDSauRegion(\n          enabled=True,\n          name='Region1',\n          base=4096,\n          limit=8192,\n          access=<SauAccessType.NON_SECURE: 'n'>\n        )\n      ]\n    )\n  ),\n  header_system_filename=None,\n  header_definitions_prefix=None,\n  address_unit_bits=8,\n  width=32,\n  peripherals=[\n    SVDPeripheral(\n      size=None,\n      access=None,\n      protection=None,\n      reset_value=None,\n      reset_mask=None,\n      dim=None,\n      dim_increment=None,\n      dim_index=None,\n      dim_name=None,\n      dim_array_index=None,\n      name='Timer1',\n      version='1.0',\n      description='Timer 1 is a standard timer',\n      alternate_peripheral='Timer1_Alt',\n      group_name='group_name',\n      prepend_to_name='prepend',\n      append_to_name='append',\n      header_struct_name='headerstruct',\n      disable_condition='discond',\n      base_address=1073750016,\n      address_blocks=[],\n      interrupts=[],\n      registers_clusters=[],\n      derived_from='test'\n    )\n  ]\n)\n```\n\nHave a look into `svdsuite/svd_model.py` for all the models (dataclasses).\n\n### Process\n\nNot implemented yet!\n\n### Create/Manipulate\n\nTo create or manipulate a CMSIS-SVD file you can utilize the `SVDSerializer` class.\n\n```python\nfrom svdsuite import (\n    SVDDevice,\n    SVDCPU,\n    CPUNameType,\n    EndianType,\n    SVDSauRegionsConfig,\n    ProtectionStringType,\n    SVDSauRegion,\n    SauAccessType,\n    SVDPeripheral,\n    SVDSerializer,\n)\n\n# Create an example device. Alternatevily, you can parse a CMSIS-SVD file and manipulate it.\ndevice = SVDDevice(\n    size=None,\n    access=None,\n    protection=None,\n    reset_value=None,\n    reset_mask=None,\n    xs_no_namespace_schema_location=\"CMSIS-SVD.xsd\",\n    schema_version=\"1.3\",\n    vendor=None,\n    vendor_id=None,\n    name=\"STM32F0\",\n    series=None,\n    version=\"1.0\",\n    description=\"STM32F0 device\",\n    license_text=None,\n    cpu=SVDCPU(\n        name=CPUNameType.CM52,\n        revision=\"r0p0\",\n        endian=EndianType.LITTLE,\n        mpu_present=False,\n        fpu_present=False,\n        fpu_dp=False,\n        dsp_present=False,\n        icache_present=False,\n        dcache_present=False,\n        itcm_present=False,\n        dtcm_present=False,\n        vtor_present=False,\n        nvic_prio_bits=2,\n        vendor_systick_config=False,\n        device_num_interrupts=6,\n        sau_num_regions=2,\n        sau_regions_config=SVDSauRegionsConfig(\n            enabled=True,\n            protection_when_disabled=ProtectionStringType.SECURE,\n            regions=[\n                SVDSauRegion(\n                    enabled=True,\n                    name=\"Region1\",\n                    base=4096,\n                    limit=8192,\n                    access=SauAccessType.NON_SECURE,\n                )\n            ],\n        ),\n    ),\n    header_system_filename=None,\n    header_definitions_prefix=None,\n    address_unit_bits=8,\n    width=32,\n    peripherals=[\n        SVDPeripheral(\n            size=None,\n            access=None,\n            protection=None,\n            reset_value=None,\n            reset_mask=None,\n            dim=None,\n            dim_increment=None,\n            dim_index=None,\n            dim_name=None,\n            dim_array_index=None,\n            name=\"Timer1\",\n            version=\"1.0\",\n            description=\"Timer 1 is a standard timer\",\n            alternate_peripheral=\"Timer1_Alt\",\n            group_name=\"group_name\",\n            prepend_to_name=\"prepend\",\n            append_to_name=\"append\",\n            header_struct_name=\"headerstruct\",\n            disable_condition=\"discond\",\n            base_address=1073750016,\n            address_blocks=[],\n            interrupts=[],\n            registers_clusters=[],\n            derived_from=\"test\",\n        )\n    ],\n)\n\n# Serialize the device object. Alternatively, you can use the `device_to_svd_file` method to serialize the device\n# object to an SVD file, or the `device_to_svd_content` method to serialize the device object to bytes string.\nsvd_str = SVDSerializer.device_to_svd_str(device, pretty_print=True)\n# SVDSerializer.device_to_svd_file(\"path/to/svd_file.svd\", device)\n# svd_str = SVDSerializer.device_to_svd_content(device, pretty_print=True).decode()\n\n# Print the serialized device object\nprint(svd_str)\n```\n\nOutput:\n```xml\n<device xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\" xs:noNamespaceSchemaLocation=\"CMSIS-SVD.xsd\" schemaVersion=\"1.3\">\n  <name>STM32F0</name>\n  <version>1.0</version>\n  <description>STM32F0 device</description>\n  <cpu>\n    <name>CM52</name>\n    <revision>r0p0</revision>\n    <endian>little</endian>\n    <mpuPresent>false</mpuPresent>\n    <fpuPresent>false</fpuPresent>\n    <fpuDP>false</fpuDP>\n    <dspPresent>false</dspPresent>\n    <icachePresent>false</icachePresent>\n    <dcachePresent>false</dcachePresent>\n    <itcmPresent>false</itcmPresent>\n    <dtcmPresent>false</dtcmPresent>\n    <vtorPresent>false</vtorPresent>\n    <nvicPrioBits>2</nvicPrioBits>\n    <vendorSystickConfig>false</vendorSystickConfig>\n    <deviceNumInterrupts>6</deviceNumInterrupts>\n    <sauNumRegions>2</sauNumRegions>\n    <sauRegionsConfig enabled=\"true\" protectionWhenDisabled=\"s\">\n      <region enabled=\"true\" name=\"Region1\">\n        <base>0x1000</base>\n        <limit>0x2000</limit>\n        <access>n</access>\n      </region>\n    </sauRegionsConfig>\n  </cpu>\n  <addressUnitBits>8</addressUnitBits>\n  <width>32</width>\n  <peripherals>\n    <peripheral derivedFrom=\"test\">\n      <name>Timer1</name>\n      <version>1.0</version>\n      <description>Timer 1 is a standard timer</description>\n      <alternatePeripheral>Timer1_Alt</alternatePeripheral>\n      <groupName>group_name</groupName>\n      <prependToName>prepend</prependToName>\n      <appendToName>append</appendToName>\n      <headerStructName>headerstruct</headerStructName>\n      <disableCondition>discond</disableCondition>\n      <baseAddress>0x40002000</baseAddress>\n    </peripheral>\n  </peripherals>\n</device>\n```\n\n### Validate\n\nTo validate a CMSIS-SVD file you can utilize the `SVDValidator` class.\n\n```python\nfrom svdsuite import SVDValidator\n\nxml_str = \"\"\"\\\n<device xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n    xs:noNamespaceSchemaLocation=\"CMSIS-SVD.xsd\" schemaVersion=\"1.3\">\n    <name>STM32F0</name>\n    <version>1.0</version>\n    <description>STM32F0 device</description>\n    <addressUnitBits>8</addressUnitBits>\n    <width>32</width>\n    <peripherals>\n        <peripheral derivedFrom=\"test\">\n            <name>Timer1</name>\n            <baseAddress>0x40002000</baseAddress>\n        </peripheral>\n    </peripherals>\n</device>\n\"\"\"\n\n# Validate the XML string. If the XML is invalid, an exception is raised, since get_exception=True.\n# If get_exception=False, the function returns False on invalid XML without an exception.\n# Alternatively, you can use the `validate_xml_file` method to validate an SVD file.\nif SVDValidator.validate_xml_str(xml_str, get_exception=True):\n    print(\"SVD is valid\")\n```\n\nOutput:\n```\nSVD is valid\n```\n\n\n## Roadmap\n\n- [x] Parse svd files from XML to Python dataclasses \u2705\n- [x] Serialize the Python SVD dataclasses to XML svd files \u2705\n- [x] Validate svd files against the xsd schema files \u2705\n- [ ] Process parsed svd files (derivedFrom, nested clusters, ...)\n\n\n## Running Tests\n\nTo run tests, run the following command:\n\n```\n  git clone https://github.com/ARMify-Project/SVDSuite.git svdsuite\n  cd svdsuite/\n  pytest tests/\n```\n\n\n## Acknowledgement\n\nThis project was made possible with funding from [NGI Zero Entrust Fund](https://nlnet.nl/thema/NGI0Entrust.html). NGI Zero Entrust Fund is part of the European Commission's [Next Generation Internet](https://www.ngi.eu/) initiative.\n\nProject webpage: https://nlnet.nl/project/ARMify/\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 ARMify  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "A Python package to parse, process, manipulate, validate, and generate CMSIS SVD files",
    "version": "0.0.1",
    "project_urls": {
        "Documentation": "https://github.com/ARMify-Project/SVDSuite?tab=readme-ov-file",
        "Issues": "https://github.com/ARMify-Project/SVDSuite/issues",
        "Source": "https://github.com/ARMify-Project/SVDSuite"
    },
    "split_keywords": [
        "cmsis",
        " svd",
        " embedded systems",
        " arm",
        " cortex-m",
        " microcontroller"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "557525eceab696c35a65899e637da7f416ff87876fd3c8fc9ab71b5dd94b3c19",
                "md5": "168c9028f793b79d72fa6d0b51bfc029",
                "sha256": "d4f7efe60e879aa5416885af893e72005e801f28fc2fdfa993abef6809eb257f"
            },
            "downloads": -1,
            "filename": "svdsuite-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "168c9028f793b79d72fa6d0b51bfc029",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 32211,
            "upload_time": "2024-05-03T23:29:17",
            "upload_time_iso_8601": "2024-05-03T23:29:17.160797Z",
            "url": "https://files.pythonhosted.org/packages/55/75/25eceab696c35a65899e637da7f416ff87876fd3c8fc9ab71b5dd94b3c19/svdsuite-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f051fd0a9a21ff84e857f4d0366c48b18154f1b48a0f28c06e37924b204e8628",
                "md5": "2768fa1705f52002802f1c9aa2c83bce",
                "sha256": "42671c413f1667ac61dd289d0494ea7bb2bcc332e9c4ea52f6c462a72c8466b6"
            },
            "downloads": -1,
            "filename": "svdsuite-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "2768fa1705f52002802f1c9aa2c83bce",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 57781,
            "upload_time": "2024-05-03T23:29:18",
            "upload_time_iso_8601": "2024-05-03T23:29:18.754693Z",
            "url": "https://files.pythonhosted.org/packages/f0/51/fd0a9a21ff84e857f4d0366c48b18154f1b48a0f28c06e37924b204e8628/svdsuite-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-03 23:29:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ARMify-Project",
    "github_project": "SVDSuite?tab=readme-ov-file",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "svdsuite"
}
        
Elapsed time: 0.25069s