Igh Etherlab-master安装

来源:互联网 发布:lufylegend.js 编辑:程序博客网 时间:2024/06/05 11:14

在安装好安装环境后,终于可以进行Etherlab-master安装了。这里有一点没有进行考察从官网下的ethercat-1.5.2与etherlabmaster-code间的关系,亟待补充。
前篇:http://blog.csdn.net/allforyouz/article/details/78713453
环境:
安装在VMware中的Ubuntu系统,内核版本3.14.44-xenomai-2.6.5
软件:
etherlabmaster-code.tar.gz

编译igh

首先安装编译该程序的其他依赖

sudo apt-get install autoconf autogen libtool

配置

下载etherlabmaster-code.tar.gz https://github.com/ART-robot/ethercat_install/raw/master/etherlabmaster-code.tar.gz
解压后进入etherlabmaster-code文件夹,执行 ./bootstrap,生成配置文件

然后执行下面命令进行配置

./configure --with-linux-dir=/usr/src/linux-headers-3.14.44-xenomai-2.6.5 --with-module-dir=/lib/modules/3.14.44-xenomai-2.6.5 --enable-generic --enable-rtdm --with-xenomai-dir=/usr/xenomai --enable-cycles --enable-hrtimer --enable-8139too=no

相关配置来自官方说明文档,如图
这里写图片描述
这里写图片描述

编译安装

make #编译用户态的库make modules #编译ethercat驱动sudo su #登录root用户make install #安装库文件make modules_install #安装驱动

配置项

这里与参考文献出现出入,进行修改如下,可以通过 find -name xxxx指令查找后自由修改

cd /etcsudo mkdir sysconfigsudo cp /opt/etherlab/etc/sysconfig/ethercat /etc/sysconfigsudo cp /opt/etherlab/etc/init.d/ethercat /etc/init.dsudo cp /opt/etherlab/etc/ethercat.conf /etc

然后使用ifconfig命令获取到网卡的mac地址,配置2个文件。

/etc/ethercat.conf/etc/sysconfig/ethercat

你需要在上面2个文件中的MASTER0_DEVICE=后添加你的网卡的mac地址形如MASTER0_DEVICE=”b8:ae:ed:7e:6e:66”, 然后把DEVICE_MODULES=添加”generic”或r8169形如DEVICE_MODULES=”generic”

然后执行sudo depmod命令。

运行

通过sudo /etc/init.d/ethercat start启动ethercat通过sudo /etc/init.d/ethercat stop停止ethercat通过sudo /etc/init.d/ethercat restart重新启动ethercat

配置用户态库和依赖

修改ethercat设备权限

cd /etc/udev/rules.d #进入udev rules文件夹sudo vim 99-ethercat.rules #新建一个ethercat的rule文件

在99-ethercat.rules文件中添加下面内容

KERNEL=="EtherCAT[0-9]", MODE="0777"

保存后退出,然后执行

sudo udevadm control --reload-rules 

重启电脑。

配置库
将/opt/etherlab/include下的2个头文件放入/usr/local/include

cp /opt/etherlab/include/* /usr/local/include

将/opt/etherlab/lib下的libethercat.so.1.0.0放入/usr/local/lib

cp /opt/etherlab/lib/libethercat.so.1.0.0 /usr/local/lib

将/opt/etherlab/bin下的ethercat改名为ethercat-tool并放入/usr/local/bin

然后执行ldconfig 确保/usr/local/lib在系统的动态链接库路径里面。

配置cmake
使用sudo apt-get install cmake安装 cmake。

配置实时权限

sudo vim /etc/security/limits.conf

然后在该文件中添加

<username> hard rtprio 99  //你所使用的用户名

其中99为实时调度的优先级最大为139(139为调度程序本身的优先级)。保存后退出,然后重启电脑。 在terminal查看ulimit -Hr是不是为99。

提示为99,设置成功。


这里写图片描述

参考文献

https://github.com/ART-robot/ethercat_install
写的非常棒的一篇教程