rust-embedded / rust-embedded/svd2rust

Thoughts on supplementing svd with other sources (.h files) primarily for enumerated values?

Open
#159 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
857
Forks
164
PR merge metrics
No merged PRs in 30d

Description

I’ve been using a device crate generated by svd2rust for a project I’m working on and have found the lack of enumerated values defined in my svd quite annoying. It seems ST haven’t added them in most cases.

I’ve been adding them myself from the reference manual as I need them but it’s tedious work.

I was wondering about parsing .h files from the stm cmsis and possibly libopencm3 to get these enumerated values added to the svds.

The cmsis files (for example stm32f303ze.h) contain some in the form peripheral_register_field_enumname. If you discount enum names that are only digits you get a clean looking list. There are some obvious missing ones but it’s a lot better than the svd alone.

I looked around for community driven projects and found libopencm3 which seems to have a fairly complete set (for example).

Has anyone looked into extracting this info from existing libraries? Any thoughts on if it’s worth trying?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the enumerated-value patterns in stm32f303ze.h and libopencm3's gpio_common_f234.h with the corresponding SVD data. Determine how external header parsing could fit into svd2rust and what missing or conflicting values must be handled. Done means a decided scope and an agreed integration approach, since the issue does not identify an implementation file or test.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, rust
Domain
embedded-iot, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.