Rust language bindings for ev3dev
Notice
Currently this project is not compatible with the BrickPi platform.
Usage
extern crate ev3dev_lang_rust;
use Ev3Result;
use ;
use ColorSensor;
Cross compile for ev3 brick
-
Create target configuration
.cargo/config
[] = "/usr/bin/arm-linux-gnueabi-gcc"
-
Create Dockerfile
FROM debian:stretch RUN dpkg --add-architecture armel RUN apt update # Fix debian package alias RUN sed -i "s#deb http://security.debian.org/debian-security stretch/updates main#deb http://deb.debian.org/debian-security stretch/updates main#g" /etc/apt/sources.list # Install curl for rust installation # Install g++ as buildscript compiler # Install g++-arm-linux-gnueabi as cross compiler RUN apt --yes install curl g++ g++-arm-linux-gnueabi crossbuild-essential-armel # Instull rust for host platform RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y ENV PATH "$PATH:/root/.cargo/bin" # Add stdlib for target platform RUN rustup target add armv5te-unknown-linux-gnueabi # docker run -it --rm -v $PWD:/build/ -w /build pixix4/ev3dev-rust-cross # cargo build --release --target armv5te-unknown-linux-gnueabi
-
Build docker image
-
Start docker image
-
Build binary for ev3dev
The
--release
flag is optional. However, it can speedup the execution time by a factor of 30.
The target binary is now in target/armv5te-unknown-linux-gnueabi/release/{application_name}
Editor support
If you have problems with code completion or inline documentation with rust analyzer it may help to enable to following settings: (example from vs code settings.json
)