riot-sys 0.3.0

Rust FFI wrappers for the RIOT operating system
docs.rs failed to build riot-sys-0.3.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

riot-sys

Bindings for RIOT system calls

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.)

Extension

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


The main contents of this crate (ie. everything not in a module) is generated by bindgen.

Unlike the inline module (which contains the C2Rust transpilate), it is not moved into a dedicated linked module and reexported (in analogy to the inline), for that'd need explicit pub use linked::mutex_t etc for every type that's present in both and thus not imported for either. As long as this is inlined here, linked types (which are predominantly used so far) take precedence automatically.

License

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/.