rpi_hal from https://github.com/rudiratlos/rpi-hal is an incredible rich and uptodate unit for Freepascal to use the I/O of the Raspberry.

From Freepascal programs all works as expected when run as root. Otherwise accessing /dev/mem is causing real problems.

The unit can be used from Lazarus also (avoid the test procedures with writeln’ ūüėČ ) but also require root access and setting cthreads in the program heading.

For X apps  running as root is not possible with just sudo.
Seems I found a solution here: https://wiki.archlinux.org/index.php/Running_GUI_applications_as_root

I applied method 2:

sudo nano /etc/profile

and added this line as last line

export XAUTHORITY=/home/pi/.Xauthority

Now i can do

$ sudo ./testinit (my simple test program with only the init line of rpi_hal)

and this worked without error, init succeeded.

If you want debugging the app in Lazarus, start Lazarus as root (and ignore all the warnings)

xhost +localhost
sudo /usr/bin/startlazarus

Original text from https://wiki.archlinux.org/index.php/Running_GUI_applications_as_root

Method 2: Globally in /etc/profile
Add the following line to /etc/profile:

export XAUTHORITY=/home/username/.Xauthority
This will permanently allow root to connect to a non-root user’s X server.

Or, merely specify a particular app:

XAUTHORITY=/home/username/.Xauthority appname
where appname is the name of the particular app. (e.g. kwrite

Install FPC 3.0.0 on Raspbian, Build Ultibo

By Paul Breneman:

Raspbian Lite is the only OS selected

-When reboots, login (user pi and password raspberry)
РEverytime boot up, hit the   key an extra time (as first prompt is erased)
РEnter the following lines (without bold comment text) in the terminal:

sudo apt-get update
sudo apt-get upgrade
sudo dpkg-reconfigure tzdata 
sudo apt-get install binutils-arm-none-eabi
sudo apt-get install fpc-3.0.0 --fix-missing 
fpc -i | more 
wget http://turbocontrol.com/easyultibo121517.zip
mkdir hello
unzip easyultibo121517.zip -d hello
cd hello
export PATH=/home/pi/ultibo/core/fpc/bin:$PATH
fpc -i | more 
cd QEMU 
cd ..
cd RPi
cd ..
cd RPi2
cd ..
cd RPi3
cd ..

Install Ultibo on Stretch

On a new build of RaspBian 2017-09-07-raspbian-stretch.zip

sudo apt-get install libgtk2.0-dev libcairo2-dev libpango1.0-dev libgdk-pixbuf2.0-dev libatk1.0-dev libghc-x11-dev
sudo apt-get install binutils-arm-none-eabi
sudo apt-get install gcc-arm-none-eabi
dpkg -l | wc
1403 14260 197899
Edit the CONF_SWAPSIZE value to be 1000 or greater

On Ubutu 16.04
The following 2 cmds
cd ultibo/core


Freepascal and Lazarus installation on RPi

freepascal logo
A page describing how to get the latest Freepascal and Lazarus development systems on the Raspberry Pi in optimal format, targeted at ARMV6 (all Raspberri Pi’s) and ARMV7 (RPi 2).

Updated March  2020, for current FPC/Lazarus/Raspbian versions.

Lazarus forum post for discussion and .to download deb packages using the following Wiki article.

You may have to install some dependencies libgtk2.0-dev libgpm-dev libncurses-dev

sudo apt install libgtk2.0-dev libgpm-dev libncurses-dev

sudo dpkg -i fpc-laz_3.0.4_armhf.deb
sudo dpkg -i fpc-src_3.0.4_armhf.deb 
sudo dpkg -i lazarus-project_2.0.6-0_armhf.deb

To add packages: increase swap file to 1000 MB (see below)!

Wiki article to get fpc3.04 and Lazarus 2.06  deb packages on Raspbian Buster RPI 4 as build machine

You may get a few linker messages, like crtbegin.0 missing. Harmless but annoying.

Get rid of them with

sudo apt-get install libgcc-8-dev

and add this line to /etc/fpc.cfg

# path to the gcclib

Now the -T warning is also harmless, bug in LD and the trunk version of FPC seems to have a solution. .

Read More