Skip to main content

Python svd2json package

This package converts a CMSIS SVD (System View Description) file into a more friendly JSon format than raw XML to JSon conversion. The aim of this package is to ease code generation from SVD file. We state that JSon format is the best suitable for this purpose. For instance, it can be used as-is in Jinja2 template processing.

JSon format

The resulting JSon root node is the device node in SVD. XML values are converted to equivalent JSon ones.

NOTE: Some SVD files might be inconsistent in peripherals and/or registers naming convention across devices or in a single SVD file. E.g. only few registers are prefixed by peripheral name but no others, you can optionally trim this prefix in order to keep code generation as simple as possible and reusable among a wide range of devices/mcu. !!ADD REF!!

An Additional interrupts is added in the resulting JSon which collects all interrupts declared across all peripherals. This can ease, for instance, VTOR table generation, one only has to walk through this array.

Script

This package exports the following script:

svd2json

$ svd2json --help
usage: svd2json [-h] -s SVD output

convert svd file to json

positional arguments:
  output             output filename

options:
  -h, --help         show this help message and exit
  -s SVD, --svd SVD  SVD file to convert

How to ...

This package follows PEP517/518/621 for its build system using a single pyproject.toml file and setuptools with dynamic versioning as build-backend. Unit testing, linting etc. are done with tox. The minimal python version is Python 3.10.

Build

One can use any python build front-end. E.g. with PyPA build front-end :

python -m build

Lint

This package is linted by black and flake8. In case of conflict between those two linter, we choose to follow black rules by default as it is closer to PEP8 than flake8.

tox -e lint

Type check

Type checking is done with mypy with a python 3.10+ syntax.

tox -e type

License check

Package license(s) can be checked using reuse.

tox -e licenses

Doc

Documentation is generated using Sphinx and using the numpy style for pythondoc with napoleon extension.

tox -e docs

Unit tests

Package Unit tests are based on pytest with coverage support.

tox -e unittests
tox -e htmlcov

License

Licensed under Apache-2.0

see LICENSE file

Metadata

Release files for svd2json 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for svd2json 0.1.6
File Size Uploaded Provenance Actions
svd2json-0.1.6.tar.gz 17.1 kB Without provenance Details for svd2json-0.1.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for svd2json 0.1.6
File Interpreter ABI Platform Actions
svd2json-0.1.6-py3-none-any.whl Python 3 none any Details for svd2json-0.1.6-py3-none-any.whl

Total release size: 26.8 kB

Release files / svd2json-0.1.6.tar.gz

Download URL svd2json-0.1.6.tar.gz
Size 17.1 kB
Tags Source
SHA-256 checksum
How to use checksums
15ef32b265fed46b2c0bf5029a12a5def577097b0a24c08c069203b96e21a517
BLAKE2b-256 checksum
How to use checksums
655b06584921c0888919635dbca98662e120ac3dbedcedf98da526cb67632f15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.31.0 requests-toolbelt/0.10.1 urllib3/1.26.17 tqdm/4.65.0 importlib-metadata/6.0.0 keyring/24.3.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.12

Release files / svd2json-0.1.6-py3-none-any.whl

Download URL svd2json-0.1.6-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9075665feea83a6904ec246819039e195117a63d9ec3f1e9717e34fa1a6017b0
BLAKE2b-256 checksum
How to use checksums
0c81601f0a6bfcf4c0a8df87a7bab008b782d51072b4e330deee4c5b4919b5a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.31.0 requests-toolbelt/0.10.1 urllib3/1.26.17 tqdm/4.65.0 importlib-metadata/6.0.0 keyring/24.3.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.12

Security for svd2json 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page