[fpc-devel] Freepascal in microcontrollers

Michael Schnell mschnell at lumino.de
Thu Feb 28 09:32:30 CET 2008


>
> The only thing I want to guarantee is that blockwrite followed by 
> blockread on a platform with the same endianness works and will work 
> in the future.
>
> This (combined with ifdef based endian conversion) guarantees 
> portability of structures to any platform.
>
> Or do I see this wrong?
>
IMHO, I do think this not enough.

ADAIK, there is an FP version for a high endian processor (68K); more 
can be crafted any time. It should be made easy to create communication 
systems independent of the architecture. Of course you can't have binary 
compatibility with all values by default (due to performance 
considerations), but if we do have a "bitpacked" type that is not 
optimized for speed but for structure, it should be possible to use it 
for that purpose.

Moreover communication via structures in a documented layout is very 
often needed (Network, files, hardware, ...). There should be an easy 
way to craft a record type according to such a documentation, may if be 
documented to hold it's multi-byte values in high or low endian 
representation. "bitpacked" did open this box of Pandora and it's an 
obvious request to go all the way :) .

(e.g.: TCP/IP defines high-endian, while PC's work low endian 
internally, so everything needs to be converted.)

-Michael



More information about the fpc-devel mailing list