Difference between revisions of "Building for Raspbian"
Line 59: | Line 59: | ||
cp /home/pi/ultibo/core/fpc/source/compiler/ppcarm /home/pi/ultibo/core/fpc/bin/ppcarm | cp /home/pi/ultibo/core/fpc/source/compiler/ppcarm /home/pi/ultibo/core/fpc/bin/ppcarm | ||
− | Run the following to check that it shows as version 3.1.1 and lists ultibo under the supported targets. | + | Run the following to check that it shows as version 3.1.1 and lists <code>ultibo</code> under the supported targets. |
/home/pi/ultibo/core/fpc/bin/fpc -i | /home/pi/ultibo/core/fpc/bin/fpc -i | ||
Line 69: | Line 69: | ||
=== Installing the arm-none-eabi Toolchain === | === Installing the arm-none-eabi Toolchain === | ||
---- | ---- | ||
− | + | ||
+ | You may wonder why a toolchain is required when Raspbian runs native on the Raspberry Pi and therefore we are not cross compiling to create our Ultibo applications, the reasons are many but simply the tools included with Linux are configured for Linux specific settings which are not suitable for bare metal development. | ||
+ | |||
+ | See this [https://wiki.linaro.org/WorkingGroups/ToolChain/FAQ#What_is_the_differences_between_.2BIBw-arm-none-eabi-.2BIB0_and_.2BIBw-arm-linux-gnueabihf.2BIB0.3F_Can_I_use_.2BIBw-arm-linux-gnueabihf.2BIB0_tool_chain_in_bare-metal_environment.3F_How_do_you_know_which_toolchain_binary_to_use_where.3F page] for more information. | ||
+ | |||
+ | On Raspbian Jessie the arm-none-eabi tools are 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 compiling the Ultibo RTL. | ||
+ | |||
=== Building the Ultibo RTL === | === Building the Ultibo RTL === | ||
---- | ---- |
Revision as of 08:04, 6 September 2016
Contents
Introduction
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 both the modified Free Pascal compiler and the Ultibo RTL in order to create a working configuration that allows developing Ultibo applciations.
This process was tested and developed using the latest Raspbian Jessie from the Raspberry Pi downloads page, at the time of writing this has a release date of 27 May 2016 however it is possible that later or earlier versions may also work. There is at least one required package that is not available for Raspbian Wheezy versions.
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/pi/ultibo/core
folder.
Currently Raspbian does not provide a package for the 3.0.0 release of Free Pascal, this version is needed as the starting point for these instructions and the following will NOT work if you start with version 2.6.4 which is the most recent version provided in the official Raspbian packages.
The simplest way we know to get a fully working installation of Free Pascal 3.0.0 is to follow the instructions at GetLazarus.org which will by default install a working copy in the folder /home/pi/Development/FreePascal
that can be deleted later if you choose.
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 the build a Raspbian native version of the Ultibo edition of FPC.
These instructions assume that FPC 3.0.0 from GetLazarus was installed to:
/home/pi/Development/FreePascal/fpc/bin
You should now download the sources of the FPC Ultibo edition from GitHub and unzip the contents to the folder:
/home/pi/ultibo/core
After extracting the files rename the folder FPC-master
to fpc
so the contents of the zip will be in /home/pi/ultibo/core/fpc
Now download the source of Ultibo core from GitHub and extract the ultibo
folder to the location:
/home/pi/ultibo/core/fpc/source/rtl
Once this is done, open a terminal window and change to the folder containing the Ultibo sources:
cd /home/pi/ultibo/core/fpc/source
Add the path to FPC 3.0.0 to the environment:
export PATH=/home/pi/Development/FreePascal/fpc/bin:$PATH
Do the following steps in order, checking that each was completed successfully before continuing:
make distclean
make all OPT=-dFPC_ARMHF
make install OPT=-dFPC_ARMHF PREFIX=/home/pi/ultibo/core/fpc
Once those steps have completed you should now have a Raspbian native version of the FPC Ultibo edition. Copy it to the bin
directory as follows so we can find it later:
cp /home/pi/ultibo/core/fpc/source/compiler/ppcarm /home/pi/ultibo/core/fpc/bin/ppcarm
Run the following to check that it shows as version 3.1.1 and lists ultibo
under the supported targets.
/home/pi/ultibo/core/fpc/bin/fpc -i
Use fpcmkcfg to create our default configuration file like this:
/home/pi/ultibo/core/fpc/bin/fpcmkcfg -d basepath=$HOME/ultibo/core/fpc/lib/fpc/3.1.1 -o /home/pi/ultibo/core/fpc/bin/fpc.cfg
Installing the arm-none-eabi Toolchain
You may wonder why a toolchain is required when Raspbian runs native on the Raspberry Pi and therefore we are not cross compiling to create our Ultibo applications, the reasons are many but simply the tools included with Linux are configured for Linux specific settings which are not suitable for bare metal development.
See this page for more information.
On Raspbian Jessie the arm-none-eabi tools are 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 compiling the Ultibo RTL.