Re: [fpc-pascal] installing cross fpc in parallel to systems fpc

2017-11-10 Thread Marco van de Voort
In our previous episode, Marco van de Voort said:
> > > fpc -Parm calls ppcarm, fpc -Px86_64 calls ppcx64.
> > 
> > Besides the language - fpc and lazarus are so cool tools!
> 
> and fpc  -V-1.0 calls ppc386-1.0  etc etc :-)

Whoops, that should be -V1.0 of course. The idea is that you can give
releases suffixes, though that is mainly useful for different versions
(since then you can each version share a fpc.cfg using version #ifdefs)
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] installing cross fpc in parallel to systems fpc

2017-11-10 Thread Marco van de Voort
In our previous episode, Marc Santhoff said:
> > fpc -Parm calls ppcarm, fpc -Px86_64 calls ppcx64.
> 
> Besides the language - fpc and lazarus are so cool tools!

and fpc  -V-1.0 calls ppc386-1.0  etc etc :-)
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] installing cross fpc in parallel to systems fpc

2017-11-10 Thread Marc Santhoff
On Fr, 2017-11-10 at 19:07 +0100, Mattias Gaertner wrote:
> On Fri, 10 Nov 2017 18:57:19 +0100
> Marc Santhoff  wrote:
> 
> >[...]
> > > You can either use fpc and switch the target OS and /or processor.  
> > 
> > That solution isnt't doable, that would require a compiler for X86_64
> > and ARM.
> 
> fpc -Parm calls ppcarm, fpc -Px86_64 calls ppcx64.

Besides the language - fpc and lazarus are so cool tools!

Thank you,
Marc

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] installing cross fpc in parallel to systems fpc

2017-11-10 Thread Sven Barth via fpc-pascal
Am 10.11.2017 18:59 schrieb "Marc Santhoff" :

On Fr, 2017-11-10 at 18:22 +0100, Karoly Balogh (Charlie/SGR) wrote:
> Hi,
>
> On Fri, 10 Nov 2017, Marc Santhoff wrote:
>
> > What is that, is ppc used for bootstrapping the cross compiler
> > regardless of any other fpc maybe installed?
>
> Yes. First that ppc gets built with the "other FPC" installed. Or you can
> specify a startup compiler explicitly with FPC= argument to the make. It
> doesn't even need the rtl or anything, just the "ppcXXX" native compiler.
>
> During the first round it builds this new native compiler + rtl which will
> be used to bootstrap the actual crosscompiler then.

Ok. So I have a newer compiler for the base system built on the fly,
nice.


Not really, because only the compiler and RTL are rebuild for the native
system when cross building FPC, all the packages are still missing. So you
nevertheless need to do a complete build for your host life you had done
for your cross compilation target.

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] installing cross fpc in parallel to systems fpc

2017-11-10 Thread Mattias Gaertner
On Fri, 10 Nov 2017 18:57:19 +0100
Marc Santhoff  wrote:

>[...]
> > You can either use fpc and switch the target OS and /or processor.  
> 
> That solution isnt't doable, that would require a compiler for X86_64
> and ARM.

fpc -Parm calls ppcarm, fpc -Px86_64 calls ppcx64.

Mattias
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] installing cross fpc in parallel to systems fpc

2017-11-10 Thread Marc Santhoff
On Fr, 2017-11-10 at 18:22 +0100, Karoly Balogh (Charlie/SGR) wrote:
> Hi,
> 
> On Fri, 10 Nov 2017, Marc Santhoff wrote:
> 
> > What is that, is ppc used for bootstrapping the cross compiler
> > regardless of any other fpc maybe installed?
> 
> Yes. First that ppc gets built with the "other FPC" installed. Or you can
> specify a startup compiler explicitly with FPC= argument to the make. It
> doesn't even need the rtl or anything, just the "ppcXXX" native compiler.
> 
> During the first round it builds this new native compiler + rtl which will
> be used to bootstrap the actual crosscompiler then.

