Skip to content

Commit

Permalink
Bump littlefs version
Browse files Browse the repository at this point in the history
This patch:

- Bumps the littlefs version to the latest released (v2.9.3)
- Adds a "multiversion" feature flag that exposes the littlefs feature
of the same name
  • Loading branch information
sosthene-nitrokey committed Nov 12, 2024
1 parent aa64d08 commit a913a47
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ categories = ["embedded", "filesystem", "no-std"]
repository = "https://github.com/nickray/littlefs2-sys"

[build-dependencies]
bindgen = { version = "0.69.4", default-features = false , features = ["runtime"] }
bindgen = { version = "0.70.1", default-features = false , features = ["runtime"] }
cc = "1"

[features]
assertions = []
trace = []
malloc = []
software-intrinsics = []
multiversion = []
18 changes: 15 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::path::PathBuf;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut builder = cc::Build::new();
let builder = builder
.flag("-std=c11")
.flag("-std=c99")
.flag("-DLFS_NO_DEBUG")
.flag("-DLFS_NO_WARN")
.flag("-DLFS_NO_ERROR")
Expand All @@ -24,17 +24,29 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
#[cfg(not(feature = "malloc"))]
builder.flag("-DLFS_NO_MALLOC");

#[cfg(feature = "multiversion")]
let builder = builder.flag("-DLFS_MULTIVERSION");

builder.compile("lfs-sys");

let bindings = bindgen::Builder::default()
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());

let bindgen = bindgen::Builder::default()
.header("littlefs/lfs.h")
.clang_arg("-std=c99")
.clang_arg("-DLFS_NO_DEBUG")
.clang_arg("-DLFS_NO_WARN")
.clang_arg("-DLFS_NO_ERROR");
#[cfg(feature = "multiversion")]
let bindgen = bindgen.clang_arg("-DLFS_MULTIVERSION");

let bindings = bindgen
.use_core()
.allowlist_item("lfs_.*")
.allowlist_item("LFS_.*")
.generate()
.expect("Unable to generate bindings");

let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
bindings
.write_to_file(out_path.join("bindings.rs"))
.expect("Couldn't write bindings!");
Expand Down
2 changes: 1 addition & 1 deletion littlefs

0 comments on commit a913a47

Please sign in to comment.