Skip to main content

Building 4diac FORTE on Raspberry Pi

Introduction

This guide describes how to compile 4diac FORTE for embedded Linux platforms based on a debian OS, such as the Raspberry Pi.

Embedded devices typically feature ARM-based processors, limited resources, and hardware interfaces (e.g., GPIO) accessible via standard Linux mechanisms. Earlier versions of FORTE used wiringPi and later the deprecated sysfs interface for GPIO access. The current version uses the gpiochip interface provided by the Linux kernel.

Building 4diac FORTE on the Device

Introduction

This section explains how to compile 4diac FORTE dirctly on the target device.

It is intended for single-board computers running Debian-based distributions (e.g., Raspberry Pi, BeagleBone, Banana Pi), but it also works on standard PCs with Debian or Ubuntu.

Preparation

Install the required software packages:

  • Git (to clone the repository)

  • Build tools: cmake, make, gcc, g++, ccmake

sudo apt-get update
sudo apt-get install git cmake make gcc g++ cmake-curses-gui

Cloning the Repository

cd ~
git clone https://github.com/eclipse-4diac/4diac-forte.git
cd 4diac-forte

Preparing the Build Environment

Run the setup script:

./setup_posix.sh

If successful, it creates the directory bin/posix.

cd ./bin/posix

Configuring the Build

ccmake .

Follow the on-screen instructions.

Important Options

Option Description

CMAKE_BUILD_TYPE

Defines the build type (Debug, Release, etc.)

FORTE_LOGLEVEL

Controls console output verbosity. Use at least LOGINFO to enable output via OUT_ANY_CONSOLE.

Module Description

FORTE_IO

Provides core input/output functionality.

FORTE_MODULE_GPIOCHIP

Enables GPIO access via the gpiochip subsystem (requires FORTE_IO).

FORTE_COM_SER

Enables serial communication (e.g., RS-232).

After configuration:

  • press c to configure

  • press g to generate build files

Building FORTE

make

Run FORTE:

./forte

Cross-compiling for the Raspberry Pi

Embedded devices are typically less powerful than desktop machines, therefore cross-compiling is recommended.

This allows you to compile on your PC and transfer the executable to the target device.

Cross-compiling on Linux

Preparation

sudo apt-get update
sudo apt-get install git cmake make gcc g++ cmake-curses-gui

Cloning the Repository

cd ~
git clone https://github.com/eclipse-4diac/4diac-forte.git
cd 4diac-forte
mkdir ./bin/arm
cd bin/arm

Install Compiler and Configure

32-bit Systems

Install the cross-compiler:

sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf

Configure the build:

cmake -G "Unix Makefiles" \
  -DCMAKE_SYSTEM_NAME=Linux \
  -DCMAKE_SYSTEM_PROCESSOR=arm \
  -DCMAKE_C_COMPILER=/usr/bin/arm-linux-gnueabihf-gcc \
  -DCMAKE_CXX_COMPILER=/usr/bin/arm-linux-gnueabihf-g++ \
  -DFORTE_ARCHITECTURE=Posix \
  -DFORTE_COM_ETH=ON \
  -DFORTE_COM_SER=ON \
  -DFORTE_COM_FBDK=ON \
  -DFORTE_COM_LOCAL=ON \
  -DFORTE_TESTS=OFF \
  -DFORTE_IO=ON \
  -DFORTE_MODULE_GPIOCHIP=ON \
  -DFORTE_MODULE_CONVERT=ON \
  -DFORTE_MODULE_IEC61131=ON \
  -DFORTE_MODULE_UTILS=ON \
  ../..
64-bit Systems

Install the cross-compiler:

sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu

Configure the build:

cmake -G "Unix Makefiles" \
  -DCMAKE_SYSTEM_NAME=Linux \
  -DCMAKE_SYSTEM_PROCESSOR=arm \
  -DCMAKE_C_COMPILER=/usr/bin/aarch64-linux-gnu-gcc \
  -DCMAKE_CXX_COMPILER=/usr/bin/aarch64-linux-gnu-g++ \
  -DFORTE_ARCHITECTURE=Posix \
  -DFORTE_COM_ETH=ON \
  -DFORTE_COM_SER=ON \
  -DFORTE_COM_FBDK=ON \
  -DFORTE_COM_LOCAL=ON \
  -DFORTE_TESTS=OFF \
  -DFORTE_IO=ON \
  -DFORTE_MODULE_GPIOCHIP=ON \
  -DFORTE_MODULE_CONVERT=ON \
  -DFORTE_MODULE_IEC61131=ON \
  -DFORTE_MODULE_UTILS=ON \
  ../..

Compile

You can adjust the configuration by using ccmake . if you need to.

Then build the project:

make

After a successful build, the forte binary will be available in bin/arm/ and can be transferred to the target device.

Cross-compiling using Windows (not tested)

  1. Install needed additional tools:

    • CMake from its download page

    • Cross-compiling tool. You can download it from this link.

  2. Follow instructions of cross-compiling in the Linux platform from step 2, taking in account the following:

    1. In steps 4.2 and 4.3, the C and C++ cross-compilers are in the bin folder where you installed the tool, normally C:\SysGCC\Raspberry\bin

Where to go from here?

Now that you installed the required tools, it’s time to start using them. Take a look at the following tutorials:

If you want to compile 4diac FORTE for another platform or want to know more about that, here’s a quick link back:

If you want to go back to the Start Here page, we leave you here a fast access

Back to the top