[etherlab-users] Etherlab on Odroid U3+ Real Time

Mark Lautermann stay-ml at gmx.net
Wed Feb 18 21:16:51 CET 2015


Hi,

i started playing around wiith patching  the Odroid U3+ kernel and now i 
can run Etherlab with Matlab (R2011a ) code on it inspired by Thomas post.
I describe my way to do this for Kernel 3.8.13.26-rt31 on the odroid 
(except the standard installation procedure)

Odroid:
standard installation of EtherLAB components (i choose the main folder 
/opt/etherlab )
EtherCAT Master:
./configure --enable-generic=yes --enable-8139too=no 
--libdir=/opt/etherlab/lib/arm-linux-gnueabihf
Add in  /etc/sysconfig/ethercat  --> DEVICE_MODULES="generic"

Matlab
copie once the folder from VM or PC to odroid --> /usr/local/MATLAB/R2011a

Project:
After building the project:
only change in Makefile: PLATFORM_LIBDIR into “lib/arm-linux-gnueabihf
then copie the project
I have the same folders on odroid an pc, so i only have to sync the 
folders (owncloud).
     --> /home/ubuntu/project/exec
     project-folder includes .mdl file
     exec-folder is build path of matlab ( before building the proj go 
to "cd  /home/ubuntu/project/exec" in matlab)

now build the project on odroid
--> cd /home/ubuntu/project/exec/[my-project]
--> make clean
--> make

./[my_project]

if this error appears, LD_LIBRARY_PATH is missing
error while loading shared libraries: libpdserv.so.2.0.0: cannot open 
shared object file: No such file or directory
--> export 
LD_LIBRARY_PATH=D_LIBRARY_PATH:/usr/local/lib/arm-linux-gnueabihf/


VM or PC:
i use ubuntu 14.04 LTS 3.2.63-rt92
all standard installation...

My Ethercat modules:

EL2004

	

EL1008

	

EL4024

	

EL3124

	

EL3068

	

EL5152

4xDout

	

8xDin

	

4x 4…20ma Out

	

4x 4…20ma In

	

8x 0…10V In

	

2 Kanal Enc



hopethis is helpfull!

Mark



-------- Weitergeleitete Nachricht --------
Betreff: 	[etherlab-users] Etherlab on BeagleBone Black
Datum: 	Wed, 14 Jan 2015 15:33:03 +0100
Von: 	Thomas Reischl <reischl.tomml at web.de>
An: 	etherlab-users at etherlab.org



