[fpc-pascal] Byte order modification in fpc on ARM?

Bo Berglund bo.berglund at gmail.com
Mon Oct 19 15:23:25 CEST 2015


I am making a control program for a data collection system using FPC +
Lazarus on a Raspberry Pi2 platform. I will use a number of Delphi
units, which implement the communications and data handling needs in a
way that works fine on a Windows platform.

While looking over existing code I see that there are instructions to
modify received data from the instrument by reversing the byte order.
The reason for that was that the instrument is based on a Motorola
controller and it uses the opposite byte order as in the Intel CPU:s
on the PC. Since download is of binary data areas in the instrument
the byte order change was necessary for all multi-byte data like word
and integers as well as real (floating point 32 bit values).

Now I wonder if it will be necessary also on an ARM platform like the
RPi2?
Is there a function or such to interrogate the byte order of the
platform FPC runs on? So that I could add a test at the start of
download to check if swapping is needed?

Or is the ARM used on RPi2 working with the same byte order as the
Motorola MC68HC11 MCU is?
In that case I must switch out the swapping...


-- 
Bo Berglund
Developer in Sweden




More information about the fpc-pascal mailing list