0
  • 聊天消息
  • 系统消息
  • 评论与回复
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
创作中心

完善资料让更多小伙伴认识你,还能领取20积分哦,立即完善>

3天内不再提示

米尔Remi Pi 实时系统与EtherCAT移植

米尔电子 2024-04-18 08:01 次阅读

Remi Pi采用瑞萨RZ/G2L作为核心处理器,该处理器搭载双核Cortex-A55@1.2GHz+Cortex-M33@200MHz处理器,其内部集成高性能3D加速引擎Mail-G31 GPU(500MHz)和视频处理单元(支持H.264硬件编解码),16位的DDR4-1600 / DDR3L-1333内存控制器、千兆以太网控制器、USBCANSD卡、MIPI-CSI等外设接口,在工业、医疗、电力等行业都得到广泛的应用。

在开发阶段,建议配合核心板配套的评估套件 MYD-YG2L23-8E1D-120-C-REMI来加速开发。

实时内核设计

实时补丁我们选择RT-Preempt来实现

2.1.移植补丁

RT补丁可以从RT官网下载5.10.83对应的补丁

https://cdn.kernel.org/pub/linux/kernel/projects/rt/5.10/older/

d40d5f7e-fd16-11ee-9118-92fbcf53809c.png

把补丁放到自己的工作目录下,然后解压,如图2-1:

hjx@myir-server:~/renesas/04_Sources$ tar -xvf patches-5.10.83-rt58.tar.gz

d415fdd2-fd16-11ee-9118-92fbcf53809c.png图2-1. 内核源码

进入到内核源码打补丁,如图2-2:

hjx@myir-server:~/renesas/04_Sources/myir-renesas-linux$ for p in `ls -1 ../patches/*.patch`; do patch -p1 < $p; done

d41cc518-fd16-11ee-9118-92fbcf53809c.png图2-2. 打实时补丁

编译内核源码

hjx@myir-server:~/renesas/04_Sources/myir-renesas-linux$ /opt/remi-sdk/environment-setup-aarch64-poky-linuxhjx@myir-server:~/renesas/04_Sources/myir-renesas-linux$ make ARCH=arm64 mys_g2lx_defconfighjx@myir-server:~/renesas/04_Sources/myir-renesas-linux$ make ARCH=arm64 Image dtbs -j16

更新编译得到的Image即可

2.2.其他影响性能的配置

禁用CPUFreq自动调频,并设置主频为最高频率:

cd /sys/devices/system/cpu/cpufreq/policy0echo userspace > scaling_governorcat scaling_max_freq > scaling_setspeed

(如不禁用cpufreq调频功能,系统会因动态调频产生极大的偶然延迟)

实时性测试

空载测试

cyclictest -p 99 -t 1 -d 100 -i 1000 -D 24h -m -a -n

d42e30be-fd16-11ee-9118-92fbcf53809c.png图3-1.空载测试

CPU&内存满载

cyclictest -p 99 -t 1 -d 100 -i 1000 -D 24h -m -a -n

增加压力

stress-ng --cpu 4 --cpu-method all --io 4 --vm 50 -d 5 --fork 4 --timeout 36000s

d435a65a-fd16-11ee-9118-92fbcf53809c.png图3-2.满载测试

数据对比:

板卡

MYD-YG2LX-REMI

测试时间

120min

指令

cyclictest &stress-ng

空载

平均 8us

最大 24us

满载

平均 13us

最大 136us

表3-1.数据信息


EtherCAT IGH移植个标题

4.1.下载EtherCAT IGH源码

到官网下载1.5版本的EtherCAT源码,如图4-1:

https://gitlab.com/etherlab.org/ethercat/-/tree/stable-1.5?ref_type=heads

d440a0be-fd16-11ee-9118-92fbcf53809c.png图4-1. 下载源码

解压EtherCAT源码

hjx@myir-server:~/renesas/04_Sources$ tar -xvf ethercat-stable-1.5.tar.bz2hjx@myir-server:~/renesas/04_Sources$ cd ethercat-stable-1.5

加载sdk环境变量

hjx@myir-server:~/renesas/04_Sources/myir-renesas-linux$ source /opt/remi-sdk/environment-setup-aarch64-poky-linux

4.2.编译EtherCAT源码

生成configure文件

hjx@myir-server:~/renesas/04_Sources/ethercat-stable-1.5$ ./bootstrap+ touch ChangeLog+ mkdir -p m4+ autoreconf -ilibtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'autoconf'.libtoolize: copying file 'autoconf/ltmain.sh'libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.libtoolize: copying file 'm4/libtool.m4'libtoolize: copying file 'm4/ltoptions.m4'libtoolize: copying file 'm4/ltsugar.m4'libtoolize: copying file 'm4/ltversion.m4'libtoolize: copying file 'm4/lt~obsolete.m4'configure.ac installing 'autoconf/ar-lib'configure.ac installing 'autoconf/compile'configure.ac installing 'autoconf/config.guess'configure.ac installing 'autoconf/config.sub'configure.ac installing 'autoconf/install-sh'configure.ac installing 'autoconf/missing'examples/dc_user/Makefile.am: installing 'autoconf/depcomp'

configure设置

hjx@myir-server:~/renesas/04_Sources/ethercat-stable-1.5$mkdiroutputhjx@myir-server:~/renesas/04_Sources/ethercat-stable-1.5$ ./configure --prefix=/home/hjx/renesas/04_Sources/ethercat-stable-1.5/output --with-linux-dir=/home/hjx/renesas/04_Sources/myir-renesas-linux --enable-8139too=no --enable-generic=yes --host=aarch64-poky-linux

(--prefix=/home/hjx/renesas/04_Sources/output 指定输出目录、--with-linux-dir=/home/hjx/renesas/04_Sources/myir-renesas-linux指定内核源码目录)

configure: loading site script /opt/remi-sdk/site-config-aarch64-poky-linuxchecking for a BSD-compatible install... /usr/bin/install -cchecking whether build environment is sane... yeschecking for aarch64-poky-linux-strip... aarch64-poky-linux-stripchecking for a thread-safe mkdir -p... /bin/mkdir -pchecking for gawk... gawkchecking whether make sets $(MAKE)... yeschecking whether make supports nested variables... yeschecking whether make supports nested variables... (cached) yeschecking for a sed that does not truncate output... (cached) sedchecking for aarch64-poky-linux-pkg-config... nochecking for pkg-config... /opt/remi-sdk/sysroots/x86_64-pokysdk-linux/usr/bin/pkg-configchecking pkg-config is at least version 0.9.0... yeschecking whether make supports the include directive... yes (GNU style).........................config.status: creating examples/xenomai/Makefileconfig.status: creating examples/xenomai_posix/Makefileconfig.status: creating include/Makefileconfig.status: creating lib/Makefileconfig.status: creating lib/libethercat.pcconfig.status: creating master/Kbuildconfig.status: creating master/Makefileconfig.status: creating script/Makefileconfig.status: creating script/init.d/Makefileconfig.status: creating script/init.d/ethercatconfig.status: creating script/sysconfig/Makefileconfig.status: creating tool/Makefileconfig.status: creating tty/Kbuildconfig.status: creating tty/Makefileconfig.status: creating config.hconfig.status: executing depfiles commandsconfig.status: executing libtool commands

编译源码

