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-sdk
official fw will be downloaded, then build as with use-local-sdk
feature.
Minimal supported version: - FW: 0.70.1 - API: 7.0
Latest supported version can be determined by git tags starting with fw-
.
nightly
thumbv7em-none-eabihf
libclang
for bindgenfbt
to 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:
toml
[dependencies]
flipper0-sys = "*"
And follow instructions for examples.
```rust
extern crate flipper0sys; use flipper0sys::ffi::*;
pub unsafe extern "C" fn init(: *mut u8) -> i32 { static MESSAGE: &[u8] = b"Hello, World!"; furithreadstdoutwrite(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-default
derive-eq
derive-copy
derive-hash
derive-ord
derive-partialeq
derive-partialord
derive-debug
- derive Debug
, enabled by default for debug profileAll 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) |