Difference between revisions of "Building for Debian"

From Ultibo.org
Jump to: navigation, search
 
(6 intermediate revisions by the same user not shown)
Line 13: Line 13:
 
The instructions below detail the process of building the modified Free Pascal compiler, the Free Pascal ARM cross compiler and the Ultibo RTL in order to create a working configuration that allows developing Ultibo applications.
 
The instructions below detail the process of building the modified Free Pascal compiler, the Free Pascal ARM cross compiler and the Ultibo RTL in order to create a working configuration that allows developing Ultibo applications.
  
This process was tested and developed using Debian Wheezy 7.6 for i386 with Linux kernel version 3.2.0 however the requirements for FreePascal are relatively simple so these instructions should work without much change on later versions of Debian (eg Jessie) and should also be able to be translated easily to many other distributions.
+
This process was last tested using Raspberry Pi Desktop for i386 from January 11th 2021 which is based on Debian 10 (Buster) with Linux kernel version 4.19 however the requirements for FreePascal are relatively simple so these instructions should work without much change on later versions of Debian and should also be able to be translated easily to many other distributions.
  
 
In order to avoid any conflict with official FPC releases these instructions install all components into a folder within your home directory, if you follow these instructions the Ultibo version of Free Pascal as well as the RTL and sources will be located in the <code>$HOME/ultibo/core</code> folder so if your username is <code>linus</code> then the installation will be at <code>/home/linus/ultibo/core</code>.
 
In order to avoid any conflict with official FPC releases these instructions install all components into a folder within your home directory, if you follow these instructions the Ultibo version of Free Pascal as well as the RTL and sources will be located in the <code>$HOME/ultibo/core</code> folder so if your username is <code>linus</code> then the installation will be at <code>/home/linus/ultibo/core</code>.
  
