The RTOS Application Layer provides several re-usable components that may be integrated into larger applications. It aims to provide a common repository to maximize code sharing across different applications and/or environments.
- asynchronous processing (component name: async)
- audio pipeline (component name: audio)
- logging (component name: log)
- shell (component name: shell)
- statistics (component name: stats)
- tsn endpoint (component name: tsn)
Components can be enabled through Kconfig configuration in your prj.conf file:
CONFIG_MCUX_COMPONENT_component.rtos_apps.async=y
CONFIG_MCUX_COMPONENT_component.rtos_apps.audio=y
CONFIG_MCUX_COMPONENT_component.rtos_apps.log=y
CONFIG_MCUX_COMPONENT_component.rtos_apps.stats=y
CONFIG_MCUX_COMPONENT_component.rtos_apps.tsn=yIndividual components may have additional configuration options. For example, the log component:
CONFIG_MCUX_COMPONENT_component.rtos_apps.log=y
CONFIG_RTOS_APPS_LOG_STR="app "
CONFIG_RTOS_APPS_LOG_TIMESTAMP=yEach of the components provides:
- A cmake submodule file: rtos_apps_<component>.cmake
- One or more header file(s): rtos_apps/<component>.h or rtos_apps/<component>/<file>.h
On the applications' CMake, add the following lines:
set(RTOS_APPS_DIR /path/to/rtos-apps)
set(RTOS_APPS_TARGET <application target name>)
include(${RTOS_APPS_DIR}/rtos_apps_<component_a>.cmake)
...
include(${RTOS_APPS_DIR}/rtos_apps_<component_b>.cmake)A top-level cmake file rtos_apps.cmake is provided. It pulls in the components enabled through Kconfig, so applications only need to include this one file.
Each of the components provides:
- A cmake submodule file: rtos_apps_<component>.cmake (included by
rtos_apps.cmakewhen the component is enabled) - One or more header file(s): rtos_apps/<component>.h or rtos_apps/<component>/<file>.h
On the applications' CMake, add the following lines:
set(RTOS_APPS_DIR /path/to/rtos-apps)
set(RTOS_APPS_TARGET <application target name>)
include(${RTOS_APPS_DIR}/rtos_apps.cmake)Source the rtos-apps Kconfig from the application's Kconfig file (the path can be relative to $(ZEPHYR_BASE)):
rsource "$(ZEPHYR_BASE)/../rtos-apps/Kconfig.z"
And enable the required Kconfig symbols, for instance on your prj.conf file:
CONFIG_RTOS_APPS=y
CONFIG_RTOS_APPS_LOG=y
CONFIG_RTOS_APPS_<component_a>=y
...
CONFIG_RTOS_APPS_<component_b>=ySources will be added to the specified target, as well as required include paths. To use the application layer, include the component specific header file(s):
#include <rtos_apps/<component>.h>or
#include <rtos_apps/<component>/<file>.h>