Ok. So I have a newer compiler for the base system built on the fly,
nice.

Thanks,
Marc

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] installing cross fpc in parallel to systems fpc

2017-11-10 Thread Marc Santhoff
On Fr, 2017-11-10 at 18:25 +0100, Mattias Gaertner wrote:
> On Fri, 10 Nov 2017 17:47:11 +0100
> Marc Santhoff  wrote:
> 
> > Hi again,
> > 
> > (too many sub threads, answering here - thanks to all helpers!)
> > 
> > OK, "$FPC -va | grep CPU" does the trick. If using the ppcrossarm:
> > 
> > marc@puma:/home/marc/program/fpc-cross/src/fpc/compiler > ./ppcrossarm 
> > -va|grep CPU
> > [0.004] Macro defined: CPUARMEL
> > [0.004] Macro defined: FPC_CPUCROSSCOMPILING
> > [0.004] Macro defined: CPUARM
> > [0.004] Macro defined: CPU32
> > [0.004] Macro defined: CPUINT32
> > [0.020] interpreting file option "#IFNDEF CPUI386"
> > [0.020] interpreting file option "#IFNDEF CPUAMD64"
> > 
> > See, an arm compiler. But when using the ppc binary in the same dir it
> > looks different. Here we go:
> > 
> > marc@puma:/home/marc/program/fpc-cross/src/fpc/compiler > ./ppc -va | grep 
> > CPU
> 
> What is ppc?
> Where is fpc?

That happens in the directory of a built but not yet installed cross
compiler. The build command following those instructions:

http://j-software.dk/stm32f103.php

was:

gmake clean buildbase installbase CROSSINSTALL=1 CROSSOPT="-XParm-elf-"
OS_TARGET=embedded CPU_TARGET=arm SUBARCH=armv7m PREFIX=../../fpc-arm

IIRC. But actually the path from the PREFIX does not exist. Sth. to
investigate or redo for me.

> 
> > Next question is how to get started with lazarus and multiple compilers.
> > How do you do it, using configuration files for lazarus and starting
> > like "lazarus --primary-config-path= "? Or are there other
> > possibilities to try?
> 
> Lazarus supports multiple compilers.
> You can either use fpc and switch the target OS and /or processor.

That solution isnt't doable, that would require a compiler for X86_64
and ARM.

> Or you can switch the compiler binary: Project / Project Options /
> Compiler Options / Compiler Command. Replace the default
> value '$(CompPath)' with the path.

Aha, OK.

> You can use build modes to switch with a mouse click between various
> sets of compiler options.

Beautiful, may take a while to get there, but very handy. :)

Marc

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] installing cross fpc in parallel to systems fpc

2017-11-10 Thread Mattias Gaertner
On Fri, 10 Nov 2017 17:47:11 +0100
Marc Santhoff  wrote:

> Hi again,
> 
> (too many sub threads, answering here - thanks to all helpers!)
> 
> OK, "$FPC -va | grep CPU" does the trick. If using the ppcrossarm:
> 
> marc@puma:/home/marc/program/fpc-cross/src/fpc/compiler > ./ppcrossarm 
> -va|grep CPU
> [0.004] Macro defined: CPUARMEL
> [0.004] Macro defined: FPC_CPUCROSSCOMPILING
> [0.004] Macro defined: CPUARM
> [0.004] Macro defined: CPU32
> [0.004] Macro defined: CPUINT32
> [0.020] interpreting file option "#IFNDEF CPUI386"
> [0.020] interpreting file option "#IFNDEF CPUAMD64"
> 
> See, an arm compiler. But when using the ppc binary in the same dir it
> looks different. Here we go:
> 
> marc@puma:/home/marc/program/fpc-cross/src/fpc/compiler > ./ppc -va | grep CPU

What is ppc?
Where is fpc?


> Next question is how to get started with lazarus and multiple compilers.
> How do you do it, using configuration files for lazarus and starting
> like "lazarus --primary-config-path= "? Or are there other
> possibilities to try?

Lazarus supports multiple compilers.
You can either use fpc and switch the target OS and /or processor.
Or you can switch the compiler binary: Project / Project Options /
Compiler Options / Compiler Command. Replace the default
value '$(CompPath)' with the path.

You can use build modes to switch with a mouse click between various
sets of compiler options.

Mattias

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] installing cross fpc in parallel to systems fpc

2017-11-10 Thread Karoly Balogh (Charlie/SGR)
Hi,

On Fri, 10 Nov 2017, Marc Santhoff wrote:

> What is that, is ppc used for bootstrapping the cross compiler
> regardless of any other fpc maybe installed?

Yes. First that ppc gets built with the "other FPC" installed. Or you can
specify a startup compiler explicitly with FPC= argument to the make. It
doesn't even need the rtl or anything, just the "ppcXXX" native compiler.

During the first round it builds this new native compiler + rtl which will
be used to bootstrap the actual crosscompiler then.

Charlie
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] installing cross fpc in parallel to systems fpc

2017-11-10 Thread Marc Santhoff
Hi again,

(too many sub threads, answering here - thanks to all helpers!)

OK, "$FPC -va | grep CPU" does the trick. If using the ppcrossarm:

marc@puma:/home/marc/program/fpc-cross/src/fpc/compiler > ./ppcrossarm -va|grep 
CPU
[0.004] Macro defined: CPUARMEL
[0.004] Macro defined: FPC_CPUCROSSCOMPILING
[0.004] Macro defined: CPUARM
[0.004] Macro defined: CPU32
[0.004] Macro defined: CPUINT32
[0.020] interpreting file option "#IFNDEF CPUI386"
[0.020] interpreting file option "#IFNDEF CPUAMD64"

See, an arm compiler. But when using the ppc binary in the same dir it
looks different. Here we go:

marc@puma:/home/marc/program/fpc-cross/src/fpc/compiler > ./ppc -va | grep CPU
[0.008] Macro defined: CPUX86_64
[0.008] Macro defined: CPUAMD64
[0.008] Macro defined: CPU64
[0.008] Macro defined: CPUX64
[0.008] Macro defined: CPUINT64
[0.023] interpreting file option "#IFNDEF CPUI386"
[0.023] interpreting file option "#IFNDEF CPUAMD64"

What is that, is ppc used for bootstrapping the cross compiler
regardless of any other fpc maybe installed?

Next question is how to get started with lazarus and multiple compilers.
How do you do it, using configuration files for lazarus and starting
like "lazarus --primary-config-path= "? Or are there other
possibilities to try?


Marc

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] installing cross fpc in parallel to systems fpc

2017-11-10 Thread Marco van de Voort
In our previous episode, Marc Santhoff said:
> > #ENDIF
> 
> I see, so when using fpc for ARM these define is automatically set?
> And would that be CPUAVR for Atmels chips?

(easiest is to just fpc -va some dummy source and then grep for CPU, or look
in the compiler sources (options.pas or systems/ iirc)

You can select a different cpu then the default using fpc -P

So if you have a x86 compiled fpc.exe, you can get it to select ppcx64 using
fpc -Px86_64 and then e.g. -Twin64 for the target.  Then all the relevant
directives (CPU64, cpux86_64, win64, mswindows etc) are defined.

(I use windows now because I know those defines by heart, for arm it is the
same).

The buildfaq (document section on the FPC site), though somewhat outdated,
has some info and examples on this.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] installing cross fpc in parallel to systems fpc

2017-11-09 Thread leledumbo via fpc-pascal
> When I'm in doubt 
about the conditional defines, I either google or take advantage of 
Lazarus: in project->options I select the target CPU family and the 
target processor, and then I use "show all options" to see which defines 
are set. 

fpc -vc is your friend here.



--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] installing cross fpc in parallel to systems fpc

2017-11-09 Thread Giuliano Colla

