This guide is for compiling 4diac FORTE for freeRTOS and LwIP. freeRTOS is a free real-time operative system which is not attached to a specific hardware, but it can run in many different ones. The operative system is very small and simple, and initially didn't have any TCP/IP support, that's why a common practice was to use it together with LwIP, a small TCP/IP stack. freeRTOS now also have an extra support for TCP/IP (see here) but for now FORTE is compiled using LwIP.

This guide helps you make FORTE run on some hardware where freeRTOS and LwIP are already able to run. Since you can be using any hardware, no support for IO is provided here and this guide will help you compile FORTE as a static library that you can later add to some project you already have working on your hardware, so the following points are assumed before starting this guide

If you checked all points before, keep going. If you don't have a freeRTOS and LwIP example this guide won't help you much.

Set CMake and compile

  1. Open CMake-GUI and complete as shown in the image
    1. Set the 4diac FORTE source path where you cloned the Git repository.
    2. Set path for binaries where you want to create the library. Normally, bin/freeRTOS is used.
    3. Press Configure

    Selecting folders in CMake

  2. Select the correct option
    1. Select the tool you normally use to compile your programs. This example follows using UNIX Makefiles from the list.
    2. Select Specify tools for cross-compiling.(you can also do it selecting "Specify toolchain file for cross-compiling" but that requires that you create the file first, which if you can do it later when you have more experience with CMake)
    3. Press Next

    CMake Setup

  3. Setup for cross-compilation
    1. Write a name for the OS (normally freeRTOS, it won't affect the compilation).
    2. Select the path to the C cross-compiler for your hardware. This you can look for in the properties of your project in your cross-IDE.
    3. Select the path to the C++ cross-compiler for your hardware. This you can look for in the properties of your project in your cross-IDE.
    4. The target root field can be left empty.
    5. Click Finish

    Select cross-compiling tools.

  4. Configure the compilation

    A list with all variables of 4diac FORTE in red should be shown in CMake.

    1. Set the FORTE_ARCHITECTURE variable to FreeRTOSLwIP and click Configure
    2. Check the information that appears in CMake about the LwIP configuration.
    3. The variable FORTE_FreeRTOSLwIP_INCLUDES should appear now and it is the most important one. You should set it to the several paths where the freeRTOS and LwIP headers are, each separated by a semicolon. For example: ${MAIN_DIRECTORY}/FreeRTOS/portable;${MAIN_DIRECTORY}/include;${MAIN_DIRECTORY}/lwip/src/include;${MAIN_DIRECTORY}/lwip/port where ${MAIN_DIRECTORY} is the path where you have your freeRTOS and LwIP code. When you later compile and it fails with an error saying that some "includes" are missing, this variable should be updated where the folders where the missing files are located.
    4. It might be the case that you also need to set the CMAKE_C_FLAGS and CMAKE_CXX_FLAGS variables with the flags needed for your hardware. You can check which flags you need from the proeperties of your example project in your cross-IDE.
    6. Click Configure and the variables that need revision will appear again in red and the rest in white. Check these variables and press Configure until no variable is shown in red. Here you can add the modules that you want FORTE to have, but from the freeRTOS point of view, there's nothing else you need.
  5. Generate files
  6. Build 4diac FORTE

Add the FORTE library to your project

  1. Add the recently compiled library (libforte-static.a) to your project, this step depends on the cross-IDE you have.
  2. Copy the file src/arch/freeRTOS/forte_Init.h to your project.
  3. In your file where your "main" function is located, you need to include forte_Init.h and add a task that will start the "forte_thread" task. A working example of the task running FORTE is as follow (PRINTF can cause problems, so change it to your logging function or delete it):
    static void forte_thread(void *arg) { forteGlobalInitialize(); TForteInstance forteInstance = 0; int resultForte = forteStartInstanceGeneric(0, 0, &forteInstance); if(FORTE_OK == resultForte){ forteJoinInstance(forteInstance); }else{ PRINTF("Error %d: Couldn't start forte\n", resultForte); } forteGlobalDeinitialize(); vTaskDelete(NULL); }

If everything is Ok, FORTE will start and you'll be able to deploy to it on port 61499. If you have some problems, read the following section


It's probable that FORTE doesn't run in the first try. You should take care of the following:

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:

Step 0 - 4diac IDE Overview

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

Install Eclipse 4diac

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

Where to Start

Or Go to top