Hello everyone,
this is a post for everyone trying to control a plant with Etherlab over 
a BeagleBone Black. I’ll just describe my approach and how it worked 
for me as an example.
I am using an virtual machine (Linux ubuntu 3.13.0-32-generic) to make 
my Simulink model with additional Etherlab blocks and generate the 
C-code. After that, the model should be compiled and executed on the BBB 
(Linux beaglebone 3.8.13-bone47).
Virual Machine requirements:
Matlab/Simulink 2014a
Etherlab 2.1.0 development environment
Etherlab 2.1.0 runtime environment with PdServ and commoncpp2-1.8.1, 
log4cplus-1.1.3-rc2, yaml-0.1.5
EtherCAT-Master 1.5.2
BeagleBone Black requirements:
Etherlab 2.1.0 development environment
Etherlab 2.1.0 runtime environment with PdServ and commoncpp2-1.8.1, 
log4cplus-1.1.3-rc2, yaml-0.1.5
EtherCAT-Master 1.5.2
Etherlab installation:
I did the installation as directed (with default directory: 
/vol/opt/etherlab). Matlab 2014a should be installed 
(“/usr/local/MATLAB/R2014a”) with Simulink and Simulink Coder.
Moreover, gcc and cmake had to be downloaded from the repository for the 
BBB. On my virtual machine they where already available, I think.
--> Install etherlab-2.1.0 (cmake, make, make install)
To install PdServ there are three additional library dependecies: 
Log4cplus Library, CommonCpp2 Library and YAML Library, which can be 
downloaded as tarballs.
Now unzip them and install (tar –xjf for .bz2/ tar –xf for .xz or 
.gz, ./configure, make, make install). On the BBB the installation of 
commoncpp2 was a little tricky, because I got an error saying:
“applog.cpp: In constructor 'ost::logger::logger(const char*, bool)': 
applog.cpp:300:43: error: 'S_IREAD' was not declared in this scope 
applog.cpp:300:53: error: 'S_IWRITE' was not declared in this scope 
applog.cpp:300:61: error: 'mkfifo' was not declared in this scope”
To fix that error I edited the file “/src/applog.cpp” and 
substituted every S_IREAD through S_IRUSR and S_IWRITE through S_IWUSR. 
Additionally, I added “#include <sys/stat.h>” on top of that file. 
(cf. http://www.patrickmin.com/linux/tip.php?name=commoncpp)
Now I was able to install commoncpp2 (./configure, make, make install) 
and after that PdServ (cmake, make, make install).
EtherCAT-Master installation:
Again, I did the installation according to the instruction-pdf. Download 
the tarball and unzip (tar –xjf).
The ./configure call has to be done with some special options, since 
Etherlab and EtherCAT-Master have to be installed into the same 
directory (/vol/opt/etherlab). Furthermore, library paths have to be the 
same as etherlab-library paths (see below the libdir option)
I configured it as follows:
virtual machine:    ./configure --disable-8139too 
--prefix=/vol/opt/etherlab --libdir=/vol/opt/etherlab/lib/x86_64-linux-gnu
BeagleBone:        ./configure --disable-8139too 
--prefix=/vol/opt/etherlab 
--libdir=/vol/opt/etherlab/lib/arm-linux-gnueabihf
These options are important, as the default installation path of the 
EtherCAT-Master is “opt/etherlab” (not “/vol/opt/etherlab”) and 
the default lib-path of EtherCAT-Master is “/opt/etherlab/lib”. The 
last libdir directory is probably different for other systems, so just
have a what your directory in “/vol/opt/etherlab/lib/” after the 
Etherlab installation is called.
If there are missing “linux sources” for configuring I found a 
script generating the for BeagleBone Black: 
http://dumb-looks-free.blogspot.de/2014/06/beaglebone-black-bbb-kernal-headers.html
Now you should be able to install the EtherCAT-Master (./configure ..., 
make, make install, make modules, make modules_install).
To start the EtherCAT-Master just adapt 
“/vol/opt/etherlab/etc/sysconfig/ethercat” and copy it into the 
directory “/etc/sysconfig/” (I had to create /etc/sysconfig at 
first). Start it with ./ethercat start (in directory 
“/vol/opt/etherlab/etc/init.d/”).
At this point you are able to create your simulink model with your 
virtual machine and generate c-code, saved in a directory called 
(MODEL)_etl_hrt. The following files are needed on the BBB to build an 
executable and can be transported via usb-stick (usb-stick appears in 
/media):

+        @\cp $(MODEL).mk $(MODEL)_etl_hrt/

+        @\cp rtw_proj.tmw $(MODEL)_etl_hrt/

+        @\cp *.h $(MODEL)_etl_hrt/

+        @\cp *.c $(MODEL)_etl_hrt/

+        @\cp Makefile $(MODEL)_etl_hrt/

+        @\cp $(MATLAB_ROOT)////simulink/include//*.h $(MODEL)_etl_hrt/simulink/include/

+        @\cp $(MATLAB_ROOT)////extern/include//*.h $(MODEL)_etl_hrt/extern/include/

+        @\cp $(MATLAB_ROOT)////rtw/c/src//*.h $(MODEL)_etl_hrt/rtw/c/src/

+        @\cp $(MATLAB_ROOT)////rtw/c/src//*.c $(MODEL)_etl_hrt/rtw/c/src/

+        @\cp $(MATLAB_ROOT)////rtw/c/tools/unixtools.mk $(MODEL)_etl_hrt/rtw/c/tools//

+        @\cp $(MATLAB_ROOT)////rtw/c/src/ext_mode/common//*.h $(MODEL)_etl_hrt/rtw/c/src/ext_mode/common

+        @\cp $(MATLAB_ROOT)////rtw/c/src/ext_mode/common//*.c $(MODEL)_etl_hrt/rtw/c/src/ext_mode/common

Hints:
- (MODEL) must be exchanged with your model name, of course
- the Makefile is only a link to (MODEL).mk and has the same content.
- MATLAB_ROOT on the virtual machine was in my case 
“/usr/local/MATLAB/R2014a”
I saved these files on my BBB in “/home/debian/(MODEL)_etl_hrt/”. 
Afterwards I had to adapt the variable PLATFORM_LIBDIR into 
“lib/arm-linux-gnueabihf” inside the Makefile. I copied the file 
rtwtypes.h from “/home/debian/(MODEL)_etl_hrt” to 
“home/debian/(MODEL)_etl_hrt/rtw/c/src” and i copied all .h- and 
.c-files from “/home/debian/(MODEL)_etl_hrt” to 
“/vol/opt/etherlab/rtw/src”.
Now it should be possible to create an executable with: “make 
MATLAB_ROOT=/home/debian/(MODEL)_etl_hrt ETHERLAB_DIR=/vol/opt/etherlab”
It normally appears in “/home/debian”.
If “error while loading shared libraries: libccext2-1.8.so.0: cannot 
open shared object file: No such file or directory” appears when 
executing, you have to call “ldconfig” to make shared libraries usable.
This is how it worked for me and I hope it will help other users trying 
something similar.
Best regards,
Thomas




---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
http://www.avast.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20150218/2cda6e46/attachment-0002.htm>
-------------- next part --------------
_______________________________________________
etherlab-users mailing list
etherlab-users at etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users



More information about the Etherlab-users mailing list