Using Xenomai with the EMAC OE SDK
This page provides a brief description on how to use the Xenomai real time operating system API with the EMAC OE SDK.
Contents
Background
Xenomai is a real-time operating system (RTOS) API designed to work alongside Linux. It provides a means of migrating from a proprietary RTOS to a Linux based system. This also allows for native Linux applications to be run side-by-side with real-time applications on the same target
General Information
By default, the EMAC SDK includes support for Xenomai. However, due to the hardware dependent nature of the real time API, a Xenomai enabled kernel is necessary.
Using Xenomai with the EMAC OE SDK
For the purposes of this document, all examples will be using the CMake build system. These examples can be easily modified to be used on a traditional Makefile project or a Qt qmake project as well. For most Xenomai enabled projects, adding the following lines to the project's CMakeLists.txt file will be sufficient.
project (example)
#######################################
### Necessary additions for Xenomai ###
#######################################
set(XENO_BASE "${CMAKE_FIND_ROOT_PATH}/usr")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -MMD -g")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${XENO_BASE}/include/xenomai/cobalt -I${XENO_BASE}/include/xenomai -D_GNU_SOURCE -D_REENTRANT -D__COBALT__ -I${XENO_BASE}/include/xenomai/alchemy")
set(CMAKE_EXE_LINKER_FLAGS "-lalchemy -lcopperplate ${XENO_BASE}/lib/xenomai/bootstrap.o -Wl,--wrap=main -Wl,--dynamic-list=${XENO_BASE}/lib/dynlist.ld -L${XENO_BASE}/lib -lcobalt -lpthread -lrt")
include_directories(${XENO_BASE}/include ${XENO_BASE}/include/cobalt)
link_directories(${XENO_BASE}/lib)
#######################################
#######################################
#######################################
add_executable(example example.c)
#######################################
### Necessary additions for Xenomai ###
#######################################
add_definitions(-D_GNU_SOURCE -D_REENTRANT -D__XENO__ -DNO_GPL)
target_link_libraries(example pthread rt alchemy copperplate cobalt)
#######################################
#######################################
#######################################
Examples
To see how to build and use an actual example Xenomai project with the EMAC SDK, please see the Xenomai Timer Example page. Additionally, Xenomai provides many example projects on their own documentation page.