Compiling the Ultibo edition of Free Pascal requires using the official 3.0.0 release version as the starting point, these instructions will NOT work if you start with version 2.6.4 or any other version. Fortunately the FPC team provide a precompiled download of FPC 3.0.0 which can be obtained from the [http://www.freepascal.org/download.var download] page and installed using the provided instructions.
+
Compiling the Ultibo edition of Free Pascal requires using the official 3.2.2 release version as the starting point, these instructions will NOT work if you start with version 3.0.2 or any other version. Fortunately the FPC team provide a precompiled download of FPC 3.2.2 which can be obtained from the [http://www.freepascal.org/download.var download] page and installed using the provided instructions.
 
+
If you prefer not to install the official 3.0.0 release (you may have other projects that depend on an earlier version for example) then you can get a fully working installation of Free Pascal 3.0.0 by following the instructions at [http://www.getlazarus.org/setup/?download#linux GetLazarus.org] which will by default install a working copy in the folder <code>$HOME/Development/FreePascal</code> that can be deleted later if you choose.
+
  
 
=== Building Free Pascal (Ultibo Edition) ===
 
=== Building Free Pascal (Ultibo Edition) ===
 
----
 
----
  
Assuming you have a working FPC 3.0.0 installation as discussed above, you can now proceed with the first stage of the process which is to build a Debian native version of the Ultibo edition of FPC.
+
Assuming you have a working FPC 3.2.2 installation as discussed above, you can now proceed with the first stage of the process which is to build a Debian native version of the Ultibo edition of FPC.
  
These instructions assume that FPC 3.0.0 from the official download was installed to:
+
These instructions assume that FPC 3.2.2 from the official download was installed to:
  
 
  /usr/local/bin/fpc
 
  /usr/local/bin/fpc
  
If you are using the GetLazarus.org version instead then you will need to temporarily add it to the path so it is used in preference to any official version, by default you can do something like this to add the appropriate folder to the path temporarily:
+
If you are using another version or installed it to your home folder instead then you may need to temporarily add it to the path so it is used in preference to any official version, by default you can do something like this to add the appropriate folder to the path temporarily:
  
  export PATH=$HOME/Development/FreePascal/fpc/bin:$PATH
+
  export PATH=$HOME/fpc-3.2.2/bin:$PATH
  
  
You should now download the sources of the FreePascal Ultibo edition from [https://github.com/ultibohub/https://github.com/ultibohub/FreePascal GitHub] and unzip the contents to the folder:
+
You should now download the sources of the FreePascal Ultibo edition from [https://github.com/ultibohub/FreePascal/tree/ultibo-3.2.2 GitHub] and unzip the contents to the folder:
  
  $HOME/ultibo/core
+
  $HOME/ultibo/core/fpc
  
After extracting the files rename the folder <code>FreePascal-ultibo</code> to <code>fpc</code> so the contents of the zip will be in <code>$HOME/ultibo/core/fpc</code>
+
After extracting the files rename the folder <code>FreePascal-ultibo-3.2.2</code> to <code>source</code> so the contents of the zip will be in <code>$HOME/ultibo/core/fpc/source</code>
  
  
Line 52: Line 50:
 
And finally extract the <code>units</code> folder to the location:
 
And finally extract the <code>units</code> folder to the location:
  
  $HOME/ultibo/core/fpc
+
  $HOME/ultibo/core/fpc/lib/fpc/3.2.2
  
  
Line 71: Line 69:
 
  cp $HOME/ultibo/core/fpc/source/compiler/ppc386 $HOME/ultibo/core/fpc/bin/ppc386
 
  cp $HOME/ultibo/core/fpc/source/compiler/ppc386 $HOME/ultibo/core/fpc/bin/ppc386
  
Run the following to check that it shows as version 3.3.1 and lists <code>ultibo</code> under the supported targets.
+
Run the following to check that it shows as version 3.2.2 and lists <code>ultibo</code> under the supported targets.
  
 
  $HOME/ultibo/core/fpc/bin/fpc -i  
 
  $HOME/ultibo/core/fpc/bin/fpc -i  
Line 77: Line 75:
 
Use fpcmkcfg to create our default configuration file like this:
 
Use fpcmkcfg to create our default configuration file like this:
  
  $HOME/ultibo/core/fpc/bin/fpcmkcfg -d basepath=$HOME/ultibo/core/fpc/lib/fpc/3.3.1 -o $HOME/ultibo/core/fpc/bin/fpc.cfg
+
  $HOME/ultibo/core/fpc/bin/fpcmkcfg -d basepath=$HOME/ultibo/core/fpc/lib/fpc/3.2.2 -o $HOME/ultibo/core/fpc/bin/fpc.cfg
  
 
=== Installing the arm-none-eabi Toolchain ===
 
=== Installing the arm-none-eabi Toolchain ===
 
----
 
----
  
A toolchain that provides various utilities for the ARM embedded development is needed so that applications can be cross compiled from i386 to ARM. There are many different options available but for the purpose of Ultibo we need a toolchain that is built for arm-none-eabi and the one shown below is known to work correctly.
+
A toolchain that provides various utilities for the ARM embedded development is needed so that applications can be cross compiled from i386 to ARM. There are many different options available but for the purpose of Ultibo we need a toolchain that is built for arm-none-eabi, under Debian a suitable toolchain is available as a package which can be installed like this:
 
+
Download the file <code>gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2</code> from [https://launchpad.net/gcc-arm-embedded/+download launchpad.net] and save it to a temporary location.
+
 
+
Extract the contents of the file to the folder <code>$HOME/gcc-arm-none-eabi-5_4-2016q3</code> and then run the following commands from a terminal window:
+
  
  cp $HOME/gcc-arm-none-eabi-5_4-2016q3/arm-none-eabi/bin/as $HOME/ultibo/core/fpc/bin/arm-ultibo-as
+
  sudo apt-get install -y binutils-arm-none-eabi
cp $HOME/gcc-arm-none-eabi-5_4-2016q3/arm-none-eabi/bin/ld $HOME/ultibo/core/fpc/bin/arm-ultibo-ld
+
cp $HOME/gcc-arm-none-eabi-5_4-2016q3/arm-none-eabi/bin/objcopy $HOME/ultibo/core/fpc/bin/arm-ultibo-objcopy
+
cp $HOME/gcc-arm-none-eabi-5_4-2016q3/arm-none-eabi/bin/objdump $HOME/ultibo/core/fpc/bin/arm-ultibo-objdump
+
cp $HOME/gcc-arm-none-eabi-5_4-2016q3/arm-none-eabi/bin/strip $HOME/ultibo/core/fpc/bin/arm-ultibo-strip
+
  
If you like you can now delete the extracted folder because none of the other files it contains are needed for Ultibo.
+
Once completed we can move on to building the Ultibo RTL.
  
 
=== Building the FPC ARM Cross Compiler ===
 
=== Building the FPC ARM Cross Compiler ===
Line 105: Line 95:
 
  cd $HOME/ultibo/core/fpc/source
 
  cd $HOME/ultibo/core/fpc/source
  
Export the path to our FPC 3.3.1 Ultibo edition:
+
Export the path to our FPC 3.2.2 Ultibo edition:
  
 
  export PATH=$HOME/ultibo/core/fpc/bin:$PATH
 
  export PATH=$HOME/ultibo/core/fpc/bin:$PATH
Line 111: Line 101:
 
Build the ARM cross compiler using these commands, make sure you check that each step was successful before continuing:
 
Build the ARM cross compiler using these commands, make sure you check that each step was successful before continuing:
  
  make distclean OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a BINUTILSPREFIX=arm-ultibo- FPCOPT="-dFPC_ARMHF" CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/ppc386
+
  make distclean OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a BINUTILSPREFIX=arm-none-eabi- FPCOPT="-dFPC_ARMHF" CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/ppc386
  
  make all OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a BINUTILSPREFIX=arm-ultibo- FPCOPT="-dFPC_ARMHF" CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/ppc386
+
  make all OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a BINUTILSPREFIX=arm-none-eabi- FPCOPT="-dFPC_ARMHF" CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/ppc386
  
  make crossinstall BINUTILSPREFIX=arm-ultibo- FPCOPT="-dFPC_ARMHF" CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH" OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a FPC=$HOME/ultibo/core/fpc/bin/ppc386 INSTALL_PREFIX=$HOME/ultibo/core/fpc
+
  make crossinstall BINUTILSPREFIX=arm-none-eabi- FPCOPT="-dFPC_ARMHF" CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH" OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a FPC=$HOME/ultibo/core/fpc/bin/ppc386 INSTALL_PREFIX=$HOME/ultibo/core/fpc
  
 
Now copy our cross compiler to the <code>bin</code> directory as follows so we can find it later:
 
Now copy our cross compiler to the <code>bin</code> directory as follows so we can find it later:
Line 133: Line 123:
 
  cd $HOME/ultibo/core/fpc/source
 
  cd $HOME/ultibo/core/fpc/source
  
Export the path to our FPC 3.3.1 Ultibo edition:
+
Export the path to our FPC 3.2.2 Ultibo edition:
  
 
  export PATH=$HOME/ultibo/core/fpc/bin:$PATH
 
  export PATH=$HOME/ultibo/core/fpc/bin:$PATH
Line 139: Line 129:
 
Build the ARMv7 RTL as follows, checking that each step was successful before continuing:
 
Build the ARMv7 RTL as follows, checking that each step was successful before continuing:
  
  make rtl_clean CROSSINSTALL=1 OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/fpc
+
  make rtl_clean CROSSINSTALL=1 OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a BINUTILSPREFIX=arm-none-eabi- FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/fpc
  
  make rtl OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/fpc
+
  make rtl OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a BINUTILSPREFIX=arm-none-eabi- FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/fpc
  
  make rtl_install CROSSINSTALL=1 FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH" OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a FPC=$HOME/ultibo/core/fpc/bin/fpc INSTALL_PREFIX=$HOME/ultibo/core/fpc INSTALL_UNITDIR=$HOME/ultibo/core/fpc/lib/fpc/3.3.1/units/armv7-ultibo/rtl
+
  make rtl_install CROSSINSTALL=1 BINUTILSPREFIX=arm-none-eabi- FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH" OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a FPC=$HOME/ultibo/core/fpc/bin/fpc INSTALL_PREFIX=$HOME/ultibo/core/fpc INSTALL_UNITDIR=$HOME/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/rtl
  
  
Line 156: Line 146:
 
Build the ARMv7 Packages using the following commands:
 
Build the ARMv7 Packages using the following commands:
  
  make rtl_clean CROSSINSTALL=1 OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/fpc
+
  make rtl_clean CROSSINSTALL=1 OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a BINUTILSPREFIX=arm-none-eabi- FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/fpc
  
  make packages_clean CROSSINSTALL=1 OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/fpc
+
  make packages_clean CROSSINSTALL=1 OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a BINUTILSPREFIX=arm-none-eabi- FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/fpc
  
  make packages OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH -Fu$HOME/ultibo/core/fpc/lib/fpc/3.3.1/units/armv7-ultibo/rtl" FPC=$HOME/ultibo/core/fpc/bin/fpc
+
  make packages OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a BINUTILSPREFIX=arm-none-eabi- FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH -Fu$HOME/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/rtl" FPC=$HOME/ultibo/core/fpc/bin/fpc
  
  make packages_install CROSSINSTALL=1 FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH" OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a FPC=$HOME/ultibo/core/fpc/bin/fpc INSTALL_PREFIX=$HOME/ultibo/core/fpc INSTALL_UNITDIR=$HOME/ultibo/core/fpc/lib/fpc/3.3.1/units/armv7-ultibo/packages
+
  make packages_install CROSSINSTALL=1 BINUTILSPREFIX=arm-none-eabi- FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH" OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a FPC=$HOME/ultibo/core/fpc/bin/fpc INSTALL_PREFIX=$HOME/ultibo/core/fpc INSTALL_UNITDIR=$HOME/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/packages
  
  
Line 173: Line 163:
 
  cd $HOME/ultibo/core/fpc/source
 
  cd $HOME/ultibo/core/fpc/source
  
Export the path to our FPC 3.3.1 Ultibo edition:
+
Export the path to our FPC 3.2.2 Ultibo edition:
  
 
  export PATH=$HOME/ultibo/core/fpc/bin:$PATH
 
  export PATH=$HOME/ultibo/core/fpc/bin:$PATH
Line 179: Line 169:
 
Build the ARMv6 RTL as follows, checking that each step was successful before continuing:
 
Build the ARMv6 RTL as follows, checking that each step was successful before continuing:
  
  make rtl_clean CROSSINSTALL=1 OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv6 FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV6 -CfVFPV2 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/fpc
+
  make rtl_clean CROSSINSTALL=1 OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv6 BINUTILSPREFIX=arm-none-eabi- FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV6 -CfVFPV2 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/fpc
  
  make rtl OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv6 FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV6 -CfVFPV2 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/fpc
+
  make rtl OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv6 BINUTILSPREFIX=arm-none-eabi- FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV6 -CfVFPV2 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/fpc
  
  make rtl_install CROSSINSTALL=1 FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV6 -CfVFPV2 -CIARM -CaEABIHF -OoFASTMATH" OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv6 FPC=$HOME/ultibo/core/fpc/bin/fpc INSTALL_PREFIX=$HOME/ultibo/core/fpc INSTALL_UNITDIR=$HOME/ultibo/core/fpc/lib/fpc/3.3.1/units/armv6-ultibo/rtl
+
  make rtl_install CROSSINSTALL=1 BINUTILSPREFIX=arm-none-eabi- FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV6 -CfVFPV2 -CIARM -CaEABIHF -OoFASTMATH" OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv6 FPC=$HOME/ultibo/core/fpc/bin/fpc INSTALL_PREFIX=$HOME/ultibo/core/fpc INSTALL_UNITDIR=$HOME/ultibo/core/fpc/lib/fpc/3.2.2/units/armv6-ultibo/rtl
  
  
Line 196: Line 186:
 
Build the ARMv6 Packages as follows:
 
Build the ARMv6 Packages as follows:
  
  make rtl_clean CROSSINSTALL=1 OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv6 FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV6 -CfVFPV2 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/fpc
+
  make rtl_clean CROSSINSTALL=1 OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv6 BINUTILSPREFIX=arm-none-eabi- FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV6 -CfVFPV2 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/fpc
  
  make packages_clean CROSSINSTALL=1 OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv6 FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV6 -CfVFPV2 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/fpc
+
  make packages_clean CROSSINSTALL=1 OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv6 BINUTILSPREFIX=arm-none-eabi- FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV6 -CfVFPV2 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/fpc
  
  make packages OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv6 FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV6 -CfVFPV2 -CIARM -CaEABIHF -OoFASTMATH -Fu$HOME/ultibo/core/fpc/lib/fpc/3.3.1/units/armv6-ultibo/rtl" FPC=$HOME/ultibo/core/fpc/bin/fpc
+
  make packages OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv6 BINUTILSPREFIX=arm-none-eabi- FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV6 -CfVFPV2 -CIARM -CaEABIHF -OoFASTMATH -Fu$HOME/ultibo/core/fpc/lib/fpc/3.2.2/units/armv6-ultibo/rtl" FPC=$HOME/ultibo/core/fpc/bin/fpc
  
  make packages_install CROSSINSTALL=1 FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV6 -CfVFPV2 -CIARM -CaEABIHF -OoFASTMATH" OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv6 FPC=$HOME/ultibo/core/fpc/bin/fpc INSTALL_PREFIX=$HOME/ultibo/core/fpc INSTALL_UNITDIR=$HOME/ultibo/core/fpc/lib/fpc/3.3.1/units/armv6-ultibo/packages
+
  make packages_install CROSSINSTALL=1 BINUTILSPREFIX=arm-none-eabi- FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV6 -CfVFPV2 -CIARM -CaEABIHF -OoFASTMATH" OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv6 FPC=$HOME/ultibo/core/fpc/bin/fpc INSTALL_PREFIX=$HOME/ultibo/core/fpc INSTALL_UNITDIR=$HOME/ultibo/core/fpc/lib/fpc/3.2.2/units/armv6-ultibo/packages
  
 
=== Creating the Configuration files ===
 
=== Creating the Configuration files ===
Line 228: Line 218:
 
  -dRPI
 
  -dRPI
 
  -dBCM2708
 
  -dBCM2708
  -Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.3.1/units/armv6-ultibo/rtl
+
-XParm-none-eabi-
  -Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.3.1/units/armv6-ultibo/packages
+
  -Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv6-ultibo/rtl
  -Fl/home/<user>/ultibo/core/fpc/lib/fpc/3.3.1/units/armv6-ultibo/lib
+
  -Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv6-ultibo/packages
  -Fl/home/<user>/ultibo/core/fpc/lib/fpc/3.3.1/units/armv6-ultibo/lib/vc4
+
  -Fl/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv6-ultibo/lib
 +
  -Fl/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv6-ultibo/lib/vc4
  
  
Line 247: Line 238:
 
  -dRPI2
 
  -dRPI2
 
  -dBCM2709
 
  -dBCM2709
  -Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.3.1/units/armv7-ultibo/rtl
+
-XParm-none-eabi-
  -Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.3.1/units/armv7-ultibo/packages
+
  -Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/rtl
  -Fl/home/<user>/ultibo/core/fpc/lib/fpc/3.3.1/units/armv7-ultibo/lib
+
  -Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/packages
  -Fl/home/<user>/ultibo/core/fpc/lib/fpc/3.3.1/units/armv7-ultibo/lib/vc4
+
  -Fl/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/lib
 +
  -Fl/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/lib/vc4
  
  
Line 264: Line 256:
 
  -dRPI3
 
  -dRPI3
 
  -dBCM2710
 
  -dBCM2710
  -Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.3.1/units/armv7-ultibo/rtl
+
-XParm-none-eabi-
  -Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.3.1/units/armv7-ultibo/packages
+
  -Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/rtl
  -Fl/home/<user>/ultibo/core/fpc/lib/fpc/3.3.1/units/armv7-ultibo/lib
+
  -Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/packages
  -Fl/home/<user>/ultibo/core/fpc/lib/fpc/3.3.1/units/armv7-ultibo/lib/vc4
+
  -Fl/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/lib
 +
  -Fl/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/lib/vc4
  
  
Line 281: Line 274:
 
  -dRPI4
 
  -dRPI4
 
  -dBCM2711
 
  -dBCM2711
  -Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.3.1/units/armv7-ultibo/rtl
+
-XParm-none-eabi-
  -Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.3.1/units/armv7-ultibo/packages
+
  -Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/rtl
  -Fl/home/<user>/ultibo/core/fpc/lib/fpc/3.3.1/units/armv7-ultibo/lib
+
  -Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/packages
  -Fl/home/<user>/ultibo/core/fpc/lib/fpc/3.3.1/units/armv7-ultibo/lib/vc4
+
  -Fl/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/lib
 +
  -Fl/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/lib/vc4
  
  
Line 297: Line 291:
 
  -OoFASTMATH
 
  -OoFASTMATH
 
  -dQEMUVPB
 
  -dQEMUVPB
  -Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.3.1/units/armv7-ultibo/rtl
+
-XParm-none-eabi-
  -Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.3.1/units/armv7-ultibo/packages
+
  -Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/rtl
  -Fl/home/<user>/ultibo/core/fpc/lib/fpc/3.3.1/units/armv7-ultibo/lib
+
  -Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/packages
 +
  -Fl/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/lib
  
 
=== Compiling an Application ===
 
=== Compiling an Application ===
 
----
 
----
  
Compiling an application from the command line is quite simple, you just need to remember some extra parameters because of the different environment. To compile something like the Hello World example open a terminal window, change to the folder where the application is located and add the path to FPC 3.3.1 Ultibo edition like this:
+
Compiling an application from the command line is quite simple, you just need to remember some extra parameters because of the different environment. To compile something like the Hello World example open a terminal window, change to the folder where the application is located and add the path to FPC 3.2.2 Ultibo edition like this:
  
 
  export PATH=$HOME/ultibo/core/fpc/bin:$PATH
 
  export PATH=$HOME/ultibo/core/fpc/bin:$PATH

Latest revision as of 07:42, 23 May 2022

Introduction


Note: All of the steps described below and more including building the Lazarus IDE and Ultibo tools are now handled automatically by the installer script for Linux, simply download the script from the Ultibo downloads page and follow the instructions. The installer script has been tested with many Linux distributions and platforms including the latest Ubuntu, Raspbian and Debian for x86, x86_64, arm and aarch64

Ultibo core is currently made available as a Windows installer download as well as various Windows tools, however there is nothing specific about the source code or modifications to Free Pascal that are dependent on Windows and some may choose to use it on other platforms such as Linux or Mac. While we are currently unable to provide prepackaged installations for Linux in the form of DEB or RPM files we have created a set of instructions for building the necessary items from source in order to provide similar functionality to the Windows platform.

Please note that because these instructions require you to build all of the components from source and possibly install additional packages onto your Linux installation you should be familiar with using the command line and confident with the tools available. These instructions are fully tested and proven to work, however we cannot provide support for individual cases if you experience issues in completing the steps below.

Prerequisites


The instructions below detail the process of building the modified Free Pascal compiler, the Free Pascal ARM cross compiler and the Ultibo RTL in order to create a working configuration that allows developing Ultibo applications.

This process was last tested using Raspberry Pi Desktop for i386 from January 11th 2021 which is based on Debian 10 (Buster) with Linux kernel version 4.19 however the requirements for FreePascal are relatively simple so these instructions should work without much change on later versions of Debian and should also be able to be translated easily to many other distributions.

In order to avoid any conflict with official FPC releases these instructions install all components into a folder within your home directory, if you follow these instructions the Ultibo version of Free Pascal as well as the RTL and sources will be located in the $HOME/ultibo/core folder so if your username is linus then the installation will be at /home/linus/ultibo/core.

Compiling the Ultibo edition of Free Pascal requires using the official 3.2.2 release version as the starting point, these instructions will NOT work if you start with version 3.0.2 or any other version. Fortunately the FPC team provide a precompiled download of FPC 3.2.2 which can be obtained from the download page and installed using the provided instructions.

Building Free Pascal (Ultibo Edition)


Assuming you have a working FPC 3.2.2 installation as discussed above, you can now proceed with the first stage of the process which is to build a Debian native version of the Ultibo edition of FPC.

These instructions assume that FPC 3.2.2 from the official download was installed to:

/usr/local/bin/fpc

If you are using another version or installed it to your home folder instead then you may need to temporarily add it to the path so it is used in preference to any official version, by default you can do something like this to add the appropriate folder to the path temporarily:

export PATH=$HOME/fpc-3.2.2/bin:$PATH


You should now download the sources of the FreePascal Ultibo edition from GitHub and unzip the contents to the folder:

$HOME/ultibo/core/fpc

After extracting the files rename the folder FreePascal-ultibo-3.2.2 to source so the contents of the zip will be in $HOME/ultibo/core/fpc/source


Now download the source of Ultibo core from GitHub and extract the ultibo folder to the location:

$HOME/ultibo/core/fpc/source/rtl

And extract the ultibounits folder to the location:

$HOME/ultibo/core/fpc/source/packages

And finally extract the units folder to the location:

$HOME/ultibo/core/fpc/lib/fpc/3.2.2


Once this is done, open a terminal window and change to the folder containing the Ultibo sources:

cd $HOME/ultibo/core/fpc/source

Do the following steps in order, checking that each was completed successfully before continuing:

make distclean
make all OS_TARGET=linux CPU_TARGET=i386
make install OS_TARGET=linux CPU_TARGET=i386 INSTALL_PREFIX=$HOME/ultibo/core/fpc

Once those steps have completed you should now have a Debian native version of the FPC Ultibo edition. Copy it to the bin directory as follows so we can find it later:

cp $HOME/ultibo/core/fpc/source/compiler/ppc386 $HOME/ultibo/core/fpc/bin/ppc386

Run the following to check that it shows as version 3.2.2 and lists ultibo under the supported targets.

$HOME/ultibo/core/fpc/bin/fpc -i 

Use fpcmkcfg to create our default configuration file like this:

$HOME/ultibo/core/fpc/bin/fpcmkcfg -d basepath=$HOME/ultibo/core/fpc/lib/fpc/3.2.2 -o $HOME/ultibo/core/fpc/bin/fpc.cfg

Installing the arm-none-eabi Toolchain


A toolchain that provides various utilities for the ARM embedded development is needed so that applications can be cross compiled from i386 to ARM. There are many different options available but for the purpose of Ultibo we need a toolchain that is built for arm-none-eabi, under Debian a suitable toolchain is available as a package which can be installed like this:

sudo apt-get install -y binutils-arm-none-eabi

Once completed we can move on to building the Ultibo RTL.

Building the FPC ARM Cross Compiler


Now we need to build a cross compiler that runs under Linux on i386 but outputs code for Ultibo on ARM, this will be the copy of the compiler that we use to build Ultibo applications but we need to use the native compiler we created above to build this one first.

Open a new terminal window (NOT the one you used above !!) and change to the source folder

cd $HOME/ultibo/core/fpc/source

Export the path to our FPC 3.2.2 Ultibo edition:

export PATH=$HOME/ultibo/core/fpc/bin:$PATH

Build the ARM cross compiler using these commands, make sure you check that each step was successful before continuing:

make distclean OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a BINUTILSPREFIX=arm-none-eabi- FPCOPT="-dFPC_ARMHF" CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/ppc386
make all OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a BINUTILSPREFIX=arm-none-eabi- FPCOPT="-dFPC_ARMHF" CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/ppc386
make crossinstall BINUTILSPREFIX=arm-none-eabi- FPCOPT="-dFPC_ARMHF" CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH" OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a FPC=$HOME/ultibo/core/fpc/bin/ppc386 INSTALL_PREFIX=$HOME/ultibo/core/fpc

Now copy our cross compiler to the bin directory as follows so we can find it later:

cp $HOME/ultibo/core/fpc/source/compiler/ppcrossarm $HOME/ultibo/core/fpc/bin/ppcrossarm

Building the Ultibo RTL


The Ultibo RTL comes in 2 versions, one for ARMv6 which works on the Raspberry Pi A/B/A+/B+/Zero/ZeroW and another for ARMv7 which only works on Raspberry Pi 2B, 3A, 3B, 4B, 400 and Zero2W. These instructions allow for both to exist in different folders so you can have both versions available. If you choose not to build one or the other simply skip the relevant steps, you will need to perform this process each time you download an updated copy of the Ultibo RTL.


Ultibo RTL for ARMv7

Open a new terminal window (Better NOT to continue with the one you used earlier) and change to the source folder

cd $HOME/ultibo/core/fpc/source

Export the path to our FPC 3.2.2 Ultibo edition:

export PATH=$HOME/ultibo/core/fpc/bin:$PATH

Build the ARMv7 RTL as follows, checking that each step was successful before continuing:

make rtl_clean CROSSINSTALL=1 OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a BINUTILSPREFIX=arm-none-eabi- FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/fpc
make rtl OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a BINUTILSPREFIX=arm-none-eabi- FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/fpc
make rtl_install CROSSINSTALL=1 BINUTILSPREFIX=arm-none-eabi- FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH" OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a FPC=$HOME/ultibo/core/fpc/bin/fpc INSTALL_PREFIX=$HOME/ultibo/core/fpc INSTALL_UNITDIR=$HOME/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/rtl


Packages for ARMv7

Open a new terminal or continue with the one used to build the RTL, change to the source folder and ensure the path is updated:

cd $HOME/ultibo/core/fpc/source
export PATH=$HOME/ultibo/core/fpc/bin:$PATH

Build the ARMv7 Packages using the following commands:

make rtl_clean CROSSINSTALL=1 OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a BINUTILSPREFIX=arm-none-eabi- FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/fpc
make packages_clean CROSSINSTALL=1 OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a BINUTILSPREFIX=arm-none-eabi- FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/fpc
make packages OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a BINUTILSPREFIX=arm-none-eabi- FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH -Fu$HOME/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/rtl" FPC=$HOME/ultibo/core/fpc/bin/fpc
make packages_install CROSSINSTALL=1 BINUTILSPREFIX=arm-none-eabi- FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -CaEABIHF -OoFASTMATH" OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a FPC=$HOME/ultibo/core/fpc/bin/fpc INSTALL_PREFIX=$HOME/ultibo/core/fpc INSTALL_UNITDIR=$HOME/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/packages


Ultibo RTL for ARMv6

The process for the ARMv6 RTL is very similar but there are many differences in the parameters, careful you don't use the wrong ones.

Open a new terminal window and change to the source folder

cd $HOME/ultibo/core/fpc/source

Export the path to our FPC 3.2.2 Ultibo edition:

export PATH=$HOME/ultibo/core/fpc/bin:$PATH

Build the ARMv6 RTL as follows, checking that each step was successful before continuing:

make rtl_clean CROSSINSTALL=1 OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv6 BINUTILSPREFIX=arm-none-eabi- FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV6 -CfVFPV2 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/fpc
make rtl OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv6 BINUTILSPREFIX=arm-none-eabi- FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV6 -CfVFPV2 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/fpc
make rtl_install CROSSINSTALL=1 BINUTILSPREFIX=arm-none-eabi- FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV6 -CfVFPV2 -CIARM -CaEABIHF -OoFASTMATH" OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv6 FPC=$HOME/ultibo/core/fpc/bin/fpc INSTALL_PREFIX=$HOME/ultibo/core/fpc INSTALL_UNITDIR=$HOME/ultibo/core/fpc/lib/fpc/3.2.2/units/armv6-ultibo/rtl


Packages for ARMv6

Open a new terminal or continue with the one used to build the RTL, change to the source folder and ensure the path is updated:

cd $HOME/ultibo/core/fpc/source
export PATH=$HOME/ultibo/core/fpc/bin:$PATH

Build the ARMv6 Packages as follows:

make rtl_clean CROSSINSTALL=1 OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv6 BINUTILSPREFIX=arm-none-eabi- FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV6 -CfVFPV2 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/fpc
make packages_clean CROSSINSTALL=1 OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv6 BINUTILSPREFIX=arm-none-eabi- FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV6 -CfVFPV2 -CIARM -CaEABIHF -OoFASTMATH" FPC=$HOME/ultibo/core/fpc/bin/fpc
make packages OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv6 BINUTILSPREFIX=arm-none-eabi- FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV6 -CfVFPV2 -CIARM -CaEABIHF -OoFASTMATH -Fu$HOME/ultibo/core/fpc/lib/fpc/3.2.2/units/armv6-ultibo/rtl" FPC=$HOME/ultibo/core/fpc/bin/fpc
make packages_install CROSSINSTALL=1 BINUTILSPREFIX=arm-none-eabi- FPCFPMAKE=$HOME/ultibo/core/fpc/bin/fpc CROSSOPT="-CpARMV6 -CfVFPV2 -CIARM -CaEABIHF -OoFASTMATH" OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv6 FPC=$HOME/ultibo/core/fpc/bin/fpc INSTALL_PREFIX=$HOME/ultibo/core/fpc INSTALL_UNITDIR=$HOME/ultibo/core/fpc/lib/fpc/3.2.2/units/armv6-ultibo/packages

Creating the Configuration files


To allow switching between ARMv6 and ARMv7 the Ultibo installation includes configuration files that are passed to FPC to specify certain parameters for each model, you can easily create these for Debian as well like this.

Open a terminal window and change to the location where FPC Ultibo edition is installed:

cd $HOME/ultibo/core/fpc/bin

Create a new rpi.cfg file:

nano rpi.cfg

And paste these lines into the file, you need to change the word <user> to be your actual username (eg linus):

#
# Raspberry Pi (A/B/A+/B+/Zero/ZeroW) specific config file
#
-CfVFPV2
-CIARM
-CaEABIHF
-OoFASTMATH
-dRPI
-dBCM2708
-XParm-none-eabi-
-Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv6-ultibo/rtl
-Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv6-ultibo/packages
-Fl/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv6-ultibo/lib
-Fl/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv6-ultibo/lib/vc4


Save the file and do the same for the rpi2.cfg, rpi3.cfg, rpi4.cfg and qemuvpb.cfg files, remember to replace <user> with your username:

Contents of rpi2.cfg

#
# Raspberry Pi 2B specific config file
#
-CfVFPV3
-CIARM
-CaEABIHF
-OoFASTMATH
-dRPI2
-dBCM2709
-XParm-none-eabi-
-Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/rtl
-Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/packages
-Fl/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/lib
-Fl/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/lib/vc4


Contents of rpi3.cfg

#
# Raspberry Pi 3B/3B+/3A+/CM3/Zero2W specific config file
#
-CfVFPV3
-CIARM
-CaEABIHF
-OoFASTMATH
-dRPI3
-dBCM2710
-XParm-none-eabi-
-Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/rtl
-Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/packages
-Fl/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/lib
-Fl/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/lib/vc4


Contents of rpi4.cfg

#
# Raspberry Pi 4B/400/CM4 specific config file
#
-CfVFPV3
-CIARM
-CaEABIHF
-OoFASTMATH
-dRPI4
-dBCM2711
-XParm-none-eabi-
-Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/rtl
-Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/packages
-Fl/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/lib
-Fl/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/lib/vc4


Contents of qemuvpb.cfg

#
# QEMU VersatilePB specific config file
#
-CfVFPV3
-CIARM
-CaEABIHF
-OoFASTMATH
-dQEMUVPB
-XParm-none-eabi-
-Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/rtl
-Fu/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/packages
-Fl/home/<user>/ultibo/core/fpc/lib/fpc/3.2.2/units/armv7-ultibo/lib

Compiling an Application


Compiling an application from the command line is quite simple, you just need to remember some extra parameters because of the different environment. To compile something like the Hello World example open a terminal window, change to the folder where the application is located and add the path to FPC 3.2.2 Ultibo edition like this:

export PATH=$HOME/ultibo/core/fpc/bin:$PATH

Then compile the application using this command:

fpc -B -Tultibo -Parm -CpARMV7A -WpRPI2B @$HOME/ultibo/core/fpc/bin/rpi2.cfg -O2 HelloWorld.lpr

This example is for a Raspberry Pi 2B but can easily be adjusted for any other model by changing the appropriate parameters, so to compile for Raspberry Pi B instead try this:

fpc -B -Tultibo -Parm -CpARMV6 -WpRPIB @$HOME/ultibo/core/fpc/bin/rpi.cfg -O2 HelloWorld.lpr

Or for a Raspberry Pi 3B use this one:

fpc -B -Tultibo -Parm -CpARMV7A -WpRPI3B @$HOME/ultibo/core/fpc/bin/rpi3.cfg -O2 HelloWorld.lpr

And for a Raspberry Pi 4B use this one:

fpc -B -Tultibo -Parm -CpARMV7A -WpRPI4B @$HOME/ultibo/core/fpc/bin/rpi4.cfg -O2 HelloWorld.lpr

And finally for the QEMU target the command line looks like this:

fpc -B -Tultibo -Parm -CpARMV7A -WpQEMUVPB @$HOME/ultibo/core/fpc/bin/qemuvpb.cfg -O2 HelloWorld.lpr