Build System#

This document describes the CMake-based build system used by applications based on the XMOS RTOS framework. The build system is designed so a user does not have to be an expert using CMake. However, some familiarity with CMake is helpful. You can familiarize yourself by reading the CMake Tutorial or CMake documentation. Reviewing these is optional and the reader should feel free to save that for later.


An xcore RTOS project can be seen as an integration of several modules. For example, for a FreeRTOS application that captures audio from PDM microphones and outputs it to a DAC, there could be the following modules:

  • Several core modules (for debug prints, etc…)

  • The FreeRTOS kernel and drivers

  • PDM microphone array driver for receiving audio samples

  • I2C driver for configuring the DAC

  • I2S driver for outputting to the DAC

  • Application code tying it all together

When a project is compiled, the build system will build all libraries and source files required for the application. For this to happen, your CMakeLists.txt file will need to specify:

  • Application sources and include paths

  • Compile flags

  • Compile definitions

  • Link libraries

  • Link options

This is best illustrated with a commented Example CMakeLists.txt.


Your CMakeLists.txt file will need to specify the target link libraries as shown in the following snippet:

target_link_libraries(my_target PUBLIC

It is very common for target link alias libraries, like rtos::freertos in the snippet above, to include common sets of target link libraries. The snippet above could be simplified because the rtos::freertos alias includes many commonly used drivers and peripheral IO libraries as a dependency.

target_link_libraries(my_target PUBLIC

Application target link libraries can be further simplified using existing bsp_configs. These provide their dependent link libraries enabling applications to simplify their target link libraries list. The snippet above could be simplified because the rtos::bsp_config::xcore_ai_explorer alias includes core::general, rtos::freertos, and all required drivers and peripheral IO libraries used by the bsp_config. More information on bsp_configs can be found in the RTOS Programming Guide.

target_link_libraries(my_target PUBLIC

XMOS libraries and frameworks provide several target aliases. Being aware of the Targets will simplify your application CMakeLists.txt.