flipper0-sys

Crates.ioflipper0-sys
lib.rsflipper0-sys
version
sourcesrc
created_at2022-10-03 13:48:23.904202
updated_at2022-11-05 21:25:31.795586
descriptionBindings for Flipper Zero fw
homepagehttps://github.com/boozook/flipper0
repositoryhttps://github.com/boozook/flipper0.git
max_upload_size
id679009
Cargo.toml error:TOML parse error at line 21, column 1 | 21 | default-target = "thumbv7em-none-eabihf" | ^^^^^^^^^^^^^^ unknown field `default-target`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Alexander Koz. (boozook)

documentation

https://docs.rs/flipper0-sys

README

Bindings for Flipper Zero

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.

Compatibility

Minimal supported version:

Latest supported version can be determined by git tags starting with fw-.

Prerequisites

  • Rust toolchain, nightly

  • target thumbv7em-none-eabihf

  • libclang for bindgen

  • clone of Flipper Zero firmware (optional)

  • ARM toolchain, run fbt 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.

Hello-world

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
}

Features:

  • allocator: include allocator implementation

  • allocator-global: default, include global allocator implementation

  • oom-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 handler

  • macro: include #[main] macro for FAP entry point.

Bindings gen customization features:

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 profile

All of these derive-features are used for bindgen configuration.

Build methods features:

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)
Commit count: 65

cargo fmt