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
when packed_id is casted at (uint16_t) buf = (uint16_t) MQTT_PAL_HTONS(packet_id);
It tries to write to address buf + 67 an uint16 packed_id variable, what is an unaligned exception on some arch.
So my proposal is to change ALL uint16_t casts to uint8_t buf to use memcpy, or use some kind of put_unaligned macros.
Regards,
Andras
The text was updated successfully, but these errors were encountered:
Sorry for the delayed response. Glad to hear that QoS 0 is working okay. It's always good to get feedback from different platforms!
Oh yeah, I see what you mean. That was a bit of an oversight.
I like your solution though, that seems like a good way to solve it to me. Another option that pops into my head is keeping track of the byte index and setting the byte array with |= rather than = with the desired value bit-shifted by the byte index mod platform integer size.
Either solution seems good to me though. I have a really busy month, so I probably won't have time to implement this until Christmas. If you or anyone else would like to implement it though, I'd be more than happy to merge a pull request 😄
Hi,
First, thanks for your work!
I try to use the client on a cortex-m0+ SoC, and it works great with QOS0.
With QOS1 it throws an unaligned exception, in function
ssize_t mqtt_pack_pubxxx_request(uint8_t *buf, size_t bufsz,
enum MQTTControlPacketType control_type,
uint16_t packet_id)
when packed_id is casted at (uint16_t) buf = (uint16_t) MQTT_PAL_HTONS(packet_id);
It tries to write to address buf + 67 an uint16 packed_id variable, what is an unaligned exception on some arch.
So my proposal is to change ALL uint16_t casts to uint8_t buf to use memcpy, or use some kind of put_unaligned macros.
Regards,
Andras
The text was updated successfully, but these errors were encountered: