gneiss-sys 0.1.1

Raw PebbleOS app syscall bindings for gneiss
Documentation
//! The raw PebbleOS app API: the C SDK's `pebble.h`, as Rust.
//!
//! Each platform's bindings are generated from that platform's `pebble.h`. Every function is a
//! small shim that jumps through the firmware's syscall table, which the app loader fills in at
//! launch, so nothing links against the C SDK. Exactly one platform feature must be enabled.
//!
//! Apps normally use [gneiss](https://docs.rs/gneiss), and reach this crate as `gneiss::sys` only
//! for what gneiss doesn't wrap yet. Everything here is `unsafe` and follows the C SDK's rules.
//!
//! The crate also provides the app header ([`PBL_HEADER`]), the panic handlers in [`panic`](mod@panic), and
//! `memcpy`, `memmove` and `memset` forwarded to the firmware's own.
#![no_std]
#![deny(
	clippy::panic,
	clippy::panic_in_result_fn,
	clippy::string_slice,
	clippy::unchecked_time_subtraction
)]
#![warn(clippy::unreachable, clippy::unimplemented, clippy::todo)]

use gneiss_types::{
	self,
	header::{DEFAULT_HEADER, PebbleProcessInfo},
};

mutually_exclusive_features::exactly_one_of!(
	"emery", "flint", "gabbro", "aplite", "basalt", "chalk", "diorite"
);

mod mem;
pub mod panic;
mod shim;

// Shut up, clippy! We don't care that bindgen outputs messy code.
// Blanket rather than a named list: this file is regenerated by `cargo xtask
// regen-sys`, so any lint it trips is by definition not ours to fix, and the
// set shifts every time the SDK surface or the toolchain moves.
#[allow(
	warnings,
	clippy::all,
	clippy::pedantic,
	clippy::nursery,
	clippy::restriction
)]
#[cfg_attr(feature = "emery", path = "platform/emery.rs")]
#[cfg_attr(feature = "flint", path = "platform/flint.rs")]
#[cfg_attr(feature = "gabbro", path = "platform/gabbro.rs")]
#[cfg_attr(feature = "aplite", path = "platform/aplite.rs")]
#[cfg_attr(feature = "basalt", path = "platform/basalt.rs")]
#[cfg_attr(feature = "chalk", path = "platform/chalk.rs")]
#[cfg_attr(feature = "diorite", path = "platform/diorite.rs")]
mod sys_raw;
pub use sys_raw::*;

#[used]
#[unsafe(link_section = ".pbl_header")]
pub static PBL_HEADER: PebbleProcessInfo = DEFAULT_HEADER;