Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2012-10

Arm Hardfloat

26 messages · 7 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Den Jean

Hello,

I am trying to compile for hardfloat.

When passing floats as parameters to a C-library function call, I get incorrect values inside the library.
Both for singles as doubles.

If I write the same call to the c-library in c,
I get assembler like

call function test_param (int, single, single)

  test_param (i,f1,f2);
	ldr	r0, [fp, #-8]
	flds	s0, [fp, #-12]
	flds	s1, [fp, #-16]
	bl	test_param
  test_param (142,1.1,2.2);
	mov	r0, #142
	flds	s0, .L3
	flds	s1, .L3+4
	bl	test_param

In pascal I get the following assembler for this call

  test_param(i,f1,f2);
	ldr	r0,.Lj10
	ldr	r2,[r0]
	ldr	r0,.Lj6
	ldr	r1,[r0]
	ldr	r0,.Lj13
	ldr	r0,[r0]
	blx	test_param
  test_param(142,1.1,2.2);

ldr r2,.Lj5
ldr r1,.Lj8
mov r0,#142
blx test_param
blx FPC_DO_EXIT
ldmea r11,{r11,r13,r15}
.Lj5:
.byte 205,204,12,64
.Lj8:
.byte 205,204,140,63

Pascal compiler options like
fpc -Aas -O- -CfVFPv3 -Cparmv7 -CaEABI pmain.pp
or
fpc -Aas -dFPC_ARMEL -O- -dFPC_ABI_EABI -CfVFPv3 -Cparmv7 -CaEABI pmain

using fpc svn fixes_2_6 Revision: 22520

G++ calls as with -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -meabi=5 and is configured with
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/armv7l-unknown-linux-gnueabihf/4.7.1/lto- wrapper
Target: armv7l-unknown-linux-gnueabihf
Configured with: /build/src/gcc-4.7-20120721/configure --prefix=/usr -- libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man -- infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable- languages=c,c++,fortran,lto,objc,obj-c++ --enable-shared --enable- threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind- exceptions --enable-clocale=gnu --disable-libstdcxx-pch --enable-libstdcxx- time --enable-gnu-unique-object --enable-linker-build-id --with-ppl --enable- cloog-backend=isl --disable-ppl-version-check --disable-cloog-version-check -- enable-lto --enable-gold --enable-ld=default --enable-plugin --with-plugin- ld=ld.gold --with-linker-hash-style=gnu --disable-multilib --disable-libssp -- disable-build-with-cxx --disable-build-poststage1-with-cxx --enable- checking=release --host=armv7l-unknown-linux-gnueabihf --build=armv7l-unknown- linux-gnueabihf --with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16 Thread model: posix
gcc version 4.7.1 20120721 (prerelease) (GCC)

$ fpc -i
Free Pascal Compiler version 2.6.1

Compiler Date : 2012/10/03
Compiler CPU Target: arm
<snip>
Supported CPU instruction sets:
ARMV3
ARMV4
ARMV5
ARMV6
ARMV7
ARMV7M
CORTEXM3

Supported FPU instruction sets:
SOFT
LIBGCC
FPA
FPA10
FPA11
VFPV2
VFPV3

Supported ABI targets:
DEFAULT
SYSV
AIX
EABI
ARMEB
<snip>

Platform: Beaglebone
$ cat /proc/cpuinfo
Processor : ARMv7 Processor rev 2 (v7l)
BogoMIPS : 498.89
Features : swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x3
CPU part : 0xc08
CPU revision : 2

Hardware : am335xevm
Revision : 0000
Serial : 0000000000000000

Kind regards,

Den Jean

Reply by email

Jonas Maebe
to Den Jean
Den Jean wrote
I am trying to compile for hardfloat.

The problem is that you are not compiling for hardfloat.

Show quoted text 8 lines
Pascal compiler options like fpc -Aas -O- -CfVFPv3 -Cparmv7 -CaEABI pmain.pp or fpc -Aas -dFPC_ARMEL -O- -dFPC_ABI_EABI -CfVFPv3 -Cparmv7 -CaEABI pmain using fpc svn fixes_2_6 Revision: 22520

The hard float abi is not supported in fixes_2_6, and probably never will be. Additionally, you cannot compile programs for the hard float abi using a regular eabi compiler. You have to compile the ARM compiler with -dFPC_ARMHF.

Jonas

Reply by email

Unknown author
to Jonas Maebe

Hello,

The hard float abi is not supported in fixes_2_6, and probably never will be. Additionally, you cannot compile programs for the hard float abi using a regular eabi compiler. You have to compile the ARM compiler with -dFPC_ARMHF.

I tried fixes_2_6 first as the idea was to use lazarus Qt and I had problems with both lazarus and Qt binding using fpc 2.7 I only found FPC_ARMEL defined in fpc sources
and the VFPV3 in `fpc -i` made me believe this was how you define hardfloat. To me all this is still a bit confusing.

I already find out reading
http://lists.freepascal.org/lists/fpc-devel/2012-March/028576.html that ARMEL does not include hardfloat calling convention and that a new -dFPC_ARMHF has been defined.

So I used trunk and now I am able to create a cross compiler that seems to generate correct code. I had a small test program that calls a function with float arguments in a small test library. This test program now works.

Next arm question :-)
Currently I am unable to generate a native
compiler, I do things like (from memory, not in front of beaglebone) cd compiler
make cycle PP=old armel ppcarm 'all options like -dFPC_ARMHF -Cf.. -Ca.. -Cp.. ' this creates a ppcarm_hf and a armhf rtl
cd ..
make all install PP=previous ppcarm_hf
If use the ppcarm_hf as i noted by substituting as and ld with scripts, that not the right hardfloat parameters were passed to as with PP=old armel ppcarm This stops at compiling somewhere (fpmake if I remember well) I understand that compiling trunk with trunk and on arm is not a good idea. On top of that, this is very slow.
How can I avoid above. I would like to create it from cross.

But when I do
make crosszipinstall it gives me a cross ppcrossarm (i386 executable) and arm rtl/packages.
How can I generate a corresponding (to arm rtl/packages) ppcarm (arm executable) from i386 so that i can copy over a full fpc installation to the arm board?

Kind regards,

Den Jean

Reply by email

Jonas Maebe
to Unknown author
Show quoted text 7 lines
But when I do make crosszipinstall it gives me a cross ppcrossarm (i386 executable) and arm rtl/packages. How can I generate a corresponding (to arm rtl/packages) ppcarm (arm executable) from i386 so that i can copy over a full fpc installation to the arm board?

After the crosszipinstall, compiler/ppcarm (not installed, but in the source directory) is the native ARM compiler.

Jonas

Reply by email

Unknown author
to Jonas Maebe

Hi,

After the crosszipinstall, compiler/ppcarm (not installed, but in the source directory) is the native ARM compiler.

I looked there with `file pp* `
How could I have missed that ?
Thanks for the quick responses.

Kind regards,

Den Jean

Reply by email

Den Jean
to Unknown author
Show quoted text 5 lines
> After the crosszipinstall, compiler/ppcarm (not installed, but in the > source directory) is the native ARM compiler. I looked there with `file pp* ` How could I have missed that ?

Well I could check now and it is not there

make crosszipinstall CPU_TARGET=arm CROSSOPT="-Aas -dFPC_ARMHF -O- -CaEABIHF - CfVFPV3_D16 -Cparmv7a" BINUTILSPREFIX=arm-linux-gnu- INSTALL_PREFIX=/usr

Is there a manual make command to get it

Kind regards,

Jan

Reply by email

Florian Klämpfl
to Den Jean
Den Jean wrote 11 lines
On Thursday 04 October 2012 16:23:34 wrote: >> After the crosszipinstall, compiler/ppcarm (not installed, but in the >> source directory) is the native ARM compiler. > > I looked there with `file pp* ` > How could I have missed that ? Well I could check now and it is not there make crosszipinstall CPU_TARGET=arm CROSSOPT="-Aas -dFPC_ARMHF -O- -CaEABIHF - CfVFPV3_D16 -Cparmv7a" BINUTILSPREFIX=arm-linux-gnu- INSTALL_PREFIX=/usr

At least -dFPC_ARMHF shouldn't be a cross opt.

Reply by email

Den Jean
to Florian Klämpfl
Florian Klämpfl wrote
At least -dFPC_ARMHF shouldn't be a cross opt.

Thx for the info

extracts Makefile.fpc:

<snip>
##################################################################### # Cycle targets
<snip>
# 3. Source CPU Target CPU
# First source native compiler
# Second cross compiler
# Third target native compiler (skipped for cross installation) #
#####################################################################

<snip>

So with
make all CPU_TARGET=arm CROSSOPT="-Aas -O- -CaEABIHF -CfVFPV3_D16 -Cparmv7a" BINUTILSPREFIX=arm-linux-gnu- INSTALL_PREFIX=/usr

I do get an arm native compiler

Kind regards,

Jan

Reply by email

Thomas Schatzl
to Den Jean: Well I could check now and it is not there make crosszipinstall CPU_TARGET=arm…

Hi,

Den Jean wrote 9 lines
On Thursday 04 October 2012 16:23:34 wrote: > > After the crosszipinstall, compiler/ppcarm (not installed, but in the > > source directory) is the native ARM compiler. > > I looked there with `file pp* ` > How could I have missed that ? Well I could check now and it is not there

I put an armhf snapshot from today at
http://members.yline.com/~tom_at_work/fpc-2.7.1.arm-linux.tar.gz . I will see if I can figure out how to do automatic uploads from the fpc testsuite runs on a daily basis.

Btw, native compilation of a snapshot/zipinstall takes ~11mins on that arm machine - it's not that slow :)

Thomas

Reply by email

Den Jean
to Thomas Schatzl
Thomas Schatzl wrote

I was going to do the same thing :-)
Do you have more experiemce with fpc and armhf, any problems you are aware of?

will see if I can figure out how to do automatic uploads from the fpc testsuite runs on a daily basis. Btw, native compilation of a snapshot/zipinstall takes ~11mins on that arm machine - it's not that slow

If you are trying all compilation options, it is.
I also only have 128MB. If do not know if it affects fpc compilation, but I am sure it affects c++ qt4pas compilation.

Does this mean you can compile the fpc trunk compiler natively ? I will try now anyhow using the cross generated one.

I will also adapt the qt4 binding so that it compiles again with fpc 2.7.1 and compile it for arm.

Kind regards,

Jan

Reply by email

Thomas Schatzl
to Den Jean

Hi,

Den Jean wrote 7 lines
On Thursday 04 October 2012 21:09:55 Thomas Schatzl wrote: > I put an armhf snapshot from today at > http://members.yline.com/~tom_at_work/fpc-2.7.1.arm-linux.tar.gz . I was going to do the same thing :-) Do you have more experiemce with fpc and armhf, any problems you are aware of?

Daily testsuite results are available for both armel (2.6.0/fixes and 2.7.0/trunk, for a long time now) and armhf (only 2.7.0, for a few weeks iirc).

See
http://www.freepascal.org/testsuite/cgi-bin/testsuite.cgi?action=1&run1id=120732&run2id=120748&noskipped=1&failedonly=1

for comparison, and

http://www.freepascal.org/testsuite/cgi-bin/testsuite.cgi?action=1&run1id=120732&run2id=&noskipped=1&failedonly=1

for specific results.

Basically the difference between armel and armhf are
- fpc cannot create valid armhf shared libraries

Other problems common to both (just from interpreting the testsuite results, filtering known failing tests):
- there are issues with threading/synchronization (test machine is a quad-core box, previous test machine was single core where as usual such problems don't show up)
- fpu exceptions/setting fpu exception mask seem to not work
- some problems with fpc resources

Show quoted text 7 lines
> will see if I can figure out how to do automatic uploads from the fpc > testsuite runs on a daily basis. > Btw, native compilation of a snapshot/zipinstall takes ~11mins on that > arm machine - it's not that slow If you are trying all compilation options, it is. I also only have 128MB. If do not know if it affects fpc compilation,

The old build machine has only 64MB RAM (600 Mhz ARM11), so yes, it is possible, although somewhat slowly.

Does this mean you can compile the fpc trunk compiler natively ? I will try now anyhow using the cross generated one.

Yes. Probably one of the first milestones for a new arch is self-hosting (if possible at all).

Thomas

Reply by email

Sven Barth
to Den Jean: Thx for the info extracts Makefile.fpc: <snip>…
Den Jean wrote 24 lines
On Thursday 04 October 2012 20:40:23 Florian Klämpfl wrote: > At least -dFPC_ARMHF shouldn't be a cross opt. Thx for the info extracts Makefile.fpc: <snip> ##################################################################### # Cycle targets <snip> # 3. Source CPU Target CPU # First source native compiler # Second cross compiler # Third target native compiler (skipped for cross installation) # ##################################################################### <snip> So with make all CPU_TARGET=arm CROSSOPT="-Aas -O- -CaEABIHF -CfVFPV3_D16 -Cparmv7a" BINUTILSPREFIX=arm-linux-gnu- INSTALL_PREFIX=/usr I do get an arm native compiler

You still need OPT="-dFPC_ARMHF". That's what Florian ment with "shouldn't be a cross opt".

Regards,
Sven

Reply by email

Den Jean
to Thomas Schatzl: Daily testsuite results are available for both armel (2.6.0/fixes and 2.7.0/trunk, for a…
Thomas Schatzl wrote 10 lines
Basically the difference between armel and armhf are - fpc cannot create valid armhf shared libraries Other problems common to both (just from interpreting the testsuite results, filtering known failing tests): - there are issues with threading/synchronization (test machine is a quad-core box, previous test machine was single core where as usual such problems don't show up) - fpu exceptions/setting fpu exception mask seem to not work - some problems with fpc resources

Thx for the info

In the Qt binding I need to do this
SetExceptionMask([exDenormalized,exInvalidOp,exOverflow,exPrecision,exUnderflow,exZeroDivide]); because of Qt C++ not allowing such exceptions

is this a problem ?

Reply by email

peter green
to Den Jean
Den Jean wrote 21 lines
On Thursday 04 October 2012 21:54:19 Thomas Schatzl wrote: > Basically the difference between armel and armhf are > - fpc cannot create valid armhf shared libraries > > Other problems common to both (just from interpreting the testsuite > results, filtering known failing tests): > - there are issues with threading/synchronization (test machine is a > quad-core box, previous test machine was single core where as usual such > problems don't show up) > - fpu exceptions/setting fpu exception mask seem to not work > - some problems with fpc resources > Thx for the info In the Qt binding I need to do this SetExceptionMask([exDenormalized,exInvalidOp,exOverflow,exPrecision,exUnderflow,exZeroDivide]); because of Qt C++ not allowing such exceptions is this a problem ?

Short answer no.

Long answer: the reason those tests are failing is because the processor simply does not support floating point exceptions. So your calls to c++ are fine but your pascal code will need to be modified if it was previously relying on floating point exceptions.

Reply by email

Den Jean
to Thomas Schatzl: Daily testsuite results are available for both armel (2.6.0/fixes and 2.7.0/trunk, for a…
Thomas Schatzl wrote
Yes. Probably one of the first milestones for a new arch is self-hosting (if possible at all).

Ahum it always fails over here

time make OPT='-dFPC_ARMHF -Aas -O- -CaEABIHF -CfVFPV3_D16 -Cparmv7a' clean all

units_bs/arm-linux/fpmkunit.s:28079: Rd and Rm should be different in mul make[3]: Leaving directory `/home/jan/svn/fpc/packages/fpmkunit' /home/jan/svn/fpc/compiler/ppcarm fpmake.pp -n -
Fu/home/jan/svn/fpc/packages/fpmkunit/units_bs/arm-linux - Fu/home/jan/svn/fpc/rtl/units/arm-linux -dFPC_ARMHF -Aas -O- -CaEABIHF - CfVFPV3_D16 -Cparmv7a
fpmake.pp(34) Error: Can't call the assembler, error -9 switching to external assembling
fpmake.pp(34) Fatal: There were 2 errors compiling module, stopping Fatal: Compilation aborted
make[2]: *** [fpmake] Error 1
make[2]: Leaving directory `/home/jan/svn/fpc/packages' make[1]: *** [packages_smart] Error 2
make[1]: Leaving directory `/home/jan/svn/fpc'
make: *** [build-stamp.arm-linux] Error 2

real 17m1.938s
user 14m36.140s
sys 1m31.230s

Reply by email

Thomas Schatzl
to Den Jean

Hi,

Den Jean wrote 11 lines
On Thursday 04 October 2012 21:54:19 Thomas Schatzl wrote: > Yes. Probably one of the first milestones for a new arch is self-hosting > (if possible at all). Ahum it always fails over here time make OPT='-dFPC_ARMHF -Aas -O- -CaEABIHF -CfVFPV3_D16 -Cparmv7a' clean all units_bs/arm-linux/fpmkunit.s:28079: Rd and Rm should be different in mul

Just checked, processor info (-Cparmv7a) is not passed to the assembler. Try "-Cparmv7" - only then --march=armv7-a is passed correctly :)

Thomas

Reply by email

Thomas Schatzl
to Thomas Schatzl

Hi,

Thomas Schatzl wrote 14 lines
Hi, On Thu, 2012-10-04 at 22:51 +0200, Den Jean wrote: > > Ahum it always fails over here > > time make OPT='-dFPC_ARMHF -Aas -O- -CaEABIHF -CfVFPV3_D16 -Cparmv7a' clean > all > > units_bs/arm-linux/fpmkunit.s:28079: Rd and Rm should be different in mul Just checked, processor info (-Cparmv7a) is not passed to the assembler. Try "-Cparmv7" - only then --march=armv7-a is passed correctly :)

Fixed in r22541.

The starting compiler will still give some of these (non-fatal) warnings while compiling the compiler and rtl for the first time.

Hth,
Thomas

Reply by email

Den Jean
to Thomas Schatzl: Just checked, processor info (-Cparmv7a) is not passed to the assembler. Try "-Cparmv7" -…
Thomas Schatzl wrote
Just checked, processor info (-Cparmv7a) is not passed to the assembler. Try "-Cparmv7" - only then --march=armv7-a is passed correctly

yep.

but make still fails

/home/jan/svn/fpc/compiler/ppcarm src/fpmkunit.pp -n -Fu/home/jan/svn/fpc/rtl/units/arm-linux -Fu/home/jan/svn/fpc/packages/paszlib -Fu/home/jan/svn/fpc/packages/fcl-process -Fu/home/jan/svn/fpc/packages/hash -FUunits_bs/arm-linux -Fu../paszlib/src -Fu../hash/src -Fi../paszlib/src -Fi../fcl-process/src/unix -Fu../fcl-process/src -Fi../fcl-process/src/linux -Fi../fcl-process/src/dummy -dFPC_ARMHF -Aas -O- -CaEABIHF -CfVFPV3_D16 -Cparmv7 make[3]: Leaving directory `/home/jan/svn/fpc/packages/fpmkunit' /home/jan/svn/fpc/compiler/ppcarm fpmake.pp -n -Fu/home/jan/svn/fpc/packages/fpmkunit/units_bs/arm-linux -Fu/home/jan/svn/fpc/rtl/units/arm-linux -dFPC_ARMHF -Aas -O- -CaEABIHF -CfVFPV3_D16 -Cparmv7 fpmake.pp(34) Error: Can't call the assembler, error -9 switching to external assembling fpmake.pp(34) Fatal: There were 2 errors compiling module, stopping Fatal: Compilation aborted
make[2]: *** [fpmake] Error 1
make[2]: Leaving directory `/home/jan/svn/fpc/packages' make[1]: *** [packages_smart] Error 2
make[1]: Leaving directory `/home/jan/svn/fpc'
make: *** [build-stamp.arm-linux] Error 2

Reply by email

Thomas Schatzl
to Den Jean

Hi,

Den Jean wrote 6 lines
On Thursday 04 October 2012 23:18:43 Thomas Schatzl wrote: > Just checked, processor info (-Cparmv7a) is not passed to the assembler. > Try "-Cparmv7" - only then --march=armv7-a is passed correctly yep. but make still fails

Tried again, works fine.

Let's start from the beginning. What's your starting compiler? 2.7.0 I guess? (which is the only option anyway for hardfloat). Binutils/gas version?

/home/jan/svn/fpc/compiler/ppcarm src/fpmkunit.pp -n -Fu/home/jan/svn/fpc/rtl/units/arm-linux -Fu/home/jan/svn/fpc/packages/paszlib -Fu/home/jan/svn/fpc/packages/fcl-process -Fu/home/jan/svn/fpc/packages/hash -FUunits_bs/arm-linux -Fu../paszlib/src -Fu../hash/src -Fi../paszlib/src -Fi../fcl-process/src/unix -Fu../fcl-process/src -Fi../fcl-process/src/linux -Fi../fcl-process/src/dummy -dFPC_ARMHF -Aas -O- -CaEABIHF -CfVFPV3_D16 -Cparmv7 make[3]: Leaving directory `/home/jan/svn/fpc/packages/fpmkunit' /home/jan/svn/fpc/compiler/ppcarm fpmake.pp -n -Fu/home/jan/svn/fpc/packages/fpmkunit/units_bs/arm-linux -Fu/home/jan/svn/fpc/rtl/units/arm-linux -dFPC_ARMHF -Aas -O- -CaEABIHF -CfVFPV3_D16 -Cparmv7 fpmake.pp(34) Error: Can't call the assembler, error -9 switching to external assembling

Are you sure (the correct) gas is in the path? (It's strange because the compilation before found correct gas; afaik fpmake/packages are only compiled at the end)

Can you also try a "make distclean"? And check if the packages directory does not contain any fpmake executables, object or ppu files afterwards; if so, please remove them. Fpmake sometimes gets messed up if parts of a previous compilation are still there. Further, at the moment, fpc silently allows linking of mixed armel and armhf object files, which does not work.

fpmake.pp(34) Fatal: There were 2 errors compiling module, stopping Fatal: Compilation aborted make[2]: *** [fpmake] Error 1 make[2]: Leaving directory `/home/jan/svn/fpc/packages'

Can you enter the "/home/jan/svn/fpc/packages" directory and issue the following command (maybe before doing a distclean):

/home/jan/svn/fpc/compiler/ppcarm fpmake.pp -n
-Fu/home/jan/svn/fpc/packages/fpmkunit/units_bs/arm-linux -Fu/home/jan/svn/fpc/rtl/units/arm-linux -dFPC_ARMHF -Aas -O- -CaEABIHF -CfVFPV3_D16 -Cparmv7 -s

(note the additional "-s" param) and paste the resulting ppas.bat after it fails here? The line that invokes gas should use the correct gas. And it should have a correct "--march=armv7-a" parameter.

Thomas

Reply by email

Den Jean
to Thomas Schatzl
Thomas Schatzl wrote
Let's start from the beginning. What's your starting compiler? 2.7.0 I guess? (which is the only option anyway for hardfloat).

on i386 i used cross binutils from fedora packages cross-binutils-common.noarch 2.22.52.0.3-1.fc17
cross-gcc-common.noarch 4.7.1-0.1.20120606.fc17
fpc 2.7.1 latest svn

Binutils/gas

on arm

$ fpc -v
Free Pascal Compiler version 2.7.1 [2012/10/04] for arm created from on i386 svn trunk using crosszip ....

$ as --version
as called with --version
GNU assembler (GNU Binutils) 2.22.0.20120323

Are you sure (the correct) gas is in the path? (It's strange because the

correct ?

Show quoted text 5 lines
compilation before found correct gas; afaik fpmake/packages are only compiled at the end) Can you also try a "make distclean"? And check if the packages directory does not contain any fpmake executables, object or ppu files afterwards;

already removed them by hand beforing this (make clean in that dir, stil had 1 .o and fpcmake (-> delp . and rm fpmake)

if so, please remove them. Fpmake sometimes gets messed up if parts of a previous compilation are still there. Further, at the moment, fpc silently allows linking of mixed armel and armhf object files, which does not work.

thx for info

Show quoted text 7 lines
> fpmake.pp(34) Fatal: There were 2 errors compiling module, stopping > Fatal: Compilation aborted > make[2]: *** [fpmake] Error 1 > make[2]: Leaving directory `/home/jan/svn/fpc/packages' Can you enter the "/home/jan/svn/fpc/packages" directory and issue the following command (maybe before doing a distclean):

too late, nice to know

Show quoted text 8 lines
/home/jan/svn/fpc/compiler/ppcarm fpmake.pp -n -Fu/home/jan/svn/fpc/packages/fpmkunit/units_bs/arm-linux -Fu/home/jan/svn/fpc/rtl/units/arm-linux -dFPC_ARMHF -Aas -O- -CaEABIHF -CfVFPV3_D16 -Cparmv7 -s (note the additional "-s" param) and paste the resulting ppas.bat after it fails here? The line that invokes gas should use the correct gas. And it should have a correct "--march=armv7-a" parameter.

I already had replaced as with a shell script that shows me the passed parameters: e.g now I have:
as called with -mfloat-abi=hard -meabi=5 -march=armv7-a -mfpu=vfpv3-d16 -o arm/units/arm-linux/pp.o arm/units/arm-linux/pp.s

Thomas

thx

Reply by email

Den Jean
to Thomas Schatzl: Tried again, works fine. Let's start from the beginning. What's your starting compiler?…
Thomas Schatzl wrote
(note the additional "-s" param) and paste the resulting ppas.bat after it fails here? The line that invokes gas should use the correct gas. And it should have a correct "--march=armv7-a" parameter.

$ cat ppas.sh
#!/bin/sh
DoExitAsm ()
{ echo "An error occurred while assembling $1"; exit 1; } DoExitLink ()
{ echo "An error occurred while linking $1"; exit 1; } echo Assembling fpmake
/usr/bin/as -mfloat-abi=hard -meabi=5 -march=armv7-a -mfpu=vfpv3-d16 -o fpmake.o fpmake.s if [ $? != 0 ]; then DoExitAsm fpmake; fi
rm fpmake.s
echo Linking fpmake
OFS=$IFS
IFS="
"
/usr/bin/ld --dynamic-linker=/lib/ld-linux-armhf.so.3 --gc-sections -L. -o fpmake link.res if [ $? != 0 ]; then DoExitLink fpmake; fi
IFS=$OFS

Reply by email

Thomas Schatzl
to Den Jean: on i386 i used cross binutils from fedora packages cross-binutils-common.noarch …
Den Jean wrote 8 lines
On Friday 05 October 2012 00:12:46 Thomas Schatzl wrote: > Let's start from the beginning. What's your starting compiler? 2.7.0 I > guess? (which is the only option anyway for hardfloat). on i386 i used cross binutils from fedora packages cross-binutils-common.noarch 2.22.52.0.3-1.fc17 cross-gcc-common.noarch 4.7.1-0.1.20120606.fc17 fpc 2.7.1 latest svn

Okay.

Show quoted text 10 lines
> Binutils/gas on arm $ fpc -v Free Pascal Compiler version 2.7.1 [2012/10/04] for arm created from on i386 svn trunk using crosszip .... $ as --version as called with --version GNU assembler (GNU Binutils) 2.22.0.20120323

And it's configured correctly for armhf target? Something like "This assembler was configured for a target of `arm-linux-gnueabihf'."

Show quoted text 5 lines
> Can you also try a "make distclean"? And check if the packages directory > does not contain any fpmake executables, object or ppu files afterwards; already removed them by hand beforing this (make clean in that dir, stil had 1 .o and fpcmake (-> delp . and rm fpmake)

Unfortunately it's not that easy: the subdirectories also contain fpmake executables, and then there are the "units_bs" directories that are often kept which contain compilation artifacts.
Don't know what "delp" does, ie. whether it also cleans out that.

But your problem is that the compiler cannot find the correct gas or just fails when trying to invoke it (that error -9).

Show quoted text 19 lines
> > fpmake.pp(34) Fatal: There were 2 errors compiling module, stopping > > Fatal: Compilation aborted > > make[2]: *** [fpmake] Error 1 > > make[2]: Leaving directory `/home/jan/svn/fpc/packages' > > Can you enter the "/home/jan/svn/fpc/packages" directory and issue the > following command (maybe before doing a distclean): too late, nice to know > /home/jan/svn/fpc/compiler/ppcarm fpmake.pp -n > -Fu/home/jan/svn/fpc/packages/fpmkunit/units_bs/arm-linux > -Fu/home/jan/svn/fpc/rtl/units/arm-linux -dFPC_ARMHF -Aas -O- -CaEABIHF > -CfVFPV3_D16 -Cparmv7 -s > > (note the additional "-s" param) and paste the resulting ppas.bat after > it fails here? The line that invokes gas should use the correct gas. And > it should have a correct "--march=armv7-a" parameter. I already had replaced as with a shell script that shows me the passed parameters: e.g now I have: as called with -mfloat-abi=hard -meabi=5 -march=armv7-a -mfpu=vfpv3-d16 -o arm/units/arm-linux/pp.o arm/units/arm-linux/pp.s

The parameters seem to be okay.

Given it's still the "Error -9" that is the problem, can you manually invoke gas using the line from the ppas.sh script?

Maybe it prints some more information.

Honestly, I am somewhat out of ideas here.

Thomas

Reply by email

Den Jean
to Thomas Schatzl
Thomas Schatzl wrote
assembler was configured for a target of `arm-linux-gnueabihf'."

$ as --version
as called with --version
GNU assembler (GNU Binutils) 2.22.0.20120323
Copyright 2011 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or later. This program has absolutely no warranty.
This assembler was configured for a target of `armv7l-unknown-linux-gnueabihf'. ~]$

Given it's still the "Error -9" that is the problem, can you manually invoke gas using the line from the ppas.sh script?

manually executed with strace and the .o was created without errors and exited with value 0
so why does fpc always thinks it is not zero
and why if i continue make without clean
does it seem that it starts all over again
with c++ make, it continuous on that file

Honestly, I am somewhat out of ideas here.

me too
also with c++ on board compilation I have
g++ exiting with internal errors, but when I
restart make it continues for some time fine
and then internal error again on another later
file, it is version g++ (GCC) 4.7.1 20120721 (prerelease), I am not too fond of too new gccs, always problems...

I will install another distro (now arch linux) too see if it is related to too bleeding edge.

Thanks already for all the help.

Kind regards,

Jan

Reply by email

Den Jean
to Den Jean: $ cat ppas.sh #!/bin/sh DoExitAsm () { echo "An error occurred while assembling $1"; exit…
Den Jean wrote
if [ $? != 0 ]; then DoExitLink fpmake; fi

scripts never ly, there was no swap partition and little memory -> accidents bound to happen.

I now have 256MB and a swap file.
I can compile and run lazarus qt.
Qt4 Binding V2.6RC2 for BeagleBoard:
http://users.telenet.be/Jan.Van.hijfte/qtforfpc/V2.6RC2/

However I still cannot compile fpc natively.

These are the errors when trying
to do make cycle using the ppcarm you provided
for fpc svn latest trunk
make cycle OPT='-dFPC_ARMHF -Aas -O- -CaEABIHF -CfVFPV3_D16 -Cparmv7' PP=~/ppc_armhf

system.inc(1106,3) Note: Local variable "prevaddr" is assigned but never used text.inc(1789,14) Warning: Implicit string type conversion from "AnsiString" to "UnicodeString"
text.inc(2013,44) Warning: Implicit string type conversion with potential data loss from "UnicodeString" to "AnsiString"
arm.inc(26,3) Note: Local variable "cpu_has_edsp" is assigned but never used Assembling system
as called with -mfloat-abi=hard -meabi=5 -march=armv7 -mfpu=vfpv3-d16 -o ../../rtl/units/arm-linux/system.o ../../rtl/units/arm-linux/system.s ../../rtl/units/arm-linux/system.s: Assembler messages: ../../rtl/units/arm-linux/system.s:14: Error: lo register required -- `stmfd r13!,{r4,r11,r12,r14,r15}'
../../rtl/units/arm-linux/system.s:15: Error: lo register required -- `sub r11,r12,#4'
../../rtl/units/arm-linux/system.s:17: Error: lo register required -- `strb r0,[r11,#-48]'
../../rtl/units/arm-linux/system.s:18: Error: lo register required -- `str r2, [r11,#-56]'
../../rtl/units/arm-linux/system.s:19: Error: lo register required -- `str r3, [r11,#-52]'
../../rtl/units/arm-linux/system.s:33: Error: lo register required -- `strb r0,[r11,#-64]'
../../rtl/units/arm-linux/system.s:34: Error: lo register required -- `ldrsb r0,[r11,#-64]'
../../rtl/units/arm-linux/system.s:36: Error: Thumb does not support conditional execution
../../rtl/units/arm-linux/system.s:37: Error: Thumb does not support conditional execution

Kind regards,

Jan

Reply by email

Thomas Schatzl
to Den Jean

Hi,

Den Jean wrote 7 lines
However I still cannot compile fpc natively. These are the errors when trying to do make cycle using the ppcarm you provided for fpc svn latest trunk make cycle OPT='-dFPC_ARMHF -Aas -O- -CaEABIHF -CfVFPV3_D16 -Cparmv7' PP=~/ppc_armhf

Use -Cparmv7a if you use a current snapshot.

This is a bug of FPC that when compiling for armv7, it uses armv7a instructions anyway, which has been exposed only recently.

Previously, when using -Cparmv7 it actually passed -march=armv7-a to the assembler, which made it work. Previously, in case of using -Cparmv7a it passed no march, which resulted in different assembler issues.

That's why previously I told you to use -Cparmv7 (it did not work with -Cparmv7a); but this has changed.

Sorry for the confusion,

Thomas

Reply by email

Den Jean
to Thomas Schatzl
Thomas Schatzl wrote
That's why previously I told you to use -Cparmv7 (it did not work with -Cparmv7a); but this has changed.

It works now.

Sorry for the confusion,

Thank you very much again for the help.

Kind regards,

Jan

Reply by email