hjx@myir-server:~/renesas/04_Sources/ethercat-stable-1.5$ makemake all-recursivemake[1]: Entering directory '/home/hjx/renesas/04_Sources/ethercat-stable-1.5'Making all in includemake[2]: Entering directory '/home/hjx/renesas/04_Sources/ethercat-stable-1.5/include'make[2]: Nothing to be done for 'all'.make[2]: Leaving directory '/home/hjx/renesas/04_Sources/ethercat-stable-1.5/include'Making all in scriptmake[2]: Entering directory '/home/hjx/renesas/04_Sources/ethercat-stable-1.5/script'Making all in init.dmake[3]: Entering directory '/home/hjx/renesas/04_Sources/ethercat-stable-1.5/script/init.d'make[3]: Nothing to be done for 'all'.make[3]: Leaving directory '/home/hjx/renesas/04_Sources/ethercat-stable-1.5/script/init.d'Making all in sysconfigmake[3]: Entering directory '/home/hjx/renesas/04_Sources/ethercat-stable-1.5/script/sysconfig'make[3]: Nothing to be done for 'all'.make[3]: Leaving directory '/home/hjx/renesas/04_Sources/ethercat-stable-1.5/script/sysconfig'............make[3]: Leaving directory '/home/hjx/renesas/04_Sources/ethercat-stable-1.5/examples/user'make[3]: Entering directory '/home/hjx/renesas/04_Sources/ethercat-stable-1.5/examples'make[3]: Nothing to be done for 'all-am'.make[3]: Leaving directory '/home/hjx/renesas/04_Sources/ethercat-stable-1.5/examples'make[2]: Leaving directory '/home/hjx/renesas/04_Sources/ethercat-stable-1.5/examples'make[2]: Entering directory '/home/hjx/renesas/04_Sources/ethercat-stable-1.5'make[2]: Leaving directory '/home/hjx/renesas/04_Sources/ethercat-stable-1.5'make[1]: Leaving directory '/home/hjx/renesas/04_Sources/ethercat-stable-1.5'

编译modules

hjx@myir-server:~/renesas/04_Sources/ethercat-stable-1.5$ make modulesmake[1]: Entering directory '/home/hjx/renesas/04_Sources/myir-renesas-linux'CC [M] /home/hjx/renesas/04_Sources/ethercat-stable-1.5/examples/mini/mini.oLD [M] /home/hjx/renesas/04_Sources/ethercat-stable-1.5/examples/mini/ec_mini.oCC [M] /home/hjx/renesas/04_Sources/ethercat-stable-1.5/master/cdev.oCC [M] /home/hjx/renesas/04_Sources/ethercat-stable-1.5/master/coe_emerg_ring.oCC [M] /home/hjx/renesas/04_Sources/ethercat-stable-1.5/master/datagram.o.......................make[1]: Leaving directory '/home/hjx/renesas/04_Sources/myir-renesas-linux'

编译通过会对应生成ethercat-stable-1.5/devices/ec_generic.ko和ethercat-stable-1.5/master/ec_master.ko

4.3.安装EtherCAT

安装成功后前面指定/home/hjx/renesas/04_Sources/ethercat-stable-1.5/output目录下有编译生成的各种用户空间的文件。

hjx@myir-server:~/renesas/04_Sources/ethercat-stable-1.5$ make installMaking install in includemake[1]: Entering directory '/home/hjx/renesas/04_Sources/ethercat-stable-1.5/include'make[2]: Entering directory '/home/hjx/renesas/04_Sources/ethercat-stable-1.5/include'make[2]: Nothing to be done for 'install-exec-am'./bin/mkdir -p '/home/hjx/renesas/04_Sources/ethercat-stable-1.5/output/include'/usr/bin/install -c -m 644 ecrt.h ectty.h '/home/hjx/renesas/04_Sources/ethercat-stable-1.5/output/include'make[2]: Leaving directory '/home/hjx/renesas/04_Sources/ethercat-stable-1.5/include'make[1]: Leaving directory '/home/hjx/renesas/04_Sources/ethercat-stable-1.5/include'Making install in scriptmake[1]: Entering directory '/home/hjx/renesas/04_Sources/ethercat-stable-1.5/script'Making install in init.dmake[2]: Entering directory '/home/hjx/renesas/04_Sources/ethercat-stable-1.5/script/init.d'make[3]: Entering directory '/home/hjx/renesas/04_Sources/ethercat-stable-1.5/script/init.d'make[3]: Nothing to be done for 'install-exec-am'......................make[3]: Leaving directory '/home/hjx/renesas/04_Sources/ethercat-stable-1.5/examples'make[2]: Leaving directory '/home/hjx/renesas/04_Sources/ethercat-stable-1.5/examples'make[1]: Leaving directory '/home/hjx/renesas/04_Sources/ethercat-stable-1.5/examples'make[1]: Entering directory '/home/hjx/renesas/04_Sources/ethercat-stable-1.5'make[2]: Entering directory '/home/hjx/renesas/04_Sources/ethercat-stable-1.5'make[2]: Nothing to be done for 'install-exec-am'.make[2]: Nothing to be done for 'install-data-am'.make[2]: Leaving directory '/home/hjx/renesas/04_Sources/ethercat-stable-1.5'make[1]: Leaving directory '/home/hjx/renesas/04_Sources/ethercat-stable-1.5'

4.4.将EtharCAT相关文件打包

在/home/hjx/renesas/04_Sources/ethercat-stable-1.5/output目录下创建modules文件夹,并复制ec_generic.ko和ec_master.ko到modules下

hjx@myir-server:~/renesas/04_Sources/ethercat-stable-1.5$ mkdir -p output/moduleshjx@myir-server:~/renesas/04_Sources/ethercat-stable-1.5$ cp devices/ec_generic.ko output/modules/hjx@myir-server:~/renesas/04_Sources/ethercat-stable-1.5$ cp master/ec_master.ko output/modules/hjx@myir-server:~/renesas/04_Sources/ethercat-stable-1.5$ ls outputbin etc include lib modules sbin share

压缩output输出文件

hjx@myir-server:~/renesas/04_Sources/ethercat-stable-1.5$ tar -jcvf output.tar.bz2 output/ output/output/etc/output/etc/ethercat.confoutput/etc/init.d/output/etc/init.d/ethercatoutput/etc/sysconfig/output/etc/sysconfig/ethercatoutput/sbin/output/sbin/ethercatctloutput/include/output/include/ectty.houtput/include/ecrt.houtput/modules/output/modules/ec_master.kooutput/modules/ec_generic.kooutput/share/output/share/bash-completion/output/share/bash-completion/completions/output/share/bash-completion/completions/ethercatoutput/bin/output/bin/ethercatoutput/lib/output/lib/libethercat.sooutput/lib/pkgconfig/output/lib/pkgconfig/libethercat.pcoutput/lib/libethercat.so.1.2.0output/lib/cmake/output/lib/cmake/ethercat/output/lib/cmake/ethercat/ethercat-config.cmakeoutput/lib/libethercat.aoutput/lib/libethercat.laoutput/lib/libethercat.so.1hjx@myir-server:~/renesas/04_Sources/ethercat-stable-1.5$ ls output.tar.bz2output.tar.bz2

至此IGH交叉编译完成,下面是在对应arm目标板上的操作。

4.5.移植EtherCAT相关库到开发板

将上面制作好的output.tar.bz2传到开发板上,然后解压出来。

root@myir-remi-1g:~# tar -xvf output.tar.bz2output/output/etc/output/etc/ethercat.confoutput/etc/init.d/output/etc/init.d/ethercatoutput/etc/sysconfig/output/etc/sysconfig/ethercatoutput/sbin/output/sbin/ethercatctloutput/include/output/include/ectty.houtput/include/ecrt.houtput/modules/output/modules/ec_master.kooutput/modules/ec_generic.kooutput/share/output/share/bash-completion/output/share/bash-completion/completions/output/share/bash-completion/completions/ethercatoutput/bin/output/bin/ethercatoutput/lib/output/lib/libethercat.sooutput/lib/pkgconfig/output/lib/pkgconfig/libethercat.pcoutput/lib/libethercat.so.1.2.0output/lib/cmake/output/lib/cmake/ethercat/output/lib/cmake/ethercat/ethercat-config.cmakeoutput/lib/libethercat.aoutput/lib/libethercat.laoutput/lib/libethercat.so.1

将output目录下各文件目录的内容复制到板子根文件系统根目录下相应目录下,例如:cp bin/ethercat /bin/(include目录不用复制)

root@myir-remi-1g:~/output# lsbin etc include lib modules sbin shareroot@myir-remi-1g:~/output# cp bin/ethercat /bin/root@myir-remi-1g:~/output# cp etc/ethercat.conf /etc/root@myir-remi-1g:~/output# cp etc/init.d/* /etc/init.droot@myir-remi-1g:~/output# cp -r etc/sysconfig/ /etc/root@myir-remi-1g:~/output# cp lib/libethercat.* /lib64/root@myir-remi-1g:~/output# cp -r lib/pkgconfig /lib64/root@myir-remi-1g:~/output# cp modules/ec_master.ko /lib/modules/5.10.83-cip1-yocto-standard/root@myir-remi-1g:~/output# cp sbin/ethercatctl /sbin/

4.6.启动EtherCAT

4.6.1.配置主站的MAC地址

root@myir-remi-1g:~# depmodroot@myir-remi-1g:~# modprobe ec_master main_devices=1E191A:B3

4.6.2.启动EtherCAT

root@myir-remi-1g:~# /etc/init.d/ethercat startStarting EtherCAT master 1.5.2 done

至此所有步骤完成。


米尔瑞米派 Remi Pi

瑞萨第一款MPU生态板卡,兼容树莓派扩展模块

采用瑞萨RZ/G2L工业级处理器,便于企业客户产品开发;

Remi Pi兼容树莓派所有配件,方便产品原型搭建和创新应用;

更多的工业接口,兼顾开发、学习和实际应用;

软件系统丰富,支持Debian/Ubuntu/Linux等。

d45263e4-fd16-11ee-9118-92fbcf53809c.png

声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
  • 处理器
    +关注

    关注

    68

    文章

    18304

    浏览量

    222347
  • 编解码
    +关注

    关注

    1

    文章

    138

    浏览量

    19340
  • ethercat
    +关注

    关注

    17

    文章

    442

    浏览量

    37694
  • 米尔电子
    +关注

    关注

    0

    文章

    63

    浏览量

    364
收藏 人收藏

    评论

    相关推荐

    开放式高实时高性能PLC控制器解决方案-基于米尔电子STM32MP135

    实时高性能需求尤其突出。面对以上挑战,合作伙伴翌控科技基于米尔STM32MP135开发板发布开放式高实时高性能PLC控制器解决方案,将高精准数据采集、预处理、存储、通信与高实时控制融为
    发表于 03-07 20:06

    米尔-瑞米派兼容树莓派扩展模块-试用体验】基于ROS系统的三麦轮小车自主导航

    1、前言 非常感谢myir和电子发烧友举办的米尔Remi Pi瑞米派开发板的试用活动。作为一名研发工程师,我一直对新技术和产品充满了好奇心和热情。能够参与这样的活动,不仅能够拓宽我的技术视野,也能够
    发表于 04-16 22:51

    米尔-瑞米派兼容树莓派扩展模块-试用体验】初始开发板_米尔-瑞米派兼容树莓派扩展模块

    收到米尔-瑞米派兼容树莓派扩展模块几天了,今天抽时间给大家介绍一下这块生态板,让大家有对这块米尔-瑞米派兼容树莓派扩展模块有一些初步的认识,先来简单介绍这块生态板。 瑞米派(Remi Pi
    发表于 04-29 11:42

    米尔-瑞米派兼容树莓派扩展模块-试用体验】用视频来了解这块生态板_米尔-瑞米派兼容树莓派扩展模块

    今天为大家展示一下初始开发板_米尔-瑞米派兼容树莓派扩展模块, 米尔-瑞米派兼容树莓派扩展模块介绍如下: 瑞米派(Remi Pi)基于RZ/G2L处理器,配备Cortex-A55@1.
    发表于 04-29 11:51

    米尔-瑞米派兼容树莓派扩展模块-试用体验】米尔瑞米派Remi Pi系统Ethercat移植

    米尔瑞米派** Remi Pi** 瑞萨第一款MPU生态板卡,兼容树莓派扩展模块 采用瑞萨RZ/G2L工业级处理器,便于企业客户产品开发; Remi
    发表于 04-29 12:04

    瑞米派实时系统EtherCAT移植-米尔Remi Pi

    米尔瑞米派 Remi Pi瑞萨第一款MPU生态板卡,兼容树莓派扩展模块采用瑞萨RZ/G2L工业级处理器,便于企业客户产品开发;Remi Pi
    发表于 04-30 18:14

    EtherCAT 技术

    本帖最后由 sinap_zhj 于 2016-1-20 07:58 编辑 EtherCAT(以太网控制自动化技术)是一个以以太网为基础的开放架构的现场总线系统EtherCAT名称中的CAT为
    发表于 01-16 08:52

    米尔推出基于全志T507-H的MYC-YT507H核心板

    总线,专用于运动控制领域。相比传统的工业现场总线,EtherCAT具有高稳定性、高实时性、高集成度、扩展性强、便于安装等诸多优点,突破了传统以太网方案的系统限制被广泛应用于工业控制领域
    发表于 02-14 15:19

    ch32v208的实时性问题

    今天在ethercat基础上移植蓝牙从机,使用tmos调度系统,创建了ethercat的运行任务,由于ethercat主站
    发表于 05-04 19:29

    实时操作系统到Linux系统移植

    从一个操作系统到另一个操作系统应用程序的移植即使在最好的情况下也经常是一个艰巨的任务。把一个实时的嵌入式应用程序移植到一个新的操作
    发表于 05-06 10:27 1176次阅读

    KPA EtherCAT主站软件如何做移植测试

    虹科KPA EtherCAT主站是一款协议栈产品,能够使用户快速利用EtherCAT技术的所有好处,例如实时操作、极短的循环时间、以及最低成本的最高性能。该协议栈的先进架构专注于可移植
    的头像 发表于 05-18 15:54 3300次阅读

    米尔基于瑞萨RZ/G2L开发板在工控领域的应用-基于SOEM的EtherCAT主站

    本文介绍【米尔MYD-YG2LX开发板】在工控领域的应用,实现基于SOEM的EtherCAT主站。开发环境基于WSL2。
    的头像 发表于 08-24 18:57 541次阅读
    <b class='flag-5'>米尔</b>基于瑞萨RZ/G2L开发板在工控领域的应用-基于SOEM的<b class='flag-5'>EtherCAT</b>主站

    米尔电子和瑞萨电子推出首款MPU生态开发板瑞米派

    近日,米尔电子和瑞萨电子共同定义和开发了瑞萨第一款MPU生态开发板——瑞米派(Remi Pi)正式上市了!在各种Pi板卡琳琅满目的当下,Remi
    的头像 发表于 01-25 09:21 490次阅读

    米尔更新面向工业产品的软件系统-基于瑞米派(Remi Pi

    米尔电子发布的瑞萨第一款MPU生态板卡——瑞米派(Remi Pi)自上市 当天200套售罄 ,获得不少新老用户的青睐。为感谢大家的支持,米尔 加推300套 瑞米派活动,以 补贴价 回馈
    的头像 发表于 03-15 18:25 563次阅读
    <b class='flag-5'>米尔</b>更新面向工业产品的软件<b class='flag-5'>系统</b>-基于瑞米派(<b class='flag-5'>Remi</b> <b class='flag-5'>Pi</b>)

    米尔瑞米派Remi Pi Ubuntu系统移植指南

    的传统的桌面系统也加入到嵌入式环境体系中,如Ubuntu,debian等,为嵌入式提供更方便实用的系统。本文主要介绍基于ubuntu22.04core和米尔核心板定制
    的头像 发表于 04-29 08:01 267次阅读
    <b class='flag-5'>米尔</b>瑞米派<b class='flag-5'>Remi</b> <b class='flag-5'>Pi</b> Ubuntu<b class='flag-5'>系统</b><b class='flag-5'>移植</b>指南