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

use svd2rust from build.rs #392

Closed
stefanhoelzl opened this issue Oct 26, 2019 · 2 comments
Closed

use svd2rust from build.rs #392

stefanhoelzl opened this issue Oct 26, 2019 · 2 comments

Comments

@stefanhoelzl
Copy link

I am trying to integrate svd2rust into my build.rs script and followed the cargo book

I write the output of svd2rust into $OUT_DIR/gen_lib.rs and my lib.rs looks like the following:

include!(concat!(env!("OUT_DIR"), "/gen_lib.rs"));

but this doesn't compile.

Just having the following content in gen_lib.rs

#![no_std]

leads to the following error:

error: an inner attribute is not permitted in this context
 --> /Users/stefan/Development/k64/demo/target/debug/build/demo-77105b19538eb740/out/lib.rs:1:1
  |
1 | #![no_std]
  | ^^^^^^^^^^
  |
  = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them.

error: expected item after attributes
 --> /Users/stefan/Development/k64/demo/target/debug/build/demo-77105b19538eb740/out/lib.rs:1:10
  |
1 | #![no_std]
  |          ^

error: aborting due to 2 previous errors

this is also one of severals errors I get when I try to use the gen_lib.rs generated by svd2rust.

Is there any way to get this working?

@jonas-schievink
Copy link
Contributor

I don't think svd2rust is meant to be used in this way. Doing this requires all users of the PAC to build svd2rust and sit through it processing the SVD (which can take some time), in addition to the already long compile times of the PACs themselves.

@Emilgardis
Copy link
Member

This is now possible since we provide svd2rust as a library. To use in build.rs use the supplied generate function to grab svd2rust output.

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

3 participants