-
Notifications
You must be signed in to change notification settings - Fork 158
Reorganize svd2rust #180
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
Reorganize svd2rust #180
Conversation
@japaric or @Emilgardis could I trouble you to review and possibly merge this? Or at least provide some positive or negative feedback (sorry, I know you are both busy) |
This LGTM. Eventually we want to add unit tests at each codegen level (enumeratedValue, register, peripheral, etc.) so it makes sense to split the generate.rs file this. bors r+ |
180: Reorganize svd2rust r=japaric a=jamesmunns I have made a few minor cosmetic changes: * Break `generate.rs` into a module, with each of the major components living as a file inside of it * Each major component has a function called `render()`, which all return `Result<Vec<Tokens>>` (as before some did that, and some took a `&mut Vec<Tokens>` as an argument they only pushed to) * I moved some `util` components into modules, when they were only used by that module I expect NO functional changes to the output. Please let me know if I can run a full regression test locally. In the future, I think some more work could be done to break up `generate::register::render()`, as it is a very large function, but I wanted to make this PR in manageable pieces. Please let me know if you would like me to squash my changes. I have kept them separate in case you would like to inspect them.
Build failed |
One build timed out. Testing locally. |
Test passed. Merging manually. |
182: Add initial Cluster support r=jamesmunns a=jamesmunns Add cluster support to svd2rust. I am calling it initial, because I have only tested it against the `nRF52` [svd file](https://github.com/jamesmunns/nrf52/blob/master/nrf52.svd). Note, this is based on #180, so I would prefer that PR be merged first. If that PR is rejected, I can instead rebase these changes on `japaric/master` (just let me know). Edit: All changes relevant to clusters are squashed into the last commit of this PR, so if you want to see the relevant changes, check out 6de6de7. This is based on the work of @brandonedens earlier #149, and I believe would close #107 and related issues. CC @japaric @Emilgardis @therealprof Edit 2: Here are some handy references: * [SVD snippet with clusters](https://gist.github.com/jamesmunns/c4e53fe5bd74dca81fdbff6bb1798ddd) * [code generated before](https://gist.github.com/jamesmunns/d854a6c2665cca59edb88143d82a19c6) * [code generated after](https://gist.github.com/jamesmunns/7558667e34c33124c60b3aaaf679a196) * [diff of code generated](https://gist.github.com/jamesmunns/03fd0d7d3595cd0816dbfa8daca0a553)
182: Add initial Cluster support r=jamesmunns a=jamesmunns Add cluster support to svd2rust. I am calling it initial, because I have only tested it against the `nRF52` [svd file](https://github.com/jamesmunns/nrf52/blob/master/nrf52.svd). Note, this is based on #180, so I would prefer that PR be merged first. If that PR is rejected, I can instead rebase these changes on `japaric/master` (just let me know). Edit: All changes relevant to clusters are squashed into the last commit of this PR, so if you want to see the relevant changes, check out 6de6de7. This is based on the work of @brandonedens earlier #149, and I believe would close #107 and related issues. CC @japaric @Emilgardis @therealprof Edit 2: Here are some handy references: * [SVD snippet with clusters](https://gist.github.com/jamesmunns/c4e53fe5bd74dca81fdbff6bb1798ddd) * [code generated before](https://gist.github.com/jamesmunns/d854a6c2665cca59edb88143d82a19c6) * [code generated after](https://gist.github.com/jamesmunns/7558667e34c33124c60b3aaaf679a196) * [diff of code generated](https://gist.github.com/jamesmunns/03fd0d7d3595cd0816dbfa8daca0a553)
I have made a few minor cosmetic changes:
generate.rs
into a module, with each of the major components living as a file inside of itrender()
, which all returnResult<Vec<Tokens>>
(as before some did that, and some took a&mut Vec<Tokens>
as an argument they only pushed to)util
components into modules, when they were only used by that moduleI expect NO functional changes to the output. Please let me know if I can run a full regression test locally.
In the future, I think some more work could be done to break up
generate::register::render()
, as it is a very large function, but I wanted to make this PR in manageable pieces.Please let me know if you would like me to squash my changes. I have kept them separate in case you would like to inspect them.