- Main
- Tutorials
- Library
- Samples

How to build Xenomai C sample codes

Tutorial to build the Xenomai C sample code.

# Xenomai

## Introduction

Xenomai brings POSIX and traditional RTOS APIs for porting time-critical applications to Linux-based platforms. When the native Linux kernel cannot meet the response time requirements of the application, Xenomai supplements it with Cobalt, a small real-time infrastructure which schedules time-critical activities independently from the main kernel logic.

# To build the C sample code

## Using native toolchain

1. Copy sample.tar.gz contained in the programing guide from your PC to ioThinx:
   For example, if the IP address of the ioThinx is "192.168.127.254", use the following command:
   1 user@Linux:~$ scp sample.tar.gz moxa@192.168.127.254:~
2. Extract the sample code
   1 moxa@Moxa:~$ tar zxvf sample.tar.gz
3. Build Xenomai sample code
   1 moxa@Moxa:~$ cd sample/iothinx/c
   2 moxa@Moxa:~/sample/iothinx/c$ ln -s toolchain-config-native-xenomai config.mk
   3 moxa@Moxa:~/sample/iothinx/c$ cd api/xenomai
   4 moxa@Moxa:~/sample/iothinx/c/api/xenomai$ make
4. Run the program
   1 moxa@Moxa:~/sample/iothinx/c/api/xenomai$ sudo ./scheduling_jitter -h

## Using cross toolchain

1. Copy sample.tar.gz contained in the programing guide to your PC
2. Extract the sample code
   1 user@Linux:~$ tar zxvf sample.tar.gz
3. Build Xenomai sample code
   1 user@Linux:~$ cd sample/iothinx/c
   2 user@Linux:~/sample/iothinx/c$ ln -s toolchain-config-cross-xenomai config.mk
   3 user@Linux:~/sample/iothinx/c$ cd api/xenomai
   4 user@Linux:~/sample/iothinx/c/api/xenomai$ make
4. Copy the sample program to ioThinx:
   For example, if the IP address of the ioThinx is "192.168.127.254", use the following command:
   1 user@Linux:~/sample/iothinx/c/api/xenomai$ scp scheduling_jitter moxa@192.168.127.254:~
5. Run the program on ioThinx
   1 moxa@Moxa:~$ sudo ./scheduling_jitter -h