Example doesn't compile after adding MQTT dependency #322
-
I'm trying to add support of publishing of MQTT messages to Arduino Uno firmware. There are several crates for this, for example, https://github.com/00imvj00/mqttrs: Both crates depend on https://github.com/japaric/heapless I add those dependencies to https://github.com/Rahix/avr-hal/blob/main/examples/arduino-uno/Cargo.toml The error stack:
Do you have any thoughts on this? Is there any workable config or workaround? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
The [dependencies.heapless]
version = "..."
default-features = false is enough to get it working. But you might need to do this in the mqtt crate. If the crates requires atomics from heapless, this won't work of course. There is a hack but it is very error prone. In your target spec file (e.g. "max-atomic-width": 16 Be warned: There is a high chance that this produces corrupt binaries. The proper fix looks to be updating the |
Beta Was this translation helpful? Give feedback.
-
Thanks! I've tried to bump
Biut so far I didn't manage to make the example working. Anyway, it seems the error has nothing to do with |
Beta Was this translation helpful? Give feedback.
-
Agreed, I think this needs to be adressed in heapless. |
Beta Was this translation helpful? Give feedback.
The
heapless
crate has acas
feature which is enabled by default. Maybe disabling that withis enough to get it working. But you might need to do this in the mqtt crate.
If the crates requires atomics from heapless, this won't work of course.
There is a hack but it is very error prone. In your target spec file (e.g.
avr-atmega328p.json
) you can setBe warned: There is a high chance that this produces corrupt binaries.
The proper fix looks to be updating the
atomic-polyfill
dependeny of heapless. From what I can tell, the latest version of that has proper avr support and heapless is just lagging behind...