You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using MQTT-C in a bare-metal project on Keil MDK 5 and I encountered an issue with memory alignment.
I noticed that the returned structure members from mqtt_mq_get were shifted by 1 or more bits. Then leading to messages with the wrong payload size and some other random errors.
The problem stopped when I added the packed attribute to the struct mqtt_queued_message.
I am using MQTT-C in a bare-metal project on Keil MDK 5 and I encountered an issue with memory alignment.
I noticed that the returned structure members from
mqtt_mq_get
were shifted by 1 or more bits. Then leading to messages with the wrong payload size and some other random errors.The problem stopped when I added the
packed
attribute to the structmqtt_queued_message
.Before:
struct mqtt_queued_message {
After:
struct __attribute__((packed)) mqtt_queued_message {
I don't know if it's the best solution but it fixed my problem, so I thought I should report it.
The text was updated successfully, but these errors were encountered: