#linux #linux-gpio #kpal

kpal-gpio-cdev

A KPAL plugin for the Linux GPIO char device

4 releases

0.2.2 Mar 8, 2020
0.2.1 Mar 1, 2020
0.2.0 Feb 9, 2020
0.1.0 Dec 14, 2019

#18 in #linux-gpio

Custom license

50KB
796 lines

kpal-gpio-cdev

Docs.rs Crates.io

A KPAL plugin for the Linux GPIO character device API.

Overview

kpal-gpio-cdev is a wrapper around the Rust gpio-cdev library. The GPIO character device ABI is the modern interface between users and a Linux kernel that is controllig GPIO devices.

Getting started

Cross-compiling for ARMv7

The ARMv7 instruction set architecture (ISA) is used by the Raspberry Pi Model 3, among other systems. To compile this plugin for the ARMv7 first make sure that you have an ARMv7 Rust toolchain installed. You will also need a linker. On Ubuntu-like systems, this can be obtained from one of many packages, such as gcc-arm-linux-gnueabihf:

$ rustup target add armv7-unknown-linux-gnueabihf
$ sudo apt install gcc-arm-linux-gnueabihf

To configure the linker for this architecture, add the following lines to $HOME/.cargo/config:

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

To build the library for the ARMv7 ISA, run the following from this directory:

cargo build --target=armv7-unknown-linux-gnueabihf

The artifacts should be found inside the target directory of the kpal root directory ../target/armv7-unknown-linux-gnueabihf.

Dependencies

~7–17MB
~211K SLoC