This repositiory contains exercises to familiarize with Xenomai 3.1. The exercises are taken from cs.ru.nl, solutions are then added. They have been tested using a 4GB RaspberryPi 4B running Raspbian Buster with with a xenomai kernel 4.19.86 (setup instructions below).
- Getting Started
- Multi Tasking
- Semaphores
- Preemptive Priority-Based Scheduling
- Round Robin Scheduling
- Priority Inversion
- Interrupt Service Routines
♠️ - Measuring Jitter and Latency
♠️ - Programmable LED Clock and Rotating LEDs
♠️
The exercises have been tested using a RaspberryPi 4B running Raspbian Buster with with a xenomai kernel 4.19.86. A prepatched kernel and indepth installation instructions can be found at simplerobot.net, but can be summarize to:
Download and deploy the prepatched kernel:
git clone https://github.com/thanhtam-h/rpi4-xeno3.git
cd rpi4-xeno3/prebuilt
chmod +x deploy.sh
./deploy.sh
Set up the headers:
cd /usr/src/linux-headers-4.19.86-v7l-ipipe
sudo make -i modules_prepare
Disable DWC features which may cause problem for ipipe kernel and modify CPU affinity. This can be adding the following somwhere at the start of /boot/cmdline.txt
(everything containted in this file must be in a single line):
dwc_otg.fiq_enable=0 dwc_otg.fiq_fsm_enable=0 dwc_otg.nak_holdoff=0 isolcpus=0,1 xenomai.supported_cpus=0x3
NOTE: There is a big issue found on 4GB RAM version raspberry pi 4 when using ipipe kernel. A workaround is to limit usable memory to 3GB which can be done can be fixed by adding the following somwhere at the start of /boot/config.txt
:
total_mem = 3072
In order to test whether your kernel is really patched with xenomai, run (after a reboot) the latency test from xenomai tool:
sudo /usr/xenomai/bin/latency