Home

codesys.com Ingo

Download rt-preempt image

Raspberry Pi Hardware

The Raspberry Pi is an ARM based, very powerful, but cheap mini computer. The natively supported operating system is Linux-Userbereich.

For automation projects, the direct access to GPIOs, SPI, I2C and One Wire is a big value of the board.

Support in CODESYS

CODESYS can easily be installed from the store. It can then be used in a 2h demo, but restarted as often as possible.

To install CODESYS, follow the following steps...

Prepare CODESYS

  • Register in the CODESYS Store
  • Download the Raspberry Pi package
  • Install the package by double clicking on it

Prepare the Pi

Install the Runtime

  • Open CODESYS
  • Open the Deploy Tool: Tools -> Update Raspberry Pi
  • Enter IP Address
  • Enter username and password (e.g. user: pi, password: raspberry)
  • Click on "install"

Note: Remember to change the password of the user pi to secure the system!

Configuration

Raspberry Pi is an open plattform with tons of extensions and compatible hardware. The configuration of those has to be done with standard mechanisms in Linux. CODESYS doesn't assist or hinder you with the configuration of the Linux system.

Linux Distribution

You can choose several linux distributions to run on the Raspberry Pi. But the main one, and which is officially supported by the Raspberry Pi and by CODESYS is Raspbian.

Raspbian is based on Debian, but it is compiled from scratch to support all Raspberry Pi variants. Because of this it is not compatible with Debian anymore.

For more advanced users of the Raspberry Pi 2 or 3, I would recommend to use a stock debian. This has a few advantages:

  • You start with a minimal system, which results in:
    • less problems with corruptions of the SD Card
    • less power consumption
  • Distributing an image to others is easier with Debian
  • You have full access to all packages, included in the debian distribution

Debian for ARM splits up into two versions:

  • armhf, supports RPI 2 / 3
  • armel, supports RPI 0 / 1

CODESYS uses "armhf", which is also the standard, which Raspbian uses. While Raspbian compiles it slightly different, to support also RPI 0 / 1 with the same distribution.

Realtime Patch

There is an Open Source Community founded and driven by several industrial companies, which is working on reducing the Jitter and Interrupt Latency of the stock Linux Kernel. The goal of this effort is to make the Linux Kernel realtime aware. This community is called OSADL, and the CODESYS Group is a founding member of it.

As not all of the necessary changes of the kernel are in the vanilla kernel, yet - we usually talk about the "realtime patch" or rt-preempt in short. As this is a patch-set, which can be applied to a vanilla kernel, to improve its realtime performance. You can apply it most easily by using the patch-scripts, provided by the Test-Farm.

RPI 2 / 3

If you want to have a minimal debian system with the rt-preempt patch already included, you can simply use the download link at the top of this page.

The username and password of this image is "wharfie". The root password is "root". To login via ssh, you can only use the user wharfie. Root is not allowed to login via ssh. To get root access, you can then use the command "su":

$> ssh wharfie@192.168.100.100
login as: wharfie
password: <-- here you enter the wharfie password

$> su -
Password: <-- here you enter the root password

If you want to use Raspbian or you want to roll it by your own, you can follow the following steps...

Download the rt-preempt patch script from OSADL.

wget --output-document=/usr/src/osadl.sh https://www.osadl.org/monitoring/showpatchscript.php?veryshorthost=r7s3s;
cd /usr/src;
chmod 755 osadl.sh;
./osadl.sh;

Then you can simply compile the kernel, as the default configuration, used in the test rack, is already prepared:

cd /usr/src/linux-*-rt*;
export KERNEL=kernel7;
yes | make oldconfig;
make zImage;
make modules_install:

To install it, just copy a few files to /boot.

release=$(cut -d" " -f3 include/generated/utsrelease.h | tr -d '"')
cp /usr/src/linux-*-rt*/arch/arm/boot/zImage /boot/zImage-$release;
cp /usr/src/linux-*-rt*/arch/arm/boot/zImage /boot/$KERNEL.img;

Network Configuration

By default the Raspberry Pi is using dhcp. Before version "etch" of Raspbian, the configuration of a static IP could easily done by modifying /etc/network/interfaces. Since then, things became again much more complicated, as you have so many options:

  • /etc/network/interfaces (but by disabling / blacklisting it in dhcpcd)
  • dhcpcd.conf
  • systemd units
  • ...

I found, that a good german explaination of all the possibilities was an NetzMafia.de.

For the english speaking folks, just add the following to your /etc/dhcpcd.conf:

interface eth0

static ip_address=10.0.0.10/24
static routers=10.0.0.1
static domain_name_servers=10.0.0.1

That's the easiest way, as it keeps the default configuration of the network services (dhcpcd, networkd, ...).

For versions proir to "etch", you can add the following to /etc/network/interfaces:

iface eth0 inet static
address 10.0.0.10
netmask 255.255.255.0
gateway 10.0.0.1

Licenses

The image, which is provided in this project contains a lot of open source licenses. To get a complete list of included licenses, sorted by packages, please refer to the file license.tar.bz2.

To get the source code of all the packages, which are included in the image, please refer to sources.tar.bz2.