[Documentation] [TitleIndex] [WordIndex

As the system is based on FreeRTPS it does not have any runtime dependencies. To compile and run the system on a microcontroller (MCU), you need a cross-compiler. Now, compiling and programing through the linux terminal is only supported with STM32 MCUs, once the we only have linker files for it. If you are using a especific IDE, you can use the system just importing the source and headers files.

Compiling and programing for STM32 on Linux

To use FreeRTPS+FreeRTOS with STM32 you will need the ARM Cortex-M port of gcc (arm-none-eabi) and OpenOCD. Next we show the installation of necessary tools, this tutorial used Ubuntu 16.04. First, install the tools required to get and compile the system.

sudo apt-get update
sudo apt-get install build-essential cmake git

Now, we going to install the pre-built compiler toolchain for ARM Cortex-M. On Ubuntu, we can do this through an Ubuntu Personal Package Archive (PPA) maintained by “GCC ARM Embedded Maintainers” team:

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
sudo apt-get update
sudo apt-get install gcc-arm-embedded

Now we need to build OpenOCD from source, this way we have the recent files of the STM32 family. The following lines put the source in ~/openocd and install it into /usr/local:

sudo apt-get install libtool autoconf automake pkg-config libusb-1.0-0-dev libhidapi-dev
cd ~
git clone http://repo.or.cz/openocd.git
cd openocd
./bootstrap
./configure --enable-stlink --enable-ftdi --enable-cmsis-dap --prefix=/usr/local
make -j4
sudo make install

Finally, we need to get and compile the files of the system from Github. The following lines will make a copy of the latest files in ~/FreeRTPS-FreeRTOS folder and will compile the system.

cd ~
git clone https://github.com/Expertinos/FreeRTPS-FreeRTOS
cd FreeRTPS-FreeRTOS
make

Now you can use the 4 demos included in the FreeRTPS-FreeRTOS. On next lines we present the description and how to program the STM32 Discovery with each demo example.

App listener This example implements a single String subscriber. To program it on the STM32, plug the board to the computer through a USB cable and put the following line on terminal.

make program-listener-stm32f4_disco-metal

App talker This example implements a single String publisher. To program it on the STM32, plug the board to the computer through a USB cable and put the following line on terminal.

make program-talker-stm32f4_disco-metal

App pid This example implements a 32 bit unsigned int publisher, a 32 bit unsigned int subscriber and a PID closed loop control. To program it on the STM32, plug the board to the computer through a USB cable and put the following line on terminal.

make program-pid-stm32f4_disco-metal

App pubpidsetpoint This example implements a 32 bit unsigned int publisher. It can be used with PID example, on a separate board, to test the PID closed loop. To program it on the STM32, plug the board to the computer through a USB cable and put the following line on terminal.

make program-pubpidsetpoint-stm32f4_disco-metal

2018-09-15 12:21