Hi3XXX MPP API for Rust bindings.
PATH
:
arm-himix100-linux
.hi3516ev200
.hi3516ev200
.hi3516ev200
.arm-himix200-linux
.arm-hisiv100nptl-linux
.aarch64-himix100-linux
.armv7-unknown-linux-musleabihf
.hi3516ev200
.hi3516ev200
.hi3516ev200
.aarch64-unknown-linux-gnu
.arm-hisiv100-linux-uclibcgnueabi
.aarch64-unknown-linux-gnu
.MPP_DIR
to directory that contains the mpp-lib
.SYS_INCLUDE
to the directory that contains the system headers.The toolchain and the mpp-lib you can get from the BSP sdk. The
arm-hisiv100-linux-uclibcgnueabi
if build with xargo.
The Hi3616EV300、Hi3616EV200、Hi3618EV300 use the same SDK.
sh
export PATH=/opt/hisi-linux/x86-arm/arm-himix100-linux/bin:$PATH
export MPP_DIR=$(pwd)/vendor/mpp-lib-Hi3516EV200_V1.0.1.0
export SYS_INCLUDE=/opt/hisi-linux/x86-arm/arm-himix100-linux/target/usr/include
sh
export PATH=/opt/hisi-linux/x86-arm/arm-himix200-linux/bin:$PATH
export MPP_DIR=$(pwd)/vendor/mpp-lib-Hi3519AV100_V2.0.2.0
export SYS_INCLUDE=/opt/hisi-linux/x86-arm/arm-himix200-linux/target/usr/include
sh
export PATH=/opt/hisi-linux-nptl/arm-hisiv100-linux/target/bin:$PATH
export MPP_DIR=$(pwd)/vendor/mpp-lib-Hi3531V100_V1.0.D.0
export SYS_INCLUDE=/opt/hisi-linux-nptl/arm-hisiv100-linux/target/usr/include
sh
export PATH=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/bin:$PATH
export MPP_DIR=$(pwd)/vendor/mpp-lib-Hi3559AV100_V2.0.2.0
export SYS_INCLUDE=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/aarch64-linux-gnu/sys-include
export TARGET_CC=aarch64-himix100-linux-gcc
export BINDGEN_EXTRA_CLANG_ARGS="--sysroot=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/target"
To build the package, you must set cross compile environments first.
There is some preset in .cargo/
can help you fasten setup the cross compile.
Example:
```sh
cp .cargo/hi3559av100.toml .cargo/config
cp .cargo/hi3559av100-static.toml .cargo/config
cargo b ```
Make sure the
hi3559av100
feature is enabled in the Cargo.toml, Thehi3559av100
specified the target board, you can change to others, like:hi3531v100
More features see the Cargo.toml.
To build with arm-hisiv100-linux-uclibcgnueabi
:
```sh
rustup override set nightly rustup component add rust-src
cargo install xargo
RUSTTARGETPATH=$(pwd) xargo [build|clean|run|test] ... ```
if RUSTTARGETPATH not set, the xargo will raise "Error loading target specification..."
```rs use himpp::ffi::*;
fn main() { unsafe { println!("HIMPISYSInit() = {}", HIMPISYSInit()); println!("HIMPISYSExit() = {}", HIMPISYSExit()); } } ```
```rs use himpp::mpi;
fn main() { mpi::sys::init() .orelse(|err| { println!("Initialize failed: {}, exit and try again!", err); mpi::sys::exit().andthen(|_| mpi::sys::init()) }) .unwrap(); // Add your code here mpi::sys::exit().unwrap(); } ```
More exmaples
To enable doc-tests on target != host, you have to use nighlty toolchain and turn on the -Z doctest-xcompile
flags.
For Example:
sh
RUSTDOCFLAGS="-C linker=aarch64-himix100-linux-gcc" cargo +nightly t -Z doctest-xcompile
Just export the TARGET_SSH_USER
and TARGET_SSH_HOST
environments, like:
sh
export TARGET_SSH_USER=hello
export TARGET_SSH_HOST=192.168.3.4