[fpc-pascal] Object Pascal & arm-linux

Florian Klaempfl florian at freepascal.org
Fri Feb 1 17:43:01 CET 2008

Koenraad Lelong schrieb:
> Hi,
> I successfully ran some MSE-gui test-programs on my arm-board. To do
> this I used a patched fpc 2.2.0-fixes.
> The patch involved backporting a fix from fpc-2.3.1 for
> TBinaryObjectReader : the arm processor has no (AFAIK) extended type. I

Which revision is this?

> needed 2.2.1 because 2.3.1 breaks MSE-gui.
> I still have problems concerning floating points. When I put a
> real-value in a component at design-time , it's not displayed OK, e.g.
> 1.0 is displayed as 5.29980882362664E-0315. When I put some real into it
> at run-time it's fine. Also 0 is displayed fine if entered at design-time.
> I also think that this problem breaks another component I would like to use.
> I would like to make certain that patch works, any suggestions how to do
> this ?

Only default arm-linux, doubles are mixed little/big endian: the two
dwords are ordered itself little endian but the relation between them is
like on a big endian system, resulting in
byte 4
byte 5
byte 6
byte 7
byte 0
byte 1
byte 2
byte 3

The reader/writer stuff has to take care of this. It applies if the fpu
type is fpa,fpa10 or fp11. You can simply use the define
FPC_DOUBLE_HILO_SWAPPED to detect this. The reason for this is that the
fpa* fpu was invented when arm was big endian only. So the fpu tells the
main core to load two dword. The main core loads the two dword from
memory as little endian though.

More information about the fpc-pascal mailing list