Skip to content

use svd2rust from build.rs #392

Closed
Closed
@stefanhoelzl

Description

@stefanhoelzl

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions