Hardware Access in Real-Time for scilab/scicos
sudo suDownload the newest debian package linux-image-3.8.0-42-generic_3.8.0-42.62~precise1_amd64.deb (linux-lts-raring - 3.8.0-42.62~precise1) from https://launchpad.net/ubuntu/precise/amd64/linux-image-3.8.0-42-generic/3.8.0-42.62~precise1 and save it to /usr/src
cd /usr/src/
cvs -d:pserver:anonymous@cvs.gna.org:/cvs/rtai co vulcano
ln -s vulcano rtai
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
cd linux-stable
git branch linux-3.8-rtai origin/linux-3.8.y
git checkout linux-3.8-rtai
git apply ../vulcano/base/arch/x86/patches/hal-linux-3.8.13-x86-4.patch
git commit -a -m 'applied the rtai patch hal-linux-3.8.13-x86-4.patch'
exit
sudo suImportant: It is needed to deselect "Module versioning support" under "Enable loadable module support".
cd /usr/src
dpkg-deb -x linux-image-3.8.0-42-generic_3.8.0-42.62~precise1_amd64.deb linux-image
cp linux-image/boot/config-* linux-stable/.config
cd linux-stable
make menuconfig
make -j `getconf _NPROCESSORS_ONLN` deb-pkg LOCALVERSION=-rtaiNow install linux-image package and the linux-header package with dpkg
exit
cd /usr/srcThe number {x} depends on how many linux-image-3.8.13-rtai and linux-headers-3.8.13-rtai deb packages are in /usr/src.
sudo dpkg -i linux-image-3.8.13-rtai_3.8.13-rtai-{x}_amd64.deb
sudo dpkg -i linux-headers-3.8.13-rtai_3.8.13-rtai-{x}_amd64.deb
uname -rThe output of uname -r should now contain rtai.
cd /usr/src/rtaiEnsure directories are correct:
sudo make menuconfig
sudo nano /usr/src/linux-headers-3.8.13-rtai/arch/x86/Makefileand exchange
KBUILD_CFLAGS += $(call cc-option,-mno-sse -mpreferred-stack-boundary=3)by
KBUILD_CFLAGS += $(call cc-option,-mno-sse)
sudo makenow run export PATH=/usr/realtime/bin:$PATH for each open shell or do logout and login.
sudo make install
sudo sed -i 's/\(PATH=\"\)/\1\/usr\/realtime\/bin:/' /etc/environment
/sbin/insmod /usr/realtime/modules/rtai_smi.koCopy the lines to /usr/local/bin/start_rtai
/sbin/insmod /usr/realtime/modules/rtai_hal.ko
/sbin/insmod /usr/realtime/modules/rtai_lxrt.ko
/sbin/insmod /usr/realtime/modules/rtai_fifos.ko
/sbin/insmod /usr/realtime/modules/rtai_sem.ko
/sbin/insmod /usr/realtime/modules/rtai_mbx.ko
/sbin/insmod /usr/realtime/modules/rtai_msg.ko
/sbin/insmod /usr/realtime/modules/rtai_netrpc.ko
/sbin/insmod /usr/realtime/modules/rtai_shm.ko
sudo apt-get install scilab
cd /usr/local/srcEdit qrtailab.config and replace '/usr/include/qwt/' with '/usr/include/qwt-qt4/' and '-lqwt' with '-lqwt-qt4'
sudo svn checkout http://svn.code.sf.net/p/qrtailab/code/trunk qrtailab
cd qrtailab
sudo qmake-qt4
sudo make
sudo make install
svn checkout http://svn.code.sf.net/p/hart/code/trunk hart-codeGo in your hart-directory.
make
cd /...../scilab-xxx/contrib
sudo ln -s {link to hart-toolbox} .
It is important to add -o to your rtai executable in order get a good realtime! The default setting uses the periodic mode. The hard timer will run in oneshot mode when using the "-o" options, which works better for same systems and slow sampling rates (<10kHz).
Gratulation you are finished!