Remi Pi采用瑞薩RZ/G2L作為核心處理器,該處理器搭載雙核Cortex-A55@1.2GHz+Cortex-M33@200MHz處理器,其內(nèi)部集成高性能3D加速引擎Mail-G31 GPU(500MHz)和視頻處理單元(支持H.264硬件編解碼),16位的DDR4-1600 / DDR3L-1333內(nèi)存控制器、千兆以太網(wǎng)控制器、USB、CAN、SD卡、MIPI-CSI等外設(shè)接口,在工業(yè)、醫(yī)療、電力等行業(yè)都得到廣泛的應(yīng)用。
在開發(fā)階段,建議配合核心板配套的評估套件 MYD-YG2L23-8E1D-120-C-REMI來加速開發(fā)。
實時內(nèi)核設(shè)計
實時補丁我們選擇RT-Preempt來實現(xiàn)
2.1.移植補丁
RT補丁可以從RT官網(wǎng)下載5.10.83對應(yīng)的補丁
https://cdn.kernel.org/pub/linux/kernel/projects/rt/5.10/older/
把補丁放到自己的工作目錄下,然后解壓,如圖2-1:
hjx@myir-server:~/renesas/04_Sources$ tar -xvf patches-5.10.83-rt58.tar.gz
圖2-1. 內(nèi)核源碼
進入到內(nèi)核源碼打補丁,如圖2-2:
hjx@myir-server:~/renesas/04_Sources/myir-renesas-linux$ for p in `ls -1 ../patches/*.patch`; do patch -p1 < $p; done
圖2-2. 打?qū)崟r補丁
編譯內(nèi)核源碼
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自動調(diào)頻,并設(shè)置主頻為最高頻率:
cd /sys/devices/system/cpu/cpufreq/policy0echo userspace > scaling_governorcat scaling_max_freq > scaling_setspeed
(如不禁用cpufreq調(diào)頻功能,系統(tǒng)會因動態(tài)調(diào)頻產(chǎn)生極大的偶然延遲)
實時性測試
空載測試
cyclictest -p 99 -t 1 -d 100 -i 1000 -D 24h -m -a -n
圖3-1.空載測試
CPU&內(nèi)存滿載
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
圖3-2.滿載測試
數(shù)據(jù)對比:
板卡 | MYD-YG2LX-REMI |
測試時間 | 120min |
指令 | cyclictest &stress-ng |
空載 | 平均 8us 最大 24us |
滿載 | 平均 13us 最大 136us |
表3-1.數(shù)據(jù)信息
EtherCAT IGH移植個標(biāo)題
4.1.下載EtherCAT IGH源碼
到官網(wǎng)下載1.5版本的EtherCAT源碼,如圖4-1:
https://gitlab.com/etherlab.org/ethercat/-/tree/stable-1.5?ref_type=heads
圖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環(huán)境變量
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設(shè)置
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指定內(nèi)核源碼目錄)
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'
編譯通過會對應(yīng)生成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相關(guān)文件打包
在/home/hjx/renesas/04_Sources/ethercat-stable-1.5/output目錄下創(chuàng)建modules文件夾,并復(fù)制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交叉編譯完成,下面是在對應(yīng)arm目標(biāo)板上的操作。
4.5.移植EtherCAT相關(guān)庫到開發(fā)板
將上面制作好的output.tar.bz2傳到開發(fā)板上,然后解壓出來。
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目錄下各文件目錄的內(nèi)容復(fù)制到板子根文件系統(tǒng)根目錄下相應(yīng)目錄下,例如:cp bin/ethercat /bin/(include目錄不用復(fù)制)
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生態(tài)板卡,兼容樹莓派擴展模塊
采用瑞薩RZ/G2L工業(yè)級處理器,便于企業(yè)客戶產(chǎn)品開發(fā);
Remi Pi兼容樹莓派所有配件,方便產(chǎn)品原型搭建和創(chuàng)新應(yīng)用;
更多的工業(yè)接口,兼顧開發(fā)、學(xué)習(xí)和實際應(yīng)用;
軟件系統(tǒng)豐富,支持Debian/Ubuntu/Linux等。
-
處理器
+關(guān)注
關(guān)注
68文章
19259瀏覽量
229651 -
編解碼
+關(guān)注
關(guān)注
1文章
140瀏覽量
19612 -
ethercat
+關(guān)注
關(guān)注
18文章
686瀏覽量
38673 -
米爾電子
+關(guān)注
關(guān)注
0文章
109瀏覽量
449
發(fā)布評論請先 登錄
相關(guān)推薦
評論