Closed Paul-Vandell closed 3 years ago
I'll check what is going on and update you later.
However: if you are targeting the ESP32, with the ESP-IDF platform + Rust, I strongly suggest you take the complete opposite of cargo-pio, which is the so called "Cargo-first" build. A mix of PlatformIO and Rust where PlatformIO is in charge of the overall build is only useful if you plan to create a mixed C/Rust codebase, and interoperate between the two. Possible, but difficult.
Use this crate as a start: https://github.com/ivmarkov/rust-esp32-std-hello
Thx for your response.
So yes, i succeed to build with the rust-esp32-std-hello
, and it works pretty well. Good job there.
Im just starting in the embedded world, so i give a shot over here.
The reason why i give a shot here are :
bindgen
to get the job done between Rust & C here.Thx in advance.
So first of all in the meantime I've fixed the original issue (sorry!) and PlatformIO-driven builds should work again. Just re-install with cargo install cargo-pio
.
As for your particular case... you are in for quite a journey - if you continue using the cargo-first build I just suggested to you!
It is possible, but I actually need to think how this is best done, because so far - honestly - cargo-first was always about just using the "standard" ESP-IDF. For your case, we might have to "extend" the build somehow so that you have a way to "point" the build to the additional C components you would like to build as part of building ESP-IDF.
(With the pio-first project you started originally that's much easier, as you can just "paste" the esp-cam driver in the pio project directory.)
Regardless which way you decide to take, I won't bother initially with "bindgen", as this is another complication, and the cam driver interface is small enough so that you can manually create the unsafe Rust extern "C"
functions of the driver.
I'll follow-up if I get a good idea for cargo-first.
Thx !
I succeed to build with the arduino
framework.
But it seems to have an issue with espidf
framework.
Finished dev [unoptimized + debuginfo] target(s) in 0.02s
/home/vandell/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: target/xtensa-esp32-espidf/debug/libesp32_dev.a(compiler_builtins-8567a693cfe2fca1.compiler_builtins.b32yuzpz-cgu.14.rcgu.o): in function `__moddi3':
/home/vandell/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.49/src/macros.rs:285: multiple definition of `__moddi3'; /home/vandell/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/no-rtti/libgcc.a(_moddi3.o):/builds/idf/crosstool-NG/.build/xtensa-esp32-elf/src/gcc/libgcc/libgcc2.c:1256: first defined here
/home/vandell/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: target/xtensa-esp32-espidf/debug/libesp32_dev.a(compiler_builtins-8567a693cfe2fca1.compiler_builtins.b32yuzpz-cgu.15.rcgu.o): in function `__divdi3':
/home/vandell/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.49/src/macros.rs:285: multiple definition of `__divdi3'; /home/vandell/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/no-rtti/libgcc.a(_divdi3.o):/builds/idf/crosstool-NG/.build/xtensa-esp32-elf/src/gcc/libgcc/libgcc2.c:1232: first defined here
/home/vandell/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: target/xtensa-esp32-espidf/debug/libesp32_dev.a(compiler_builtins-8567a693cfe2fca1.compiler_builtins.b32yuzpz-cgu.15.rcgu.o): in function `__udivdi3':
/home/vandell/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.49/src/macros.rs:285: multiple definition of `__udivdi3'; /home/vandell/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/no-rtti/libgcc.a(_udivdi3.o):/builds/idf/crosstool-NG/.build/xtensa-esp32-elf/src/gcc/libgcc/libgcc2.c:1319: first defined here
/home/vandell/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: target/xtensa-esp32-espidf/debug/libesp32_dev.a(compiler_builtins-8567a693cfe2fca1.compiler_builtins.b32yuzpz-cgu.15.rcgu.o): in function `__umoddi3':
/home/vandell/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.49/src/macros.rs:285: multiple definition of `__umoddi3'; /home/vandell/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/no-rtti/libgcc.a(_umoddi3.o):/builds/idf/crosstool-NG/.build/xtensa-esp32-elf/src/gcc/libgcc/libgcc2.c:1307: first defined here
collect2: error: ld returned 1 exit status
*** [.pio/build/debug/firmware.elf] Error 1
================================================ [FAILED] Took 17.57 seconds ================================================
Environment Status Duration
------------- -------- ------------
debug FAILED 00:00:17.566
=========================================== 1 failed, 0 succeeded in 00:00:17.566 ===========================================
Honestly, i spent several weeks on the esp rust libraries to try understand all the things going on there.
From starting with the esp32-hal
or with the esp32-std-example
for the http, wifi etc.. features, and now for my case as you suggest, for the platformio rust
specially (in my case) if have a need of importing external "C" methods in.
I think it could be really really nice if you could give an example with the platformio rust
with a part of the esp32-idf
features and maybe a random external "C" example and make them dancing together for a nice elf
result. Im pretty sure that you will bring more people over here.
A nice 'firework'.
I did not found any better rust embedded integration experiment than yours so again thx for this job.
At least any suggestion or good starting point with rust esp32 for bluetooth
( after the idf menu config enabled ) & espNow
communication to make them singing ?.
But it seems to have an issue with
espidf
framework.
This is now fixed:
cargo install cargo-pio
I think it could be really really nice if you could give an example with the
platformio rust
with a part of theesp32-idf
features and maybe a random external "C" example and make them dancing together for a niceelf
result. Im pretty sure that you will bring more people over here.
There's now a PIO-first demo project specifically for the ESP32-CAM
board here
src/lib.rs
firstextern "C"
bindings in the src/lib.rs
file. Given how few the methods of the CAM driver are, this is the easiest way to start. Don't think about "bindgen" as of yet.At least any suggestion or good starting point with rust esp32 for
bluetooth
( after the idf menu config enabled ) &espNow
communication to make them singing ?.
This is a whole project by itself, which is not easy, because there are NO standard, safe Rust APIs for Bluetooth, to which to map the ESP32 C-level drivers. And my limited free time is completely occupied with other Rust embedded issues right now, so here you are on your own...
Dito for espNow
.
Thank for all. I'll give a shot for the esp32-cam starter project. Let me know if can help you for any subjects. I closed it for now.
Hi, and first thx for all the hard work you've done. I'm just starting to try the
cargo-pio
tool. So i've executed this first command: `cargo pio new -b esp32dev esp32dev' the platform.ini is :After running the command:
cargo pio build
witharduino
and then withespidf
framework I got error :I tried to change the framework to the
espidf
and exactly the same error.rustc 1.57.0-nightly (9dd4ce80f 2021-09-17)
cargo 1.57.0-nightly (33ee5f82e 2021-09-17)
I try using the esp32 directly from creating the project from pio. And it works as expected. Any idea ?