riscv-rust / k210-example

Example project for K210 SoC to show usage of k210-hal project
30 stars 9 forks source link

Latest master head 6a96e5c fails to build #2

Open sheref-sidarous opened 4 years ago

sheref-sidarous commented 4 years ago
$ git log -n1
commit 6a96e5cc86cbb888e3e11443a2b942fcff0fe669 (HEAD -> master, origin/master, origin/HEAD)
Author: luojia65 <me@luojia.cc>
Date:   Wed Apr 29 13:44:17 2020 +0800

    Fix GPIO input
$ cargo build
    Updating crates.io index
error: failed to select a version for `bare-metal`.
    ... required by package `riscv v0.5.6`
    ... which is depended on by `k210-example v0.1.1 (/home/public/projects/rust/k210-example)`
versions that meet the requirements `>= 0.2.0, < 0.2.5` are: 0.2.4, 0.2.3, 0.2.1

all possible versions conflict with previously selected packages.

  previously selected package `bare-metal v0.2.5`
    ... which is depended on by `k210-pac v0.2.0`
    ... which is depended on by `k210-hal v0.2.0`
    ... which is depended on by `k210-example v0.1.1 (/home/public/projects/rust/k210-example)`

failed to select a version for `bare-metal` which could resolve this conflict

To resolve this error, I downgraded riscv-rt to "0.6.1" and removed explicit dependency on riscv, here is the edited cargo file

[package]
name = "k210-example"
version = "0.1.1"
authors = ["The RISC-V Team <risc-v@teams.rust-embedded.org>"]
edition = "2018"

[dependencies]
panic-halt = "0.2.0"
riscv-rt = "0.6.1"
k210-hal = "0.2.0"

But still, I get the following build error

$ cargo build
   Compiling bit_field v0.9.0
   Compiling r0 v0.2.2
   Compiling vcell v0.1.2
   Compiling void v1.0.2
   Compiling nb v0.1.2
   Compiling k210-example v0.1.1 (/home/public/projects/rust/k210-example)
   Compiling panic-halt v0.2.0
   Compiling semver v0.9.0
   Compiling proc-macro2 v0.4.30
   Compiling syn v0.15.44
   Compiling rand_core v0.3.1
   Compiling riscv v0.5.4
   Compiling riscv-rt v0.6.1
   Compiling k210-pac v0.2.0
   Compiling embedded-hal v0.2.3
   Compiling rand v0.5.6
   Compiling rustc_version v0.2.3
   Compiling quote v0.6.13
   Compiling bare-metal v0.2.5
   Compiling riscv-rt-macros v0.1.6
   Compiling k210-hal v0.2.0
error[E0603]: module `fpioa` is private
 --> src/main.rs:7:15
  |
7 | use k210_hal::fpioa;
  |               ^^^^^

error[E0599]: no method named `constrain` found for type `k210_pac::SYSCTL` in the current scope
  --> src/main.rs:14:27
   |
14 |     let sysctl = p.SYSCTL.constrain();
   |                           ^^^^^^^^^ method not found in `k210_pac::SYSCTL`

error[E0599]: no method named `split` found for type `k210_pac::FPIOA` in the current scope
  --> src/main.rs:16:25
   |
16 |     let fpioa = p.FPIOA.split(&mut sysctl.apb0);
   |                         ^^^^^ method not found in `k210_pac::FPIOA`

error[E0061]: this function takes 3 parameters but 2 parameters were supplied
  --> src/main.rs:23:27
   |
23 |     let serial = p.UARTHS.configure(
   |                           ^^^^^^^^^ expected 3 parameters

error: aborting due to 4 previous errors

Some errors have detailed explanations: E0061, E0599, E0603.
For more information about an error, try `rustc --explain E0061`.
error: could not compile `k210-example`.

To learn more, run the command again with --verbose.

Thanks, Sheref

Disasm commented 4 years ago

You need to build this example from a workspace: https://github.com/riscv-rust/k210-crates