TelluIoT / ThingML

The ThingML modelling language
https://github.com/TelluIoT/ThingML
Apache License 2.0
101 stars 32 forks source link

Endianness and binary serialization #198

Closed ffleurey closed 6 years ago

ffleurey commented 6 years ago

The binary serializer plugin we are using only works as long as the serializer and deserializer have the same endianness. Most of the platform we use are little endian (AVR 8bits on arduino, x86 in PCs, ARM on RPi, etc) but for example the MIPS CPU on the Arduino Yun is actually big endian. This makes the serialization between the uC and the MIPS processor wrond with any data type that is more than 1 byte. The way to fix it is not obvious because our binary serialization uses the the ThingML internal binary representation of messages and copies what comes on the serial strait into the scheduler FIFO. Also, when the code is generated in posix C, we do not know what will be the endianness of the target platform.

brice-morin commented 6 years ago

Well, I guess it is just by chance that the binary serialization for network plugins use the internal serialization. I understand it can be quite optimal to reuse it when targeting little endian. But what prevents you from writing a proper independent serializer (e.g. like it is done for JSON) for big endian? The goal of the serializers is indeed to be able to communicate with non-ThingML system...

brice-morin commented 6 years ago

I guess the fix for #218 also fixed that one? If not, re-open.