Wrapper to use FreeRTOS APIs in Rust.
This project is based on FreeRTOS-rust but has since been mostly rewritten.
The veecle-freertos-integration crate generates bindings to the configured (see Configuration) FreeRTOS source code and, if using the link-freertos feature, builds and links the FreeRTOS source.
The currently supported FreeRTOS version is: V11.2.0.
This projects uses Git submodules, which are required to run tests.
You can run git submodule update --init to fetch the submodules.
link-freertos: Links (and builds, depending on env-vars) the FreeRTOS library. When using this crate to build a static library for inclusion in a C project, it can be necessary to disable this feature to only link the FreeRTOS library in the final linking stage in the C project.
Environment variables are used to configure the include and source paths for this crate:
-
FREERTOS_CONFIG_INCLUDE_PATH: Path to the directory containing theFreeRTOSConfig.hfile. -
FREERTOS_KERNEL_INCLUDE_PATH: Path to the FreeRTOS kernel include directory. -
FREERTOS_KERNEL_PORTMACRO_INCLUDE_PATH: Path to the FreeRTOSportmacrodirectory. -
FREERTOS_HEAP_FILE_PATH: Path to the FreeRTOS heap implementation file. -
FREERTOS_ADDITIONAL_INCLUDE_PATHS: One or more paths to additional include directories used when generating bindings and building the FreeRTOS library. Multiple paths are separated following the system's convention for thePATHenvironment variable. This typically means:for Unix and;for Windows. Seestd::env::split_pathsfor details. -
FREERTOS_ADDITIONAL_INCLUDE_PATHS_BASE: If set, all paths inFREERTOS_ADDITIONAL_INCLUDE_PATHSinterpreted as relative to the set base path. -
BINDINGS_WRAPPER_PREPEND_EXTENSION_PATH: Path to a file whose contents will be prepended to the bindingswrapper.hfile. This is useful to adddefineson which the includes of the wrapper rely on.
These environment variables are only taken into account if the link-freertos feature is active.
If (and only if) both variables are set, the crate will not build the FreeRTOS library, but instead use the library defined by LIB_FREERTOS_NAME & LIB_FREERTOS_SEARCH_PATH.
LIB_FREERTOS_NAME: Name of the FreeRTOS library to link to (withoutlibprefix and file ending).LIB_FREERTOS_SEARCH_PATH: Directory containing the FreeRTOS library.
bindgen uses libclang, which might not use the correct include directories by default when cross-compiling.
Set BINDGEN_EXTRA_CLANG_ARGS_[TARGET] with TARGET being the Rust target being compiled for.
Depending on your system, the dashes (-) in the target tuple might not be supported in environment variables.
In that case, replace them with underscores (_).
For example: BINDGEN_EXTRA_CLANG_ARGS_thumbv7em_none_eabihf = -Ipath/to/includes.
See bindgen's documentation for more information.
Most veecle-freertos-integration methods are not safe to be called from an ISR/interrupt context.
Only veecle-freertos-integration methods explicitly documented as ISR-/interrupt-safe are safe to call in an interrupt handler.
Using non-ISR-/interrupt-safe methods within an interrupt context will lead to undefined behavior.
To build the FreeRTOS library, this crate depends on the cc crate.
So the C compiler used can be set by using the CC environment variable or otherwise defined by internal defaults.
For the ARM architecture this is the arm-none-eabi-gcc.
To get started there is an example in examples.
This project is licensed under the MIT license.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you shall be licensed as MIT without any additional terms or conditions.