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.
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.
app_common
尽管
app_common
is mainly for Qt Quick Ultralite examples and demos, it can be used in other projects. To use
app_common
, set one of these:
STM32F7_FREERTOS_DIR=<freertos_directory_path>
for
STM32F769I-DISCOVERY
and
STM32F7508-DISCOVERY
IMXRT1050_FREERTOS_DIR=<freertos_directory_path>
for
NXP IMXRT1050-EVKB
IMXRT1064_FREERTOS_DIR=<freertos_directory_path>
for
NXP IMXRT1064-EVK
注意:
freertos_directory_path
must be a path 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
,见
Changing heap policies
and
Using custom FreeRTOSConfig.h
.
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)
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
文件:
set_property(TARGET <app_name> PROPERTY 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
.
注意: The script expects to find the heap policy from FreeRTOS MemMang directory, where FreeRTOS’ memory manager implementations reside.
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
.