Building FORTE on Raspberry Pi

Introduction

Raspberry Pi is a low-cost embedded system with an ARM processor @700Mhz and 512MB RAM. It supports many operation systems. The most popular OS for the RaspberryPi is the Debian based Raspbian. Furthermore there is an 26 pin header on board for custom I/O. FORTE uses the wiringPi library from http://www.wiringpi.com that is released under the GNU LGPLv3 license. The I/O are connected as follows.

wiringPi Name Header Name wiringPi
3.3v 1 2 5v
8 SDA 3 4 5v
9 SCL 5 6 Gnd
7 GPIO7 7 8 TxD 15
Gnd 9 10 RxD 16
0 GPIO17 11 12 GPIO18 1
2 GPIO27 13 14 Gnd
3 GPIO22 15 16 GPIO23 4
3v3 17 18 GPIO24 5
12 GPIO10 19 20 Gnd
13 GPIO9 21 22 GPIO25 6
14 GPIO11 23 24 GPIO8 10
Gnd 25 26 GPIO7 11

This tutorial shows how to compile FORTE in a console window. This way, it is not necessary to use the GUI mode on the Raspberry Pi. If you compile FORTE for first the time, you have to configure your RaspberryPi, as described in Preparation. When you recompile FORTE to include new FBs, skip to Building.

Preparation

  1. Install some additional software on your Raspberry Pi if not done yet.
    $ sudo apt-get install tortoisehg cmake make gcc g++

  2. Check out FORTE from the Mercurial repository in your home directory.

  3. $ cd ~ $ hg clone http://hg.code.sf.net/p/fordiac/forte

  4. Prepare the FORTE project structure for the Posix architecture.

  5. $ cd forte $ chmod +x setup_posix.sh $ ./setup_posix.sh

Building

  1. Go to the posix directory, which is within the forte/bin directory.

  2. $ cd ~/forte/bin/posix

  3. Create makefiles with cmake. The parameter -i starts CMake in wizard mode, where you can setup parameters in a way similar to the CMake GUI.

  4. $ cmake -i ../..

  5. Choose the function blocks you want to compile. To include or exclude an package, just enter YES or NO to the appropriate package.

  6. Build FORTE.

  7. $ make

Running an Application

The following picture shows an example application from the flipflop tutorial which is extended with IX and QX function blocks. The extended application periodically toggles on RaspberryPi pin number 3. It can be started and stopped via RaspberryPi pin number 13. You can connect an LED to obtain a blinking light.

Simple flip flop application with an IX and QX function block.

The "PARAMS" data input in the IX and QX FB define which pin should be used on the RaspberryPi. In this example, the input is taken from pin 2 in wiringPi which is pin number 13 on the RaspberryPi, according the table. The output signal is connected to wiringPi pin 8, which is the physical pin number 3 on the RaspberryPi connector.

The application also contains E_CYCLE and E_SWITCH function blocks (which ar not in the flipflop tutorial). The first one generates an event every 500 ms. This way the IX block will check the hardware input every half second if signal has changed. E_SWITCH_0 starts or stops the action, depending on the "IN" data output of the IX function block.