Re: [fpc-pascal] Best start point for adding new FPC target

2020-01-29 Thread Sven Barth via fpc-pascal
Karoly Balogh (Charlie/SGR)  schrieb am Mi., 29.
Jan. 2020, 01:22:

> However, you need to add the new target it to the build system, and the
> compiler, which is quite complicated, as a system ID and various
> properties have to be added to quite a few places (compiler,
> /systems/t_bsd.pas, systems.pas, ppudump, FPMake and FPCMake, then
> regenerate all the Makefiles...) So it's quite an undertaking, not really
> feasible for submitting a simple patch. However, if you want I can assist
> in that part, so you can just iterate on the RTL, by having a working
> compiler already.
>

As a little anecdote: submitting a patch for a new target was exactly how I
have started (and it was a completely new target, so more changes), so I
wouldn't say that this isn't feasible for a patch ;) (
https://bugs.freepascal.org/view.php?id=14886 )

Regards,
Sven

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


Re: [fpc-pascal] Best start point for adding new FPC target

2020-01-28 Thread Karoly Balogh (Charlie/SGR)
Hi,

On Tue, 28 Jan 2020, Florian Kl?mpfl wrote:

> > The primary goal of a startup code is to get pointers to the command
> > line parameters and the environment block. If arm-freebsd uses the stack
> > to pass these pointers (the same way as i386-freebsd), then you need
> > just to convert the i386 startup assembly to the arm assembly.
> > For start you need only the prt0.as file.
>
> I strongly recommend to create pascal startup files for newly added targets.

There was some extra section on BSDs identifying which syscall version the
binary uses, and some other stuff, IIRC. Which makes it difficult to add a
Pascal startup code. But the assembly part can be minimized indeed. Not
sure if that can be added by the internal assembler. Probably it can be
generated by the compiler though?

Also there was some other thing with weak references I don't remember.

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


Re: [fpc-pascal] Best start point for adding new FPC target

2020-01-28 Thread Karoly Balogh (Charlie/SGR)
Hi,

On Tue, 28 Jan 2020, Fabio Luis Girardi via fpc-pascal wrote:

> I was thinking of starting with armhf-netbsd, that can I suppose to be
> the closest to the armhf-freebsd target. I'm right? Someone experienced
> adding new targets for FPC has another suggestion?

Well, you don't need to clone the entire RTL for just porting the thing to
a different CPU architecture, if the OS support is already there, so I
wouldn't follow that advice. And I'd just extend the existing FreeBSD RTL
and for that, I could use the NetBSD one. They're heavily overlap anyway.

However, you need to add the new target it to the build system, and the
compiler, which is quite complicated, as a system ID and various
properties have to be added to quite a few places (compiler,
/systems/t_bsd.pas, systems.pas, ppudump, FPMake and FPCMake, then
regenerate all the Makefiles...) So it's quite an undertaking, not really
feasible for submitting a simple patch. However, if you want I can assist
in that part, so you can just iterate on the RTL, by having a working
compiler already.

BTW the NetBSD/ARMHF port (by me, if I'm correct), was never really
working fully, because I was too lazy to figure out some things, like the
usual "always broken on BSD" differences in the stat structure, and how
some syscalls have changed.

But maybe it's a time to figure out what's up with that. I still have the
required NetBSD setup for that anyway.

Charlie___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Best start point for adding new FPC target

2020-01-28 Thread Florian Klämpfl

Am 28.01.20 um 20:40 schrieb Yuriy Sydorov:

On 28.01.2020 21:14, Fabio Luis Girardi via fpc-pascal wrote:
Em ter., 28 de jan. de 2020 às 16:04, Yuriy Sydorov > escreveu:


    You need to add support of a new CPU to the existing freebsd 
target. The target would be arm-freebsd, since armhf is

    not
    treated as a separate CPU by FPC. You need to create arm startup 
files in the rtl/freebsd/arm folder.



Yes, I know. But to add this new CPU support for the FPC/FreeBSD, it 
is better I start with files of rtl/freebsd/i386 or rtl/freebsd/x86_64 
or use another start point, like rtl/netbsd/arm ?


The primary goal of a startup code is to get pointers to the command 
line parameters and the environment block. If arm-freebsd uses the stack 
to pass these pointers (the same way as i386-freebsd), then you need 
just to convert the i386 startup assembly to the arm assembly.

For start you need only the prt0.as file.



I strongly recommend to create pascal startup files for newly added targets.

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


Re: [fpc-pascal] Best start point for adding new FPC target

2020-01-28 Thread Marco van de Voort


Op 28/01/2020 om 18:08 schreef Fabio Luis Girardi via fpc-pascal:

Hi all!

I'm studying how to add a new target for the Freepascal compiler. The 
target is the missing armhf-FreeBSD. So I have looked at FPC guide 
(https://wiki.freepascal.org/Porting_Free_Pascal#Adding_a_new_target) 
and looking at Overview section, item 2 says:


"Take the closest existing RTL as a start, copy it and start implementing"

I was thinking of starting with armhf-netbsd, that can I suppose to be 
the closest to the armhf-freebsd target. I'm right? Someone 
experienced adding new targets for FPC has another suggestion?



That was written from the perspective of a new OS.

For adding a new architecture to an existing OS, probably the files 
systems/i_bsd.pas and t_bsd.pas are the main files.


A record with settings needs to be added to i_bsd and the calling of 
assembler and linker needs to be checked in t_bsd.


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


Re: [fpc-pascal] Best start point for adding new FPC target

2020-01-28 Thread Fabio Luis Girardi via fpc-pascal
Thanks for the hints!

Em ter., 28 de jan. de 2020 às 16:41, Yuriy Sydorov 
escreveu:

> On 28.01.2020 21:14, Fabio Luis Girardi via fpc-pascal wrote:
> > Em ter., 28 de jan. de 2020 às 16:04, Yuriy Sydorov  > escreveu:
> >
> > You need to add support of a new CPU to the existing freebsd target.
> The target would be arm-freebsd, since armhf is
> > not
> > treated as a separate CPU by FPC. You need to create arm startup
> files in the rtl/freebsd/arm folder.
> >
> >
> > Yes, I know. But to add this new CPU support for the FPC/FreeBSD, it is
> better I start with files of rtl/freebsd/i386 or
> > rtl/freebsd/x86_64 or use another start point, like rtl/netbsd/arm ?
>
> The primary goal of a startup code is to get pointers to the command line
> parameters and the environment block. If
> arm-freebsd uses the stack to pass these pointers (the same way as
> i386-freebsd), then you need just to convert the i386
> startup assembly to the arm assembly.
> For start you need only the prt0.as file.
>
> Yuriy.
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>


-- 
The best regards,

Fabio Luis Girardi
PascalSCADA Project
http://sourceforge.net/projects/pascalscada
http://www.pascalscada.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Best start point for adding new FPC target

2020-01-28 Thread Yuriy Sydorov

On 28.01.2020 21:14, Fabio Luis Girardi via fpc-pascal wrote:

Em ter., 28 de jan. de 2020 às 16:04, Yuriy Sydorov mailto:j...@cp-lab.com>> escreveu:

You need to add support of a new CPU to the existing freebsd target. The 
target would be arm-freebsd, since armhf is
not
treated as a separate CPU by FPC. You need to create arm startup files in 
the rtl/freebsd/arm folder.


Yes, I know. But to add this new CPU support for the FPC/FreeBSD, it is better I start with files of rtl/freebsd/i386 or 
rtl/freebsd/x86_64 or use another start point, like rtl/netbsd/arm ?


The primary goal of a startup code is to get pointers to the command line parameters and the environment block. If 
arm-freebsd uses the stack to pass these pointers (the same way as i386-freebsd), then you need just to convert the i386 
startup assembly to the arm assembly.

For start you need only the prt0.as file.

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


Re: [fpc-pascal] Best start point for adding new FPC target

2020-01-28 Thread Yuriy Sydorov

On 28.01.2020 19:08, Fabio Luis Girardi via fpc-pascal wrote:
I'm studying how to add a new target for the Freepascal compiler. The target is the missing armhf-FreeBSD. So I have 
looked at FPC guide (https://wiki.freepascal.org/Porting_Free_Pascal#Adding_a_new_target) and looking at Overview 
section, item 2 says:


"Take the closest existing RTL as a start, copy it and start implementing"

I was thinking of starting with armhf-netbsd, that can I suppose to be the closest to the armhf-freebsd target. I'm 
right? Someone experienced adding new targets for FPC has another suggestion?


You need to add support of a new CPU to the existing freebsd target. The target would be arm-freebsd, since armhf is not 
treated as a separate CPU by FPC. You need to create arm startup files in the rtl/freebsd/arm folder.


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


Re: [fpc-pascal] Best start point for adding new FPC target

2020-01-28 Thread Fabio Luis Girardi via fpc-pascal
Em ter., 28 de jan. de 2020 às 16:04, Yuriy Sydorov 
escreveu:

> You need to add support of a new CPU to the existing freebsd target. The
> target would be arm-freebsd, since armhf is not
> treated as a separate CPU by FPC. You need to create arm startup files in
> the rtl/freebsd/arm folder.
>

Yes, I know. But to add this new CPU support for the FPC/FreeBSD, it is
better I start with files of rtl/freebsd/i386 or rtl/freebsd/x86_64 or use
another start point, like rtl/netbsd/arm ?

-- 
The best regards,

Fabio Luis Girardi
PascalSCADA Project
http://sourceforge.net/projects/pascalscada
http://www.pascalscada.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Best start point for adding new FPC target

2020-01-28 Thread Fabio Luis Girardi via fpc-pascal
Hi all!

I'm studying how to add a new target for the Freepascal compiler. The
target is the missing armhf-FreeBSD. So I have looked at FPC guide (
https://wiki.freepascal.org/Porting_Free_Pascal#Adding_a_new_target) and
looking at Overview section, item 2 says:

"Take the closest existing RTL as a start, copy it and start implementing"

I was thinking of starting with armhf-netbsd, that can I suppose to be the
closest to the armhf-freebsd target. I'm right? Someone experienced adding
new targets for FPC has another suggestion?

-- 
The best regards,

Fabio Luis Girardi
PascalSCADA Project
http://sourceforge.net/projects/pascalscada
http://www.pascalscada.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal