esp-rs / esp-idf-hal

embedded-hal implementation for Rust on ESP32 and ESP-IDF
https://docs.esp-rs.org/esp-idf-hal/
Apache License 2.0
456 stars 171 forks source link

cargo build for xtensa MCUs fails with ESP toolchain 1.70.0.X #270

Closed oyvindnetland closed 1 year ago

oyvindnetland commented 1 year ago

UPDATE: WORKAROUND: Use 1.69.0 until the issue is fixed (it is in the Espressif LLVM fork).

============================

I wanted to play around with this project as im learning rust and like to use ESP32. But i had a few snags when trying to build this, so hope my investigation can be helpful to fix these issues, or possibly figure out what the problem with my setup is.

First of all i didnt get the cargo espflash command in the readme to work (didnt recognice --target). So i ended up using

ESP_IDF_VERSION=release/v4.4 cargo build --target xtensa-esp32-espidf --example ledc-simple

which at least build the same. I dont know if this is because commands have changed or weirdness with my setup. If its the first, i could make a PR for this.

Secondly, I get this with newer versions:

Compiling esp-idf-hal v0.40.1 (/home/oyvindne/esp-rs/esp-idf-hal)
LLVM ERROR: Unexpected operand value!
error: could not compile `esp-idf-hal` (lib)
warning: build failed, waiting for other jobs to finish...

I did a bisect, and found that this started with commit dafacbeae9a9ede7c4f72b104ad687b23c750b7

This is with ubuntu 23.04, but i experimented with some other linux versions with docker and seems to be the same

Vollbrecht commented 1 year ago

Your second error is related to a problem in the compiler-chain - we also observed that in our CI. A fix is already in the making by the compiler folks but will land only in the next release there, so you should downgrade it till than. info: https://github.com/esp-rs/esp-idf-hal/commit/73327076186d5603007c6ba6b4382b36c0a3e3c1 you can downgrade by using espup install --toolchain-version 1.69.0

For the first problem, what version of espflash are you using? There are some syntax changes between 1.7 and the new 2.0 release versions.

oyvindnetland commented 1 year ago

I can confirm that downgrading the toolchain works

Yes, i got 2.0 version of espflash. with 1.7 version i successfully flashed the esp with

 ESP_IDF_VERSION=release/v4.4 cargo espflash --target xtensa-esp32-espidf --example ledc-simple --monitor /dev/ttyUSB0
Vollbrecht commented 1 year ago

espflash 2.0 now needs the flash keyword following after espflash . For more checkout espflash --help

dacut commented 1 year ago

This should be fixed, I believe, with the new 1.71 toolchain.

MabezDev commented 1 year ago

Correct, this is fixed in the 1.70.1 release. Closing.