Skip to content

Compilation fails on generated file with '%s' #27

Closed
@lexxvir

Description

@lexxvir

I've tried to generate *.rs from MK70F15.xml.txt (I added 'txt' extension to satisfy github, I believe it is SVD file, I found it here).

Output file generated successfully (some warnings though):

svd2rust spi0 -i ./MK70F15.xml > src/spi0.rs
WARNING CTAR_SLAVE overlaps with another register at offset 12. Ignoring.
WARNING PUSHR_SLAVE overlaps with another register at offset 52. Ignoring.

But following error appeared on compilation:

error: expected `:`, found `%`
 --> src/spi0.rs:3:295
  |
3 | # [ repr ( C ) ] pub struct Spi0 { # [ doc = "0x00 - DSPI Module Configuration Register" ] pub mcr : Mcr , _reserved0 : [ u8 ; 4usize ] , # [ doc = "0x08 - DSPI Transfer Count Register" ] pub tcr : Tcr , # [ doc = "0x0c - DSPI Clock and Transfer Attributes Register (In Master Mode)" ] pub ctar%s : Ctar%s , _reserved1 : [ u8 ; 28usize ] , # [ doc = "0x2c - DSPI Status Register" ] pub sr : Sr , # [ doc = "0x30 - DSPI DMA/Interrupt Request Select and Enable Register" ] pub rser : Rser , # [ doc = "0x34 - DSPI PUSH TX FIFO Register In Master Mode" ] pub pushr : Pushr , # [ doc = "0x38 - DSPI POP RX FIFO Register" ] pub popr : Popr , # [ doc = "0x3c - DSPI Transmit FIFO Registers" ] pub txfr%s : Txfr%s , _reserved2 : [ u8 ; 60usize ] , # [ doc = "0x7c - DSPI Receive FIFO Registers" ] pub rxfr%s : Rxfr%s }
  |

Probably svd2rust should somehow convert '%s' in SVD into something legal for Rust.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions