Comments (4)
What svd2rust version were you using? This works for me:
$ cargo new --lib stm32f41x && cd $_
$ curl -LO https://raw.githubusercontent.com/posborne/cmsis-svd/master/data/STMicro/STM32F41x.svd
$ svd2rust -i STM32F41x.svd > src/lib.rs
$ rustfmt src/lib.rs
$ cargo add cortex-m
$ cargo add vcell
$ cargo build
With svd2rust 0.5.1
, cargo 0.19.0-nightly (4e95c6b41 2017-03-23)
and rustc 1.17.0-nightly (e1cec5d4b 2017-03-29)
.
Am I correct in thinking the output should have been properly pretty printed (not a giant 7.8M single line)?
No, that's normal (the quasiquoting crate we use under the hood doesn't preserve line breaks and just "inlines" everything). You can run rustfmt
on the output.
from svd2rust.
I definitely still have problems with rustfmt 0.8.1 ()
installed (built today with rustc 1.18.0-nightly (5e122f59b 2017-04-01)
).
I did try patching svdrust to pull in the rustfmt crate and run that before generating output - it's a pretty small change and has generated the STM32F41x
core properly. I'm guessing I have some weird syntax incompatibility between the svd2rust output and my rustfmt binary.
from svd2rust.
I find this very odd. Relatively "contemporary" versions of rustfmt and rustc should parse / understand the same syntax.
I suppose that apart from rustfmt, calling cargo build
on the unformatted rustfmt output doesn't work either?
I wonder if this because you are passing the code to format through rustfmt stdin (could maybe be some problem with your shell / environment / locale) rather than as passing it to rustfmt as a file.
Do the steps from my previous comment don't work for you either?
from svd2rust.
The unformatted output is expected and the docs recommend piping svd2rust output before writing it to a file.
And I can't repro the rustfmt / compilation error with the STM32F41x.svd so I'm going to close this. Feel free to open a new issue (with repro steps) if you hit a compiler error with recent versions of svd2rust / rustc.
from svd2rust.
Related Issues (20)
- Unable to determine the length of an array of registers HOT 2
- Output Cargo.toml dependencies and features HOT 5
- RISC-V: adoption of `riscv-pac` HOT 1
- A number of the PACs in [esp-pacs](https://github.com/esp-rs/esp-pacs/) are for RISC-V devices (everything except `esp32`, `esp32s2`, `esp32s3`, and `esp8266`). HOT 1
- Is generated atomic register access correct? HOT 1
- Versions v0.31.2-4 generates invalid code for cluster in bl602-pac HOT 2
- What's the next? HOT 4
- UPPER CASE, lower case and Title Case HOT 7
- `/ci diff` doesn't always catch action
- Error generating psoc6_pac HOT 4
- thread 'main' panicked at src/util.rs:95:9: "...%s" is not a valid Ident HOT 2
- warning: lint private_in_public HOT 2
- thread 'main' panicked at [...]: called `Option::unwrap()` on a `None` value HOT 2
- feature: add bitfield operations for `enumeratedValues` generated types HOT 3
- Incorrect mapping of ZeroToSet HOT 1
- No way to access `w` after writing HOT 1
- Unclear how to use `#[interrupt]` macro without deprecated `--reexport-interrupt` flag HOT 3
- no_mangle on DEVICE_PERIPHERALS prevents optimizing write away
- Equivalent of command with Rust HOT 2
- unknown access variant 'read-writeonce' found | MSPM0G350X.svd
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from svd2rust.