Il 09/11/2017 22:56, Marc Santhoff ha scritto:


I see, so when using fpc for ARM these define is automatically set?

Yes

And would that be CPUAVR for Atmels chips?
Not sure about that. I never used fpc on Atmel chips. When I'm in doubt 
about the conditional defines, I either google or take advantage of 
Lazarus: in project->options I select the target CPU family and the 
target processor, and then I use "show all options" to see which defines 
are set.


Giuliano

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] installing cross fpc in parallel to systems fpc

2017-11-09 Thread Marc Santhoff
On Do, 2017-11-09 at 21:31 +0100, Giuliano Colla wrote:
> Il 09/11/2017 02:36, Marc Santhoff ha scritto:
> 
> > how does fpc and it's makefiles handle the case of installing a cross
> > compiler on a system having fpc installed?
> >
> > The target path will differ and I can set that, but how is the config
> > file .fpc.cfg handled?
> 
> You may edit your fpc.cfg for your different target using an IFDEF/ENDIF 
> pair.
> 
> Under Linux I have in my home directory a .fpc.cfg sort of:
> 
> #include /etc/fpc.cfg  <--- to get all the defaults
> #IFDEF CPUARM
>  here all the ARM specific paths and options
> #ENDIF

I see, so when using fpc for ARM these define is automatically set?
And would that be CPUAVR for Atmels chips?

> That's the basic idea. All that's between #IFDEF -- #ENDIF is ignored 
> when you're *not* cross-compiling.
> All that's between #IFDEF -- #ENDIF overrides the previous settings when 
> you're cross-compiling

I have thought about this solution, but did not know the details. Next
step will be to generate a default fpc.cfg for the arm cross compiler
and merge that into the .fpc.cfg using ifdefs.

Fine, now I know the way. :)

Thanks,
Marc

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] installing cross fpc in parallel to systems fpc

2017-11-09 Thread Giuliano Colla

Il 09/11/2017 02:36, Marc Santhoff ha scritto:


how does fpc and it's makefiles handle the case of installing a cross
compiler on a system having fpc installed?

The target path will differ and I can set that, but how is the config
file .fpc.cfg handled?


You may edit your fpc.cfg for your different target using an IFDEF/ENDIF 
pair.


Under Linux I have in my home directory a .fpc.cfg sort of:

#include /etc/fpc.cfg  <--- to get all the defaults
#IFDEF CPUARM
 here all the ARM specific paths and options
#ENDIF

That's the basic idea. All that's between #IFDEF -- #ENDIF is ignored 
when you're *not* cross-compiling.
All that's between #IFDEF -- #ENDIF overrides the previous settings when 
you're cross-compiling


Giuliano
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] installing cross fpc in parallel to systems fpc

2017-11-09 Thread Marc Santhoff
On Do, 2017-11-09 at 20:05 +0200, Christo wrote:
> On Thu, 2017-11-09 at 02:36 +0100, Marc Santhoff wrote:
> > Additionally there seems to be no compiler switch for changing the
> > configuration file to use, only -n for ignoring it. Is ist possible
> > to
> > name the .cfg on the command line or how would it be done better?
> 
> Yes, specify alternative config file using the @ option.  Use in
> conjunction with -n if you want to exclude the default config file.

In fact you're right, I ovelooked that option. Now that the name ist
known:

 > ./ppcrossarm -h | grep @
  @   Read compiler options from  in addition to the default fpc.cfg

That solves most problems for now.

Thanks,
Marc

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] installing cross fpc in parallel to systems fpc

2017-11-09 Thread Christo
On Thu, 2017-11-09 at 02:36 +0100, Marc Santhoff wrote:
> Additionally there seems to be no compiler switch for changing the
> configuration file to use, only -n for ignoring it. Is ist possible
> to
> name the .cfg on the command line or how would it be done better?

Yes, specify alternative config file using the @ option.  Use in
conjunction with -n if you want to exclude the default config file.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal