本文是在已經(jīng)打上xenomai補丁的linux-3.8.13-bone86內(nèi)核源碼上進行的,參看使用xenomai與linux內(nèi)核源碼交叉編譯,移植到beaglebone black(AM3358)開發(fā)板上
igh軟件下載地址:
IgH EtherCAT Master for Linux (etherlab.org)
一、準備ethercat-1.5.2源碼
將打入xenomai補丁,寫入sd卡的系統(tǒng)的sd卡掛載(插入電腦,自動掛載)到ubuntu系統(tǒng)
將編譯出的xenomai拷貝到ubuntu系統(tǒng)中
sudo cp -r /media/lemonhack/rootfs/usr/xenomai/ /usr/
下載ethercat源碼
wget https://etherlab.org/download/ethercat/ethercat-1.5.2.tar.bz2
?解壓ethercat源碼
tar -xvf ethercat-1.5.2.tar.bz2
?進入ethercat源碼目錄,創(chuàng)建輸出文件夾,并且賦予相應權限
sudo -i
cd /home/lemonhack/ethercat/ethercat-1.5.2/
mkdir output
chmod 777 output
二、編譯IGH?
安裝編譯igh所需要的依賴
apt-get install autoconf autogen libtool
configure設置
--with-linux-dir:已經(jīng)交叉編譯過的內(nèi)核源碼位置(主機上)
./configure --prefix=/home/lemonhack/ethercat/ethercat-1.5.2/output --with-linux-dir=/home/lemonhack/ethercat/linux-3.8.13-bone86 --enable-rtdm=yes --with-xenomai-dir=/usr/xenomai/ --enable-8139too=no --enable-generic=yes CC=arm-linux-gnueabihf-gcc --host=arm-linux-gnueabihf
?這一步如果使用的是普通用戶來輸入make的話,可能會出現(xiàn)rtdm/rtdm.h,no such file or directory。我的建議是一開始就是用root用戶??赡艹霈F(xiàn)這個錯誤的原因是上一篇文章生成xenomai是使用root用戶生成的,所以現(xiàn)在操作也需要使用root用戶,不然環(huán)境可能不一樣。當然,如果大家由準確的答案,請一定要告知我。
make
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules
make install
mkdir output/modules
cp devices/ec_generic.ko output/modules/
cp master/ec_master.ko output/modules/
將輸出文件打包?
tar -cjf output.tar.bz2 output/
?復制輸出文件到寫入系統(tǒng)根文件的sd卡
cp output.tar.bz2 /media/lemonhack/rootfs/home/debian/
三、在beaglebone black開發(fā)板上加載模塊
將寫入系統(tǒng)根文件的sd卡插入beaglebone black開發(fā)板的microSD Card槽中,啟動beaglebone black開發(fā)板,通過mobaxterm的串口進行顯示
su
tar -jxvf output.tar.bz2
?復制ec_master.ko到指定位置,當前內(nèi)核版本的位置,使用uname -r可知
cp output/modules/ec_master.ko /lib/modules/3.8.13-ipipe/
?depmod(depend module)可檢測模塊的相依性
depmod
復制到相應地方
cp output/etc/init.d/ethercat /etc/init.d/
cp output/bin/ethercat /usr/local/bin/
?復制到相應地方
mkdir /etc/sysconfig
cp output/etc/sysconfig/ethercat /etc/sysconfig/
?配置rules,創(chuàng)建設備號
echo KERNEL==\"EtherCAT[0-9]*\", MODE=\"0664\" > /etc/udev/rules.d/99-EtherCAT.rules
獲取beaglebone black開發(fā)板的MAC地址。MAC地址為f4:b8:98:c8:6a:81
ifconfig
配置主站的MAC地址
modprobe ec_master main_devices=f4:b8:98:c8:6a:81
?啟動EtherCAT
/etc/init.d/ethercat start
?安裝通用網(wǎng)卡驅(qū)動
insmod output/modules/ec_generic.ko
祝你好運!?
四、參考
IgH(Igh EtherCAT Master for Linux)移植到搭載Linux系統(tǒng)的開發(fā)板_end_宿命的博客-CSDN博客文章來源:http://www.zghlxwxcb.cn/news/detail-501363.html
?beaglebone(AM335X)安裝igh-ethercat_拉松的博客-CSDN博客_am3359移植igh文章來源地址http://www.zghlxwxcb.cn/news/detail-501363.html
到了這里,關于IGH(EtherCAT開源主站)移植到beaglebone black(AM3358)開發(fā)板上的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!