Automatically generated bindings (or "externs") for Flipper Zero Fw with some little hand-crafted wrappers and additions as upper abstraction layer.
This can be built with:
- without Flipper fw sources using default feature
prebuild - with modified fw using feature
use-local-sdk - with enabled feature
use-remote-sdkofficial fw will be downloaded, then build as withuse-local-sdkfeature.
Minimal supported version:
Latest supported version can be determined by git tags starting with fw-.
- Rust toolchain,
nightly - target
thumbv7em-none-eabihf libclangfor bindgen- clone of Flipper Zero firmware (optional)
- ARM toolchain, run
fbtto easily get it (optional)
For build using pre-generated bindings (prebuild feature) just Rust toolchain is required, nightly channel.
For build using non-modified official fw just Rust toolchain and firmware sources are required.
For other cases see documentation and examples.
Just add dependency to your cargo manifest file:
[dependencies]
flipper0-sys = "*"And follow instructions for examples.
#![crate_type = "staticlib"] #![no_main] #![no_std]
extern crate flipper0_sys;
use flipper0_sys::ffi::*;
#[no_mangle]
pub unsafe extern "C" fn init(_: *mut u8) -> i32 {
static MESSAGE: &[u8] = b"Hello, World!";
furi_thread_stdout_write(MESSAGE.as_ptr() as _, MESSAGE.len());
0
}allocator: include allocator implementationallocator-global: default, include global allocator implementationoom-global: default, out-of-mem handler. Disable it to use you custom handler or#![feature(default_alloc_error_handler)].panic: default, include global panic & OoM handlermacro: include#[main]macro for FAP entry point.
Can be used with use-local-sdk or use-remote-sdk features.
derive-defaultderive-eqderive-copyderive-hashderive-ordderive-partialeqderive-partialordderive-debug- deriveDebug, enabled by default for debug profile
All of these derive-features are used for bindgen configuration.
By default prebuild is turned on. It uses pre-generated bindings, so fw not needed.
| Feature | Default | Description | Used ENV vars |
|---|---|---|---|
prebuild |
+ | use pre-generated bindings | |
use-local-sdk |
+ | look at FLIPPER_FW_SRC_PATH, build from source |
FLIPPER_FW_SRC_PATH (required), ARM_TOOLCHAIN (optional) |
use-remote-sdk |
- | clone remote git repo, initial setup with fbt, then build from source. | FLIPPER_REPO_REV, FLIPPER_REPO_BRANCH, FLIPPER_REPO_CLONE_PATH, ARM_TOOLCHAIN (all vars optional) |