Skip to content

Example doesn't compile after adding MQTT dependency #322

Answered by Rahix
rkudryashov asked this question in Q&A
Discussion options

You must be logged in to vote

The heapless crate has a cas feature which is enabled by default. Maybe disabling that with

[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. avr-atmega328p.json) you can set

"max-atomic-width": 16

Be 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...

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by rkudryashov
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #276 on September 02, 2022 10:49.