Skip to content

Conversation

jamesmunns
Copy link
Member

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.

@jamesmunns
Copy link
Member Author

@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)

@japaric
Copy link
Member

japaric commented Feb 28, 2018

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+

bors bot added a commit that referenced this pull request Feb 28, 2018
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.
@bors
Copy link
Contributor

bors bot commented Feb 28, 2018

Build failed

@japaric
Copy link
Member

japaric commented Feb 28, 2018

Build failed

One build timed out. Testing locally.

@japaric
Copy link
Member

japaric commented Feb 28, 2018

Testing locally.

Test passed. Merging manually.

@japaric japaric merged commit 231d24e into rust-embedded:master Feb 28, 2018
@jamesmunns jamesmunns deleted the reorg branch March 1, 2018 21:00
bors bot added a commit that referenced this pull request Mar 4, 2018
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)
bors bot added a commit that referenced this pull request Mar 8, 2018
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants