Skip to main content

How to compile Luos-engine

Confirmed

What you will learn:

In this tutorial you will learn how to use and compile Luos-engine on your favorite build system.

compilation
IDE
makefile
eclipse
cmake
build

Luos-engine is a ANSI C library that can be compiled on any build system. In this tutorial we will show you how to compile Luos-engine on your favorite build system.

info

If you don't want to use any particular build system and just want to use the more convenient one, Platformio is the default one used by Luos. You can directly use it by following the Get Started. To get more advanced information please follow the tutorial on how to use Platformio here.

1. Prerequisites

On this tutorial we will consider that you already know how to use your build system and have it installed and ready to be used. We will explain how to compile Luos-engine by describing the needs of the library. It will be up to you to adapt the explanations to your environment.

We will also consider that the project you want to compile follow the Luos project structure.

2. Files organization

Before compiling anything you need to get the source code of Luos-engine. You can get it from the Luos repository. In this repository you will find:

  • The source code of Luos-engine
  • The source code of some networks
  • Some usefull tool services examples, and test scripts

For your project you may only need to compile Luos-engine and the networks you want to use. You can also use the tool services on your project and compile it the same way you will do it for your own services.

3. Compiling Luos-engine

The Luos-engine code contain the ANSI C code used to deal with the services and messages. You will always need to compile it to use Luos. Luos need to get some information from the hardware you are using, mostly a systick, a potential way to disable IRQ and potentially an access to the flash memory. This is why you will need to adapt the compilation of Luos-engine to your hardware.

Includes

Here is the list of the "include" folders you need to add to your project to compile Luos-engine:

  • luos_engine/engine/OD
  • luos_engine/engine/bootloader
  • luos_engine/engine/profiles
  • luos_engine/engine/core/inc
  • luos_engine/engine/HAL/_BOARD_ (This is replacing the -D LUOS_HAL flag you may see on some tutorials based on platformio)

You have to include the corresponding BOARD folder to your project. For example if you are using a STM32L4 you will have to include the folder STM32L4.

Source files

Here is the list of the source files you need to add to your project to compile Luos-engine:

  • luos_engine/engine/bootloader
  • luos_engine/engine/profiles
  • luos_engine/engine/core/src
  • luos_engine/engine/HAL/_BOARD_ (This is replacing the -D LUOS_HAL flag you may see on some tutorials based on platformio)

The same way you have to include the corresponding BOARD folder to your project, you have to do the same with the sources. For example if you are using a STM32L4 you will have to include the folder STM32L4.

Flags

Flags such as -D BOOTLOADER or -D NO_RTB are simple defines you can choose to declare them or not as you want. Alternatively you can also choose to group them all on your own node_config.h file. To manage it you will have to use the -include node_config.h build flag. You can find the complete list of the available flags on the node parameters configuration page

4. Compiling one or multiple networks

Since Luos-engine v3 you can choose to compile and use as many networks as you want. To do so you will have to include the corresponding network folders to your project. The network folders should provide a pretty similar strucutre from each other. You will find the following folders:

  • inc
  • src
  • HAL/BOARD

Includes

Here is the list of the include folders you need to add to your project to compile a network:

  • luosengine/network/_NETWORK/inc
  • luosengine/network/_NETWORK/HAL/BOARD

The same way you are choosing the BOARD folder to include with Luos_engine, you have to do the same with the network folder. For example if you are using a STM32L4 and the robus network you will have to include the folder luos_engine/network/robu_network/HAL/STM32L4.

Source files

Here is the list of the source files you need to add to your project to compile a network:

  • luosengine/network/_NETWORK/src
  • luosengine/network/_NETWORK/HAL/BOARD

The same way you are choosing the BOARD folder to include with Luos_engine, you have to do the same with the network folder. For example if you are using a STM32L4 and the robus network you will have to include the folder luos_engine/network/robu_network/HAL/STM32L4

5. Other compilation things you need to think about for your projects

As described on the Luos project structure, we advise you to develop your services on a dedicated folder called a package. You have to make sure to include the corresponding files of your package to your project.