Recent

Author Topic: Hard float  (Read 14785 times)

djdjdjole

  • Full Member
  • ***
  • Posts: 101
Hard float
« on: February 05, 2013, 06:31:56 pm »
My intetnion is to build Lazarus to be able to generate ARM hard float ABI. My consideration is that I should only change "make crossinstall" step in order to generate hard float variants of ppu's.
Lazarus can be build as usuall - no special options. My first question is am I right having such concept ?
And second question (if the first one is OK), does it mean that this way I can only compile for hard float, and cannot generate soft float binaries ?

Regards

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12710
  • FPC developer.
Re: Hard float
« Reply #1 on: February 06, 2013, 02:11:04 pm »
Hardfloat is only in FPC 2.7.1, the development version. Some support is backported to 2.6.x by debian maintainers, but this is not supported by the FPC team.

You will indeed need to build a new FPC installation (and lazarus/lcl) with the correct HF flags and target selected.

The result will be something that will only generate HF, but you can have multiple such crosscompilation systems installed on one computer.

avra

  • Hero Member
  • *****
  • Posts: 2584
    • Additional info
Re: Hard float
« Reply #2 on: February 06, 2013, 03:14:07 pm »
If you face problems you can't solve, take a look at CT solution Raspberry Pi example:
http://www.pilotlogic.com/sitejoom/index.php/forum/other-cross-build-targets/2238-my-first-raspbian-app
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

djdjdjole

  • Full Member
  • ***
  • Posts: 101
Re: Hard float
« Reply #3 on: February 06, 2013, 05:00:54 pm »
Regarding marcov's response, I am little bit confused, with success story:
http://www.lazarus.freepascal.org/index.php?topic=18749.0 and partially with
http://web.archiveorange.com/archive/v/Q8InytiiWjAdd60yEaVc. In second case it was all about changing assembler's options.
AFAIK it is not related to 2.7.1, although I didn't succeed either way.
And regarding avra, I must say, I only heard of CT, didn't try anything, because I prefer Pascal (CT is C or C++ ?) and I am pretty familiar with Lazarus class structure. However I'm going to inform myself in that matter.

Regards

avra

  • Hero Member
  • *****
  • Posts: 2584
    • Additional info
Re: Hard float
« Reply #4 on: February 07, 2013, 10:34:50 am »
And regarding avra, I must say, I only heard of CT, didn't try anything, because I prefer Pascal (CT is C or C++ ?) and I am pretty familiar with Lazarus class structure.
CT stands for Lazarus CodeTyphon edition (so it is Pascal), which is actually cross platform Lazarus on steroids with zillion components (some not available elsewhere). You can also set cross platform on Lazarus yourself, but it is not easy so someone has already done the hard work for you. Only you can say after trial if CT suits your needs better then official Lazarus.

http://www.pilotlogic.com/sitejoom
« Last Edit: February 07, 2013, 10:36:22 am by avra »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

djdjdjole

  • Full Member
  • ***
  • Posts: 101
Re: Hard float
« Reply #5 on: February 07, 2013, 10:55:25 am »
Regarding marcov's quotation of fpc 2.7.1, I used ftp://ftp.freepascal.org/fpc/snapshot/v27/source/ and didn't succeed to compile neither lazarus1.0 nor 1.1 (without HF). So, no much use of 2.7.1 in this context.
And as response to avra- I think, I am familiar with adjusting crosscompile toolchain with Lazarus as front and - I did few usefull (not so big) ARM board applications. Problem is here, much about HF compiling (and also big problem is described in first sentence of this text).
There are inconsistenties somewhere. Either prebuild fpc (.rpm/.deb) will not compile fpc sources, or that new fpc cannot build lazarus, or lazarus incorrectly build final target code.
I don't know if it is the case with CT, but getting usefull environment seems to me like gambling.

Regards

avra

  • Hero Member
  • *****
  • Posts: 2584
    • Additional info
Re: Hard float
« Reply #6 on: February 07, 2013, 11:27:11 am »
I don't know if it is the case with CT, but getting usefull environment seems to me like gambling.
Experts would not agree with you, but cross platform beginners would. One of the main intentions of Lazarus CT edition is to solve cross platform problems for beginners. Using CT and downloading Pi dependencies from the link I provided should be one of the few possible solutions for your problem. I am just saying that if you run out of options you can also follow the path that I have suggested.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

djdjdjole

  • Full Member
  • ***
  • Posts: 101
Re: Hard float
« Reply #7 on: February 07, 2013, 11:59:18 am »
I don't know about CT, but my quotation, regarding crosscompiling for Lazarus only, is based on many attempts (and what to tell about 2.7.1 not compiling lazarus sources that I mentioned in previous post). 
BTW as Pi was mentioned, I noticed many useffull atempts of installing Lazarus on Pi, so no need for crosscompiling - only patience is needed (related to speed).
I begin to think, because of CPU power and memory growth, the same will be also available on future ARM boards.

djdjdjole

  • Full Member
  • ***
  • Posts: 101
Re: Hard float
« Reply #8 on: February 07, 2013, 03:10:11 pm »
And forgot to ask one more question, althought it may be for separate thread.
Has anyone succedded to build fpc compiler from trunk (revision is now 23583) ?
If so, which fpc was used for building it?
I tried with fpc from fpc-2.6.0-0.laz.i686.rpm (on Ubuntu 11.04), but errors appear.

Thanks

djdjdjole

  • Full Member
  • ***
  • Posts: 101
Re: Hard float
« Reply #9 on: February 11, 2013, 03:16:54 pm »
Somehow succeded to build trunk fpc and Lazarus also. However I am not sure about flags that I should give in order to crosscompile fpc for hard float ARM. Does someone have any suggestion regarding that matter?

Thanks

djdjdjole

  • Full Member
  • ***
  • Posts: 101
Re: Hard float
« Reply #10 on: February 14, 2013, 10:07:33 pm »
OK - built compiler that support hard float. When I put float multiplying in code, I see in assembler listing hard float instructions (eg. fmuld).
But even for simple console program: (write(14.2323* 3.232); readln;), I faced problems. I've got correct result on screen, but when I hit any key (to exit program - due to "readln" command), I got Access violation exception on exit. The same states for GTK program- at the beginning of it.
What should I suspect to ?

djdjdjole

  • Full Member
  • ***
  • Posts: 101
Re: Hard float
« Reply #11 on: February 14, 2013, 10:24:20 pm »
A small correction. In previous post- code "write(14.2323* 3.232"; ..., hard float instruction - "fmuld" shall not be generated, but in: "a:= 14.2323; a:= a* 3.232", it is clealy seen in assembler listing.
No matter- access violation still stands.

djdjdjole

  • Full Member
  • ***
  • Posts: 101
Re: Hard float
« Reply #12 on: February 20, 2013, 11:10:14 am »
Now it's OK - was matter of correct flags. My simple GTK application works on RPi, crosscompiled on Lazarus/Ubuntu.
And now -vacation! By.

Thanks all

halmariane

  • New Member
  • *
  • Posts: 30
Re: Hard float
« Reply #13 on: March 11, 2013, 03:07:56 pm »
Now it's OK - was matter of correct flags. My simple GTK application works on RPi, crosscompiled on Lazarus/Ubuntu.
And now -vacation! By.

Thanks all

Hi djdjdjole

I am the same problem with the GTK. Console application works nice. TForm Applications crash at start.
What are the flags you are talking about?

Best regards
« Last Edit: March 11, 2013, 03:09:36 pm by halmariane »

djdjdjole

  • Full Member
  • ***
  • Posts: 101
Re: Hard float
« Reply #14 on: March 11, 2013, 03:45:38 pm »
Hi halmariane

I first compiled Thrunk FPC with 2.6.0 rpm FPC package (see http://wiki.freepascal.org/Setup_Cross_Compile_For_ARM).
Then you shoud crosscompile your FPC (Thrunk version), this way (also Lazarus should be compiled with this Thrunk):

sudo make crossinstall CPU_TARGET=arm OS_TARGET=linux CROSSBINDIR=/home/djdjdjole/lazarus/fpc/binutils/
OPT=-dFPC_ARMHF CROSSOPT="-Caeabihf -Cparmv6 -Cfvfpv3_d16" INSTALL_PREFIX=/usr

Please - change the folder of binutils, according to your arangement.
The same three flags you should quote inside the Lazarus IDE (in Project Options - "Others" section). Of course, you should also add the path of shared libraries, you pulled from target RPi.

Generated binary - transfer to RPi (ssh or so). I tried few more GTK examples - works as expected.

Regards

 

TinyPortal © 2005-2018