[fpc-pascal] arm big endian questions and info

Terry Kemp tkemp at klc.net.nz
Mon Mar 12 20:31:34 CET 2007

On Mon, 2007-03-12 at 16:41 +0000, Henry Vermaak wrote:
> > > these results are (everything compiled with -CfSOFT for big endian):
> > >
> > > 1)  writeln('Hello World') outputs "Hello WorldHello W".  all other
> > > writeln and readln calls seem to work after that.
> > >
> > > 2)  i get "Runtime error 207" when i attempt floating point operations.
> >
> > Try to get a stack trace please.
> >
Interesting. I was about to send the following... 

I played around on the weekend with several toolchains and multiple
cross-compile options (with / without -Ce, -CfSOFT etc) . With all of
these (arm-xscale-linux-gnu-, armv5b-softfloat-linux-, armeb-linux- and
armbe-linux-) I was getting runtime 207s with float. testing program
with qemu-armeb gave same result as running on (NSLU2) board.

FWIW arm-xscale-linux-gnu- in little endian with -CfSOFT seems work fine
in qemu-arm emulator

Changing endian_little to endian_big in compiler/systems/i_linux.pas
(which I believe is the correct thing to do for big endian arm systems)
results in bizarre output and hanging / segfaults.
A simple writeln('hello') outputs the string twice - hellohello without
CRLF - then - if set to writeln a float value as well - on qemu-armeb it
displays 2 of each hellohello0.0000.000 (without line feeds) - on NSLU2
board it hangs... hellohello - stuck forever.

My suspicion is that endian_big /needs/ to be defined in
compiler/systems/i_linux.pas but it severely breaks stuff. There may be
some {$IFDEF arm} that bypasses endian defs or the big endian bit
rotation is wrong for arm??  

What I would like to know is what the alignment stuff...
            alignment    :
                procalign       : 4;
                loopalign       : 4;
                jumpalign       : 0;
                constalignmin   : 0;
                constalignmax   : 4;
                varalignmin     : 0;
                varalignmax     : 4;
                localalignmin   : 4;
                localalignmax   : 8;
                recordalignmin  : 0;
                recordalignmax  : 4;
                maxCrecordalign : 4
            first_parm_offset : 8;
            stacksize    : 262144;
            abi : abi_default
does and if it needs to be changed for a big endian arm.

FWIW I have a prototype industrial evaporator running using a NSLU2 as
the controller. I am using a 2.0.5 fpc-armbe compiler with the
endian_big define set. The only issue I have is with float so I had to
use fixed point for analog data. It goes well though.


More information about the fpc-pascal mailing list