Skip to content

Commit

Permalink
Revert "support esp32 (#4)"
Browse files Browse the repository at this point in the history
This reverts commit 201efd8.
  • Loading branch information
codyps committed Jan 10, 2023
1 parent 201efd8 commit ab91195
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 26 deletions.
6 changes: 1 addition & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@ repository = "https://github.com/nickray/littlefs2-sys"
[dependencies]
cty = "0.2.1"

[target.'cfg(target_os = "espidf")'.dependencies]
esp-idf-sys = { version = "0.31" }

[build-dependencies]
bindgen = { version = "0.60", default-features = false, features = ["runtime"] }
bindgen = { version = "0.60", default-features = false }
cc = "1"
embuild = { version = "0.30", features = ["espidf"] }

[features]
assertions = []
Expand Down
27 changes: 6 additions & 21 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use embuild::cmd::Cmd;
use std::env;
use std::path::PathBuf;

Expand All @@ -13,7 +12,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.flag("-DLFS_NO_ERROR")
.file("littlefs/lfs.c")
.file("littlefs/lfs_util.c")
.file("string.c");
.file("string.c")
;

#[cfg(not(feature = "assertions"))]
let builder = builder.flag("-DLFS_NO_ASSERT");
Expand All @@ -23,29 +23,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {

builder.compile("lfs-sys");

let mut builder = bindgen::Builder::default()
let bindings = bindgen::Builder::default()
.header("littlefs/lfs.h")
.clang_arg(format!("--target={}", target))
.use_core()
.ctypes_prefix("cty")
.rustfmt_bindings(true);

let target = env::var("TARGET").unwrap();

if target == "xtensa-esp32s3-espidf" {
let mut cmd = Cmd::new("xtensa-esp32s3-elf-ld");
cmd.arg("--print-sysroot");
let sysroot = cmd
.stdout()
.map(PathBuf::from)
.expect("Failed to find sysroot");

builder = builder.clang_arg(format!("--sysroot={}", sysroot.display()));
// TODO: determine why it isn't sufficient to just set the sysroot.
builder = builder.clang_arg(format!("-I{}", sysroot.join("include").display()))
}

let bindings = builder.generate().expect("Unable to generate bindings");
.rustfmt_bindings(true)
.generate()
.expect("Unable to generate bindings");

let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
bindings
Expand Down

0 comments on commit ab91195

Please sign in to comment.