Closed metehus closed 6 months ago
You may want to look in the esp-idf-sys repo and its build scripts. While its main purpose is to build esp-idf application + generating its bindings, it also has a section of the pio implementation.
I don't know the working status of the pio impl but it should bring you forward..
Tried to look at it but it's way out of my knowledge. Unfortunately I will have to give up rust for this project now, but I will keep a look on the progress of this topic. I've also created an issue for better documenting this: https://github.com/esp-rs/std-training/issues/251
I'm working on a new project with esp-rs with std and platformio. I can get it to work, but now I want to call C code and libraries from rust. I was searching about bindgen and came across this repository, that seems to have some kind of bindgen for building and binding c code to use in rust, with the esp environment in mind. I have tried somethings but haven't found a success. The project I'm working on is this one: https://github.com/metehus/espac/tree/main/firmware (binding in lib/peripheral-bindings).
Basically, I've looked on the exposed methods and tried this on the build file:
There's a
bindings.h
file that just imports a library downloaded via platformio. of course, haven't got any success:Build error
``` Compiling esp-idf-svc v0.48.1 error: failed to run custom build command for `peripheral-bindings v0.1.0 (/home/matehus/projects/embedded/espac/firmware/lib/peripheral-bindings)` Caused by: process didn't exit successfully: `/home/matehus/projects/embedded/espac/firmware/target/debug/build/peripheral-bindings-c68dc13ea6345054/build-script-build` (exit status: 101) --- stdout cargo:rustc-link-search=../../.pio/libdeps/release cargo:rustc-env=EMBUILD_GENERATED_BINDINGS_FILE=/home/matehus/projects/embedded/espac/firmware/target/xtensa-esp32s3-espidf/debug/build/peripheral-bindings-a9cd2eac59193df5/out/bindings.rs --- stderr Output: "/home/matehus/projects/embedded/espac/firmware/target/xtensa-esp32s3-espidf/debug/build/peripheral-bindings-a9cd2eac59193df5/out/bindings.rs" Bindgen builder flags: ["bindings.h", "--rust-target", "1.64", "--no-derive-default", "--generate", "functions,types,vars,methods,constructors,destructors", "--"] thread 'main' panicked at lib/peripheral-bindings/build.rs:12:7: error!: Failed to generate bindings Stack backtrace: 0: anyhow::error::At this point I have no idea how to make bindgen work with the platformio library and how to correctly set up the embuild (or even if that's the right tool for the job). Any information would help here!