C

FreeRTOS application build process

Qt Quick Ultralite FreeRTOS application build process is the same as when building on bare metal with some additions. FreeRTOS being a separate library, you can build and link it yourself or use the app_common helper.

Building application for FreeRTOS with or without app_common

app_common is a helper used to unify OS needs for examples and demos. It configures Qt Quick Ultralite for the correct OS, compiles OS-specific files, such as FreeRTOS sources, and links them to the project.

Using app_common

Although app_common is mainly for Qt Quick Ultralite examples and demos, it can be used in other projects. To use app_common, set the FREERTOS_DIR CMake variable to a directory, where the include directory, portable directory, and FreeRTOS source files exist.

After setting the FreeRTOS directory, add the following line to your project's CMakeLists.txt:

app_target_setup_os(<app_name>)

Where, <app_name> is the name of your project's executable. This function sets up FreeRTOS for the project.

Now your project should build and link to FreeRTOS and the Qt Quick Ultralite library. If you want to change heap allocator or the Qt Quick Ultralite provided FreeRTOSConfig.h, see Changing heap policies and Using custom FreeRTOSConfig.h.

Building application without app_common

When building project that uses FreeRTOS without app_common, you must configure, compile, and link FreeRTOS to your project manually. For FreeRTOS building instructions, see Creating a New FreeRTOS Project.

Qt Quick Ultralite itself needs the following FreeRTOS headers and functions:

  • FreeRTOS.h
  • task.h
  • portable.h
  • memory.h
  • void xPortSysTickHandler(void)
  • void *pvPortMalloc(size_t xSize)
  • void vPortFree(void *pv)

Changing heap policies

FreeRTOS includes different memory allocation implementations (see FreeRTOS developer docs, Memory management for more info about implementations). By default, Qt Quick Ultralite example application uses heap_4, which “coalescences adjacent free blocks to avoid fragmentation. Includes absolute address placement option.” However, in some situations other custom implementation may be preferred over the ones provided by FreeRTOS. You can change the implementation by adding the following call your project's CmakeLists.txt file:

set_property(TARGET <app_name> PROPERTY QUL_FREERTOS_HEAP_POLICY "<heap_implementation>")

Where <app_name> is the name of your project executable and <heap_implementation> is the name of the implementation without the filename extension. For example, if you want to use heap_1.c, you must put heap_1.

Note: The script expects to find the heap policy from FreeRTOS MemMang directory, where FreeRTOS’ memory manager implementations reside.

Using custom FreeRTOSConfig.h

FreeRTOSConfig.h is a header file used to configure FreeRTOS while building the project. FreeRTOSConfig.h is provided by the platform package. TARGET_PLATFORM_DIR CMake variable is used to determine the location of FreeRTOSConfig.h.

Available under certain Qt licenses.
Find out more.