/longfi-device-rs

Rust bindings to C implementation of LongFi protocol

Primary LanguageRustApache License 2.0Apache-2.0

longfi-device-rs

Build Status

Summary

This project creates Rust bindings for the LongFi Protocol C-library.

Cloning, building, testing

This project contains the LongFi Protocol C-library as a submodule, so either clone the whole repo and submodules with one command: git clone --recurse-submodules git@github.com:helium/longfi-device-rs.git

Or, if you've already cloned the top level without submodules, get the submodule: git submodule update --init --recursive

You can use cargo to build: cargo build [--release]

The configuration in .cargo/config is configured to build only for the thumbv6m-none-eabi platform currently.

The code in the example directory is for the STM32L0 Discovery kit, which features the STM32L072CZ.

To upload the code, start a debug server using either JLink (Note: you can reprogram the ST-Link on the discovery kit to act like a JLink Server; you will lose the virtual UART over USB provided by the ST-Link): JLinkGDBServer -device STM32L072CZ -speed 4000 -if swd -AutoConnect -1 -port 3333

or OpenOCD server (Note: if you are using the OpenOCD server, you will want to update .cargo/config:runner to use openocd.gdb instead of jlink.gdb): openocd -f ./openocd.cfg

run the example: cargo run --example stm32l0x2 [--release]

Run tests: cargo test --target x86_64-unknown-linux-gnu --tests

Debugging the build

The .travis.yml will provide the most up to date hints on how to build this repository. Notably, the following dependencies exist:

cmake doxygen xdot install g++-multilib libc6-dev-i386 gcc-arm-none-eabi libnewlib-arm-none-eabi

In addition, be sure to install clang as that appears to resolve header issues in some systems.