#riot #iot #bindings #riot-os

sys no-std riot-sys

Rust FFI wrappers for the RIOT operating system

6 releases

✓ Uses Rust 2018 edition

0.2.4 Apr 29, 2019
0.2.3 Apr 27, 2019
0.2.1 Nov 27, 2018
0.1.0 Nov 26, 2018

#12 in #iot

26 downloads per month
Used in 1 crate


107 lines

This crate contains dynamically generated Rust FFI bindings to the RIOT Operating System.

Those bindings are inherently unsafe; it is recommended that their safe abstractions in the riot-wrappers crate are used in most applications.

RIOT integration

Both the presence of API components and the contents of structs depend on configuration set in the RIOT build system, eg. the presence of features or the CPU used. This does not only affect the preprocessed C code, but also compiler flags that govern the effective sizes of structs and need to be known to Cargo.

All the relevant information -- including the location of the actually used RIOT header files -- is contained in the RIOT environment variables CFLAGS_WITH_MACROS and INCLUDES; both need to be passed in to the Rust build system as a RIOT_CFLAGS environment variable.

When using riot-sys, it is usually easiest to run from a target within the Make system like this:

target/thumbv7m-none-eabi/debug/libmy_app.a: always
	CC= CFLAGS= CPPFLAGS= RIOT_FLAGS="$(CFLAGS_WITH_MACROS) $(INCLUDES)" cargo build --target thumbv7m-none-eabi

.PHONY: always

(CFLAGS etc. need to be cleared, for otherwise Cargo would assume those are host flags.)


Currently, only a subset of all the RIOT headers is processed; all the relevant header files are included in this crate's riot-all.h header file. If you need access to more RIOT APIs, more includes can be added there.


This crate is licensed under the same terms as of the LGPL 2.1, following the license terms of the RIOT Operating System.

It is maintained by Christian M. Amsüss ca@etonomy.org as part of the etonomy project, see https://etonomy.org/.

No runtime deps

~30K SLoC