Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cs2dsb opened this issue Nov 28, 2017 · 5 comments

Comments

@cs2dsb
Copy link

cs2dsb commented Nov 28, 2017

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?

@japaric
Copy link
Member

japaric commented Dec 1, 2017

👍 for creating tools that add information to SVD files from any other source.

👎 for adding such functionality (e.g. C header parser) to svd2rust, itself. I don't think you were proposing this, though.

I think someone wrote a (Python?) tool for making edition of SVD files easier (i.e. make it easier to add enumeratedValues info) but don't recall any of the details. Perhaps @cr1901 or j_ey (forgot their GH username) know / remember about it?

@jgouly
Copy link

jgouly commented Dec 1, 2017

Sorry, must be thinking of someone else. I've avoided SVD files so far.

@brandonedens
Copy link
Contributor

@japaric the Python script is discussed here:
hackndev/zinc#327
maybe?

@jamesmunns
Copy link
Member

@cs2dsb have you had a look at bindgen before? You might be able to use a combo of svd2rust and bindgen to get all the info you need, and perhaps blend them together to make a unified API.

@ryankurte
Copy link

This should be reasonably easy to implement in rust (if that's desired) once we land svd generation in svd#46.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants