- Main
- Tutorials
- Library
- Samples

- File List
- Globals

tutorial/iothinx/c/xenomai.md
Go to the documentation of this file.
1 How to build Xenomai C sample codes {#xenomai}
2 ----
3 @brief Tutorial to build the Xenomai C sample code.
4
5 # Xenomai
6
7 ## Introduction
8
9 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.
10
11 # To build the C sample code
12
13 ## Using native toolchain
14
15 1. Copy sample.tar.gz contained in the programing guide from your PC to ioThinx:\n
16 For example, if the IP address of the ioThinx is "192.168.127.254", use the following command:
17 ```
18 user@Linux:~$ scp sample.tar.gz moxa@192.168.127.254:~
19 ```
20 2. Extract the sample code
21 ```
22 moxa@Moxa:~$ tar zxvf sample.tar.gz
23 ```
24 3. Build Xenomai sample code
25 ```
26 moxa@Moxa:~$ cd sample/iothinx/c
27 moxa@Moxa:~/sample/iothinx/c$ ln -s toolchain-config-native-xenomai config.mk
28 moxa@Moxa:~/sample/iothinx/c$ cd api/xenomai
29 moxa@Moxa:~/sample/iothinx/c/api/xenomai$ make
30 ```
31 4. Run the program
32 ```
33 moxa@Moxa:~/sample/iothinx/c/api/xenomai$ sudo ./scheduling_jitter -h
34 ```
35
36 ## Using cross toolchain
37
38 1. Copy sample.tar.gz contained in the programing guide to your PC
39 2. Extract the sample code
40 ```
41 user@Linux:~$ tar zxvf sample.tar.gz
42 ```
43 3. Build Xenomai sample code
44 ```
45 user@Linux:~$ cd sample/iothinx/c
46 user@Linux:~/sample/iothinx/c$ ln -s toolchain-config-cross-xenomai config.mk
47 user@Linux:~/sample/iothinx/c$ cd api/xenomai
48 user@Linux:~/sample/iothinx/c/api/xenomai$ make
49 ```
50 4. Copy the sample program to ioThinx:\n
51 For example, if the IP address of the ioThinx is "192.168.127.254", use the following command:
52 ```
53 user@Linux:~/sample/iothinx/c/api/xenomai$ scp scheduling_jitter moxa@192.168.127.254:~
54 ```
55 5. Run the program on ioThinx
56 ```
57 moxa@Moxa:~$ sudo ./scheduling_jitter -h
58 ```