rust-embedded / rust-embedded/svd2rust

Multiple MCU models in a single crate using cfg features

Open
#393 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I was wondering if it was possible to make a single crate from multiple SVDs. Basically, merging all the common registers and peripherals, and compiling only what is needed.

After playing a bit with the code and SVDs from Silabs (EFM32), I think it would be quite easy to build a single crate using conditional compilation using cfg features that compile only what is needed.

Since this goal seemed a bit easy, I was thinking why projects like https://github.com/stm32-rs/stm32-rs were making crates with a way more complicated structure (besides fixing errors from the manufacturer, which could also be merged in svd2rust IMO).

Is there any reasons why this wasn't done ? If it seems to be a good idea, I can try to implement that in the next few days.

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 reviewing svd2rust’s current code-generation path and the Silabs EFM32 SVDs mentioned in the issue. Compare the proposed single-crate cfg-feature approach with stm32-rs/stm32-rs, including how common registers and peripherals would be handled. Done means producing a maintainer-approved design or implementation plan with its trade-offs and scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
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.