embed-rs / stm32f7-discovery

Apache License 2.0
30 stars 23 forks source link

Problems with svd2rust #72

Open phil-opp opened 5 years ago

phil-opp commented 5 years ago
phil-opp commented 5 years ago

The simplest way to fix these problems would be to update svd2rust in the following way:

To avoid breaking changes in svd2rust, these changes could be gated by a cargo feature (i.e. svd2rust would generate code that contains conditional compilation depending on a cargo feature).

cc @oli-obk

phil-opp commented 5 years ago

Some links that show the current API:

phil-opp commented 5 years ago

@oli-obk I just read https://github.com/rust-embedded/svd2rust/pull/270 and I think I understand the design decisions of svd2rust better now. I also had some new ideas how to create APIs on top of the zero sized singletons. For example, we can change our i2c type to take ownership of the ZST singleton instead of trying to store a &'static mut RegisterBlock. I implemented these changes in https://github.com/embed-rs/stm32f7-discovery/pull/76.

I try to find more svd2rust pain points in our current code. Maybe I can find better solutions for them too, otherwise I'll post them in the svd2rust issue.