Skip to content

Commit

Permalink
Merge branch 'master' into spi-transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
ryankurte committed Mar 11, 2020
2 parents 20c6bb7 + 9eb658f commit 0608fda
Show file tree
Hide file tree
Showing 16 changed files with 2,140 additions and 19 deletions.
14 changes: 14 additions & 0 deletions .cargo/config
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@

[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"

# For some reason this _doesn't_ work here, but does for windows?
#[target.armv7-unknown-linux-gnueabihf."usb-1.0"]
#rustc-link-search = ["./cross/armhf/"]
#rustc-link-lib = ["libusb-1.0"]

[target.i686-pc-windows-gnu]
linker = "i686-w64-mingw32-gcc-posix"
ar = "i686-w64-mingw32-gcc-ar-posix"
rustflags = "-C panic=abort"

[target.i686-pc-windows-gnu."usb-1.0"]
rustc-link-search = ["./cross/win/MinGW32/dll"]
rustc-link-lib = ["libusb-1.0"]
38 changes: 26 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,39 @@
language: rust
cache: cargo
matrix:

cache:
directories:
- $HOME/.cargo
- $HOME/.cache

services:
- docker

jobs:
include:
- env: TARGET=x86_64-unknown-linux-gnu
os: linux

- env: TARGET=armv7-unknown-linux-gnueabihf
os: linux
addons:
apt:
packages:
- libc6-i386
- libc6-dev-i386
- gcc-arm-linux-gnueabihf
- libc6-armhf-cross
- libc6-dev-armhf-cross

- env: TARGET=x86_64-apple-darwin
os: osx

- env: TARGET=i686-pc-windows-gnu
os: linux


before_install:
- if [ "$TRAVIS_OS_NAME" != "osx"]; then docker pull ryankurte/rust-embedded; fi

install:
- cargo fetch
- rustup target add armv7-unknown-linux-gnueabihf
- rustup target add $TARGET
- rustup component add rustfmt

script:
- cargo build && cargo test && cargo build --target=$TARGET --release
- ./cross/build.sh $TARGET

before_deploy:
- tar -cvf target/sx128x-util-$TARGET-$TRAVIS_TAG.tgz -C target/$TARGET/release/ sx128x-util

Expand Down
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description = "Driver for the Semtec sx1280 2.4GHz RF IC"
repository = "https://github.com/ryankurte/rust-radio-sx128x"
license = "MPL-2.0"
name = "radio-sx128x"
version = "0.12.1"
version = "0.13.0"


[features]
Expand All @@ -16,20 +16,20 @@ util = ["structopt", "simplelog", "humantime", "pcap-file", "embedded-spi/hal",
bitflags = "1.0.4"
libc = "0.2.42"
log = "0.4.6"
radio = "0.5.0"
radio = "0.6.0"
pcap-file = { version = "1.1.1", optional = true }

[dependencies.embedded-hal]
features = ["unproven"]
version = "0.2.3"

[dependencies.embedded-spi]
version = "0.6.0"
version = "0.6.1"
default-features = false

[target.'cfg(unix)'.dependencies.embedded-spi]
version = "0.6.0"
features = [ "hal-linux" ]
#[target.'cfg(unix)'.dependencies.embedded-spi]
#version = "00.6.1
#features = [ "hal-linux" ]

[dependencies.humantime]
optional = true
Expand Down
Binary file added cross/armhf/libusb-1.0.a
Binary file not shown.
Binary file added cross/armhf/libusb-1.0.so
Binary file not shown.
43 changes: 43 additions & 0 deletions cross/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

RUSTC_WRAPPER="sccache"

if [ -z "$SCCACHE_DIR"]; then
export SCCACHE_DIR=$HOME/.cache
fi

if [ -z "$CARGO_HOME"]; then
export CARGO_HOME=$HOME/.cargo
fi


DOCKER_CMD="docker run --rm -v=`pwd`:/work -v$CARGO_HOME/registry:/root/.cargo/registry -v$SCCACHE_DIR:/root/.cache --workdir=/work --user=:`id -g` --env PKG_CONFIG_ALLOW_CROSS=1"

DOCKER_IMG=ryankurte/rust-embedded



echo "Building for target: $1 (cargo cache: $CARGO_HOME, sccache $SCCACHE_DIR)"

# Args for cross build for armhf, windows tricks are in .cargo/config
ARMHF_ARGS="--env SYSROOT=/usr/arm-linux-gnueabihf --env PKG_CONFIG_ALLOW_CROSS=1 --env PKG_CONFIG_LIBDIR=/usr/lib/arm-linux-gnueabihf/pkgconfig --env PKG_CONFIG_SYSROOT_DIR=/usr/arm-linux-gnueabihf --env PKG_CONFIG_SYSTEM_LIBRARY_PATH=/usr/lib/arm-linux-gnueabihf --env PKG_CONFIG_SYSTEM_INCLUDE_PATH=/usr/arm-linux-gnueabihf/include"


if [ "$1" == "x86_64-unknown-linux-gnu" ]; then
$DOCKER_CMD $DOCKER_IMG /bin/bash -c "cargo build --target=$1 --release --features embedded-spi/hal-linux"

elif [ "$1" == "armv7-unknown-linux-gnueabihf" ]; then
$DOCKER_CMD $ARMHF_ARGS $DOCKER_IMG /bin/bash -c "cargo build --target=$1 --release --features embedded-spi/hal-linux"

elif [ "$1" == "x86_64-apple-darwin" ]; then
cargo build --target=$1 --release

elif [ "$1" == "i686-pc-windows-gnu" ]; then
$DOCKER_CMD $DOCKER_IMG /bin/bash -c "cargo build --target=$1 --release"

else

echo "Unsupported target: $1"
exit 1

fi
Binary file added cross/win/MinGW32/dll/libusb-1.0.dll
Binary file not shown.
Binary file added cross/win/MinGW32/dll/libusb-1.0.dll.a
Binary file not shown.
Binary file added cross/win/MinGW32/static/libusb-1.0.a
Binary file not shown.
Binary file added cross/win/MinGW64/dll/libusb-1.0.dll
Binary file not shown.
Binary file added cross/win/MinGW64/dll/libusb-1.0.dll.a
Binary file not shown.
Binary file added cross/win/MinGW64/static/libusb-1.0.a
Binary file not shown.
Loading

0 comments on commit 0608fda

Please sign in to comment.