wiringX bindings for Rust with extra Milk-V platforms included.
Using this library requires to have gcc, make, glibc, clang and the right toolchain for the target platform installed. Please open an issue containing package manager specific install commands for this library to work out of the box.
The right RISC-V GCC toolchain can be built here.
To build and run your wiringX application on a Milk-V Duo Linux environment follow those steps:
-
Boot the Duo and connect to it using ssh using
ssh [email protected]
with passwordmilkv
. You can also run thessh-copy-id [email protected]
command to export your ssh key to the Duo. -
On your Duo run
ln -s /lib/ld-musl-riscv64v0p7_xthead.so.1 /lib/ld-musl-riscv64.so.1
for the programs to work. -
Install the riscv-gnu-toolchain, run the
configure
script with all default settings and no flags, then runsudo make musl
-
Open your
~/.cargo/config.toml
and add this to make it compile:
[target.riscv64gc-unknown-linux-musl]
linker = "riscv64-unknown-linux-musl-gcc"
rustflags = ["-C", "target-feature=-crt-static"]
-
Compile your Rust program to the
riscv64gc-unknown-linux-musl
architecture using wiringX in Rust using the nightly toolchain and build-std flags to unlock the standard library using this specific command:cargo +nightly build --release --target=riscv64gc-unknown-linux-musl -Zbuild-std=std,core
-
If the program has successfully compiled, scp it to your Duo using
scp -O target/riscv64gc-unknown-linux-musl/release/"binary_name" [email protected]:
Do not forget to replace the "binary_name" with the actual name of your binary.
- Run your binary.