[fpc-pascal] How to build for arm6 in RaspberryPi on arm7?

Tomas Hajny XHajT03 at hajny.biz
Wed Sep 9 17:34:14 CEST 2020


On 2020-09-09 14:43, Bo Berglund via fpc-pascal wrote:
> On Wed, 09 Sep 2020 00:03:29 +0200, Bo Berglund via fpc-pascal
> <fpc-pascal at lists.freepascal.org> wrote:
> 
>> No, it is on an RPi4 so it is ArmV7.
> In fact I have been told on the RPi forum RPi4 is Armv8
> Armv6: Pi0, PiB, PiA+
> Armv7: Pi2Bv1.1
> Armv8: Pi2Bv1.2, Pi3, Pi4
> 
> But they could not advice how to use a newer RPi (higher numbered arm)
> to build an application that could run on earlier arm versions such as
> on the RPiZero.
> They referred back here.
> 
> 
> Anyway I used the Fpc/Lazarus installation I had done on the PiZero
> and opened the test project as checked out from svn.
> It could be built on the RPiZero and when I ran it (started from a
> terminal rather than from Lazarus) it worked as it should.
> 
> So:
> If I install Fpc and Lazarus from sources as I always do and specify
> ArmV6 in the process on the RPiZero, then it will make an application
> that works fine there.
> 
> And when I transfer it to the RPi4 (using scp) it works fine also
> there...
> 
> Question:
> Can I make a parallel installation of FPC and Lazarus on my RPi4 which
> is using the Armv6 settings during the make and thus get a system that
> will produce compatible programs?
> 
> Or do I have to scrap the existing installation altogether and then
> reinstall using Armv6 setrtings?

You don't need a different installation (although that might be an 
option as well), but you do need a different build of the RTL and 
packages. The concept of sub-architectures is supposed to help with 
this, but I don't know how far is the support in fp(c)make and the 
compiler. It may be done manually without any special support e.g. by 
renaming the directory with original RTL and packages, building the RTL 
and packages again with the required parameters and possibly renaming 
that one as well. Once you're finished with that, you may want to either 
modify your fp.cfg so that the paths to units, etc., are IFDEFed there, 
or you may remove all (sub)architecture dependent settings from the 
default configuration file, place these settings to two other 
configuration files containing settings for particular 
(sub)architectures and always specify the '@' option with the right 
configuration file when invoking the compiler.

Tomas


More information about the fpc-pascal mailing list