Skip to content

Commit

Permalink
Merge pull request #157 from flipperzero-rs/update-bindings-1.0
Browse files Browse the repository at this point in the history
Update SDK bindings to 73.0 (Firmware 1.0.1)
  • Loading branch information
dcoles authored Sep 12, 2024
2 parents da24fc6 + dfd0b28 commit 8003692
Show file tree
Hide file tree
Showing 16 changed files with 1,743 additions and 1,013 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

### Changed

- Migrated to SDK 62.3 (firmware 0.102.3).
- Bumped pinned nightly Rust version to `nightly-2024-04-17`.
- Updated to SDK 73 (firmware 1.0.1🥳).
- Switched to `nightly-2024-09-10` compiler
- `flipperzero_rt::entry` macro now requires a function with type signature
`fn(Option<&CStr>) -> i32` instead of `fn(*mut u8) -> i32`.
- `flipperzero::furi::string::FuriString::as_mut_ptr` is now public to allow for
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Rust for Flipper Zero 🐬❤️🦀

[![crates.io](https://img.shields.io/crates/v/flipperzero)](https://crates.io/crates/flipperzero)
[![Flipper Zero API](https://img.shields.io/badge/Flipper%20Zero%20API-62.3-orange)](https://github.com/flipperdevices/flipperzero-firmware/blob/0.102.3/targets/f7/api_symbols.csv)
[![Flipper Zero API](https://img.shields.io/badge/Flipper%20Zero%20API-73.0-orange)](https://github.com/flipperdevices/flipperzero-firmware/blob/1.0.1/targets/f7/api_symbols.csv)
[![docs.rs](https://img.shields.io/docsrs/flipperzero)](https://docs.rs/flipperzero)
[![MIT license](https://img.shields.io/crates/l/flipperzero)](LICENSE)

Expand All @@ -17,13 +17,13 @@ This means it's not possible to use anything in the [`std`](https://doc.rust-lan

## SDK version

Currently supports SDK 62.3 ([flipperzero-firmware@0.102.3](https://github.com/flipperdevices/flipperzero-firmware/tree/0.102.3)).
Currently supports SDK 73.0 ([flipperzero-firmware@1.0.1](https://github.com/flipperdevices/flipperzero-firmware/tree/1.0.1)).

The crate major version number will be updated after a bump in [API version](https://github.com/flipperdevices/flipperzero-firmware/blob/release/targets/f7/api_symbols.csv) in the Flipper Zero firmware.

| Crate version | API version |
| ------------- | ----------- |
| Unreleased | 62.3 |
| Unreleased | 73.0 |
| 0.11.x | 35.0 |
| 0.10.x | 28.2 |
| 0.9.x | 23.0 |
Expand Down
24 changes: 14 additions & 10 deletions crates/.cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,26 @@ runner = "python3 ../cargo-runner.py"
linker = "./fap-lld.py"
rustflags = [
# CPU is Cortex-M4 (STM32WB55)
"-C", "target-cpu=cortex-m4",
"-C",
"target-cpu=cortex-m4",

# Size optimizations
"-C", "panic=abort",
"-C", "debuginfo=0",
"-C", "opt-level=z",
"-C",
"panic=abort",
"-C",
"debuginfo=0",
"-C",
"opt-level=z",

# LTO helps reduce binary size
"-C", "embed-bitcode=yes",
"-C", "lto=yes",
"-C",
"embed-bitcode=yes",
"-C",
"lto=yes",

# Linker flags for relocatable binary
"-C", "link-args=--script=flipperzero-rt.ld --Bstatic --relocatable --discard-all --strip-all --lto-O3 --lto-whole-program-visibility",

# Required to link with `lld`
"-Z", "no-unique-section-names=yes",
"-C",
"link-args=--script=flipperzero-rt.ld --Bstatic --relocatable --discard-all --strip-all --lto-O3 --lto-whole-program-visibility",
]

[build]
Expand Down
11 changes: 2 additions & 9 deletions crates/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
[workspace]
members = [
"alloc",
"flipperzero",
"sys",
"rt",
"test",
"test/macros",
]
members = ["alloc", "flipperzero", "sys", "rt", "test", "test/macros"]
resolver = "2"

[workspace.package]
version = "0.11.0"
description = "Rust for Flipper Zero"
edition = "2021"
rust-version = "1.70.0"
rust-version = "1.81.0"
repository = "https://github.com/dcoles/flipperzero-rs"
readme = "../README.md"
license = "MIT"
Expand Down
12 changes: 2 additions & 10 deletions crates/flipperzero/examples/example_images.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ use flipperzero_sys::furi::UnsafeRecord;
use flipperzero_rt as rt;
use flipperzero_sys as sys;

use sys::Icon;

rt::manifest!(name = "Example: Images");
rt::entry!(main);

Expand All @@ -36,16 +38,6 @@ struct ImagePosition {
pub y: i32,
}

/// Internal icon representation.
#[repr(C)]
struct Icon {
width: u8,
height: u8,
frame_count: u8,
frame_rate: u8,
frames: *const *const u8,
}

// Screen is 128x64 px
extern "C" fn app_draw_callback(canvas: *mut sys::Canvas, _ctx: *mut c_void) {
unsafe {
Expand Down
8 changes: 2 additions & 6 deletions crates/flipperzero/src/furi/log/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,7 @@ impl ufmt::uDisplay for Level {
}
}

#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
impl std::error::Error for ParseLevelError {}
impl core::error::Error for ParseLevelError {}

impl FromStr for Level {
type Err = ParseLevelError;
Expand Down Expand Up @@ -465,9 +463,7 @@ impl ufmt::uDisplay for ParseLevelFilterError {
}
}

#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
impl std::error::Error for ParseLevelFilterError {}
impl core::error::Error for ParseLevelFilterError {}

#[repr(usize)]
#[derive(Copy, Clone, Debug, uDebug, Hash, Eq, PartialEq, PartialOrd, Ord)]
Expand Down
4 changes: 2 additions & 2 deletions crates/flipperzero/src/gpio/i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ impl Bus {
// will be using it while we have a raw pointer to it. We don't convert this to a
// `&'static mut` reference because this will be disallowed in Rust 2024 edition.
BusHandle::acquire(match self.0 {
BusKind::Internal => unsafe { addr_of_mut!(sys::furi_hal_i2c_handle_power) },
BusKind::External => unsafe { addr_of_mut!(sys::furi_hal_i2c_handle_external) },
BusKind::Internal => addr_of_mut!(sys::furi_hal_i2c_handle_power),
BusKind::External => addr_of_mut!(sys::furi_hal_i2c_handle_external),
})
}

Expand Down
128 changes: 0 additions & 128 deletions crates/flipperzero/src/toolbox/md5.rs

This file was deleted.

10 changes: 0 additions & 10 deletions crates/flipperzero/src/toolbox/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,3 @@
pub(crate) mod crc32;
pub use self::crc32::Crc32;

#[cfg(feature = "__unsupported_md5")]
pub(crate) mod md5;
#[cfg(feature = "__unsupported_md5")]
pub use self::md5::Md5;

#[cfg(feature = "__unsupported_sha256")]
pub(crate) mod sha256;
#[cfg(feature = "__unsupported_sha256")]
pub use sha256::Sha256;
Loading

0 comments on commit 8003692

Please sign in to comment.