Skip to main content

A CMSIS-SVD file encoder to generate svd files programmatically, which is useful when parsing other descriptor formats.

Project description

cmsis-svd-codec

This library allows you to programmatically create a svd file for your Microcontroller. This is particularly useful when you have to parse the data from another file descriptor format in order to build a svd file.

How to install

pip install cmsis-svd-codec

Example

from cmsis_svd_codec import SvdDevice

device = SvdDevice("RISC-V", "CoffeeBean", version="1.0")

# Fill the device top level details.
device.add_description("Single core 5-stage pipeline RISC-V processor ...")
device.add_license("""Licensed under the Apache License, Version 2.0, see LICENSE for details."""
device.add_cpu("Ibex", "rev01", device_num_Interrupts=2)
device.add_address_config(width="32")

# Add a peripheral to the device.
peripheral = device.add_peripheral("UART0", version="0.1")
peripheral.add_description("Simple UART peripheral")
peripheral.add_base_address(0x4000_0000)
peripheral.add_size(32)
peripheral.add_interrupt(21)
peripheral.add_address_block(offset=0x000, size=0x1000)

# Add a register to the peripheral.
reg = peripheral.add_register("FIFO_STATUS")
reg.add_description("TX and RX fifo status.")
reg.add_offset_address(0x0)

# Add fields to the register.
reg_field = reg.add_field("tx_full")
reg_field.add_description("1 when the tx fifo is full, 0 otherwise.")
reg_field.add_bit_range(first_bit=0, last_bit=0)
reg_field.add_access_permission(read=True, write=False)

reg_field = reg.add_field("tx_fifo_depth")
reg_field.add_description("How may bit there are in the tx fifo.")
reg_field.add_bit_range(first_bit=1, last_bit=4)
reg_field.add_access_permission(read=True, write=False)

# Create a svd file.
device.dump('CoffeeBean.svd')

Contributing

Please open issues and submit pull request to the repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cmsis-svd-codec-0.1.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

cmsis_svd_codec-0.1.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file cmsis-svd-codec-0.1.0.tar.gz.

File metadata

  • Download URL: cmsis-svd-codec-0.1.0.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for cmsis-svd-codec-0.1.0.tar.gz
Algorithm Hash digest
SHA256 48deeb3d3fb46e431f0d5f461dd5acd7f568888770a2ec8f2baf1f868246ddd8
MD5 b3957cc93310683d9803e8e1576d664e
BLAKE2b-256 c92db50e1630941cc5ab0d3e20a7732a2d3b3ed1c9d8770611ca336961047639

See more details on using hashes here.

File details

Details for the file cmsis_svd_codec-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cmsis_svd_codec-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a492eade0fe0b4d116b5c2e46b9bbbf949f7dc7070f53a4fa826ea97ea09490a
MD5 ff14a67f7d0da32cdd412e421de0280a
BLAKE2b-256 b967332e1f8a688f3771be32aa80081eccf394a7bbc472e0b412cf94243d1424

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page