Build error with HiFive1 Rev B using example led_blink

I am working with the Hifive (riscv-rust-quickstart) example led_blink and get the following error message.

$ cargo run --example leds_blink
   Compiling e310x-hal v0.9.3
error[E0599]: no method named `nr` found for enum `e310x::Interrupt` in the current scope
   --> /home/arlen/.cargo/registry/src/
186 |             (*PLIC::ptr()).claim.write(|w| w.bits( as u32));
    |                                                        ^^ method not found in `e310x::Interrupt`

For more information about this error, try `rustc --explain E0599`.

Following are the steps that I performed leading up to the error.

  1. rustup target add riscv32imac-unknown-none-elf
  2. cargo generate --git GitHub - riscv-rust/riscv-rust-quickstart: A template for building Rust applications for HiFive1 boards
  3. cd app
  4. /opt/SEGGER/JLinkGDBServer -device FE310 -if JTAG -speed 4000 -port 3333 -nogui
  5. cargo build

below is the Cargo.toml file

    name = "app"
    version = "0.0.0"
    authors = ["Arlen Planting <>"]
    edition = "2018"
    license = "ISC"
    readme = ""

    embedded-hal = "0.2.3"
    hifive1 = { version = "0.9.0", features = ["board-hifive1-revb"] }
    panic-halt = "0.2.0"
    riscv = "0.6.0"
    riscv-rt = "0.8.0"

    # this lets you use `cargo fix`!
    name = "app"
    test = false
    bench = false

    codegen-units = 1 # better optimizations
    debug = true # symbols are nice and they don't increase the size on Flash
    lto = true # better optimizations

This is likely because the generator is for an older version. If you look at e310x v0.8 for example, it implements an Nr trait for Interrupt from crate bare_metal 0.2.5, but this is no more in bare_metal v1.0 (and correspondingly, it's also gone from e310x v0.9).

Since the enum in question is #[repr(u16)], I would assume you could just cast it to u16 in order to get the raw interrupt number out of the typed enum.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.