Difference between revisions of "Beremiz"

From ArmadeusWiki
Jump to: navigation, search
(Install Beremiz_service.py)
(Target connection)
 
(18 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Under_Construction}}
 
 
 
== Introduction ==
 
== Introduction ==
  
Beremiz is free software toolkit for automation. It's conform with [http://en.wikipedia.org/wiki/IEC_61131 IEC61131] languages and can drive graphicaly your system.
+
Beremiz is a Free Software toolkit for automation. It conforms with [http://en.wikipedia.org/wiki/IEC_61131 IEC61131] languages and can graphically drive your system.
 
+
Beremiz is divided in two softwares:
+
  
* '''Beremiz.py''': The Graphical toolkit that run on the Host to drive the target.
+
Beremiz is divided in two software:
* '''Beremiz_service.py''': The target runtime that execute the code compiled by Beremiz.py and sent throught network to its.
+
  
Then there are two triky things to do to use beremiz on APF* platforms :
+
* '''Beremiz.py''': the graphical toolkit that run on the Host to drive the target,
 +
* '''Beremiz_service.py''': the target runtime that execute the code compiled by Beremiz.py and sent to it through network.
  
* Configure Beremiz.py to cross-compile binary for ARM
+
There are two tricky things to do to use Beremiz on APF* platforms :
* Run python program Beremiz_service.py on apf.
+
* configure Beremiz.py to cross-compile binary for ARM,
 +
* run Beremiz_service.py on APF.
  
 
== Installation ==
 
== Installation ==
Line 19: Line 16:
 
=== Host ===
 
=== Host ===
  
To see how to install Beremiz on your host, please see the [http://www.beremiz.org/doc official website] (How to build with Linux).
+
Host part of Beremiz is installable through Armadeus Buildroot menuconfig :
  
=== Target ===
 
 
==== APF28 ====
 
 
Python 2.7 and Pyro are required to run Beremiz_service.py.
 
 
===== install python 2.7 =====
 
run
 
 
<pre class="host">
 
<pre class="host">
make menuconfig
+
$ make menuconfig
 
</pre>
 
</pre>
On up to date armadeus trunk view, then select :
+
 
 +
Then select:
 
<pre class="config">
 
<pre class="config">
Package Selection for the target --->
+
Target packages --->
     Interpreter languages and scripting --->
+
     Development tools --->
         [*] python
+
         [*] matiec
            python module format to install (.py sources only)  --->
+
    ...
                          (X) .py sources only
+
    Graphic libraries and applications (graphic/text)  --->
        core python modules --->
+
        [*] beremiz framework
                    [*] bzip2 module
+
                    [*] bsddb module     
+
                    [*] codecscjk module 
+
                    [*] curses module     
+
                    [*] pyexpat           
+
                    [*] readline         
+
                    [*] ssl               
+
                    [*] unicodedata module
+
                    [*] sqlite module     
+
                    [*] zlib module       
+
                    [*] hashlib module   
+
 
</pre>
 
</pre>
then make :
+
 
 +
* Build/install it:
 
<pre class="host">
 
<pre class="host">
 
$ make
 
$ make
 
</pre>
 
</pre>
  
===== Install Pyro3.14 =====
+
* Then to launch it:
Pyro 3.14 is included under armadeus distribution :
+
 
<pre class="host">
 
<pre class="host">
make menuconfig
+
$ python buildroot/output/host/opt/beremiz/Beremiz.py
 +
</pre>
 +
 
 +
=== Target ===
 +
Python 2.7 and Pyro are required to run Beremiz_service.py:
 +
 
 +
<pre class="host">
 +
$ make menuconfig
 
</pre>
 
</pre>
  
 
<pre class="config">
 
<pre class="config">
Package Selection for the target --->
+
Target packages --->
 +
    ...
 
     Interpreter languages and scripting  --->
 
     Interpreter languages and scripting  --->
 +
        ...
 +
        [*] python
 
         external python modules  --->
 
         external python modules  --->
 +
            ...
 
             [*] python-pyro
 
             [*] python-pyro
 +
</pre>
 +
* then:
 +
<pre class="host">
 +
$ make
 
</pre>
 
</pre>
  
 
===== Install Beremiz_service.py =====
 
===== Install Beremiz_service.py =====
  
Beremiz_service is included in Armadeus distribution (trunk) :
+
<pre class="host">
 +
$ make menuconfig
 +
</pre>
 +
 
 
<pre class="config">
 
<pre class="config">
Package Selection for the target --->
+
Target packages --->
 +
    ...
 
     Graphic libraries and applications (graphic/text)  --->
 
     Graphic libraries and applications (graphic/text)  --->
         [*] Beremiz --->
+
        ...
 +
         [*] Beremiz runtime
 
</pre>
 
</pre>
  
Line 84: Line 83:
  
 
* When Beremiz.py is launched on your Host, create or open a project then save it.
 
* When Beremiz.py is launched on your Host, create or open a project then save it.
* With your favorite editor edit the file beremiz.xml then change the URI line:
+
* in project "Config" tab set the correct "URI_location":
 
+
URI_location: PYRO://192.168.0.33:3000
<source lang="xml">
+
<BeremizRoot URI_location="PYRO://192.168.0.33:3000">
+
</source>
+
  
 
Replace 192.168.0.33 by the IP of your APF28.
 
Replace 192.168.0.33 by the IP of your APF28.
  
* Re-open your project then clic on «connect» icon.
+
* then clic on «connect» icon.
 
* You can compile your project and try to send it...
 
* You can compile your project and try to send it...
* ... but you will have this error :
 
<pre class="apf">
 
PLCobject : OFF LOG :NewPLC (d8ad51386680f2337309dc55eddb4383)
 
python: '/mnt/nfs/beremiz/d8ad51386680f2337309dc55eddb4383.so' is not an ELF executable for ARM
 
PLCobject : Traceback (most recent call last):
 
  File "/mnt/nfs/beremiz/runtime/PLCObject.py", line 135, in LoadPLC
 
    self._PLClibraryHandle = dlopen(self._GetLibFileName())
 
OSError: File not found
 
</pre>
 
 
* Because the defaut compliler for Beremiz.py is not for arm ...
 
 
 
* To configure your compiler, go to project configuration (double clic on head of hierarchy) and adding the path of your compiled armgcc :
 
* To configure your compiler, go to project configuration (double clic on head of hierarchy) and adding the path of your compiled armgcc :
 
  YOUR_ARMADEUS_PATH/buildroot/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-gcc
 
  YOUR_ARMADEUS_PATH/buildroot/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-gcc
 
for linker and compiler.
 
for linker and compiler.
  
* You can then compile and transfert the program to target...
+
* You can then compile and transfer the program to the APF...
* ... but there still an error :
+
<pre class="apf">
+
PLCobject : OFF LOG :NewPLC (d8ad51386680f2337309dc55eddb4383)
+
python: '/mnt/nfs/beremiz/d8ad51386680f2337309dc55eddb4383.so' is not an ELF executable for ARM
+
PLCobject : Traceback (most recent call last):
+
  File "/mnt/nfs/beremiz/runtime/PLCObject.py", line 135, in LoadPLC
+
    self._PLClibraryHandle = dlopen(self._GetLibFileName())
+
OSError: File not found
+
</pre>
+
 
+
* This can be tricky fixed by changing code in beremiz beremiz/targets/Linux/plc_Linux_main.c :
+
<source lang="C">
+
/*
+
long AtomicCompareExchange(long* atomicvar,long compared, long exchange)
+
{
+
    return __sync_val_compare_and_swap(atomicvar, compared, exchange);
+
}
+
long long AtomicCompareExchange64(long long* atomicvar, long long compared, long long exchange)
+
{
+
    return __sync_val_compare_and_swap(atomicvar, compared, exchange);
+
}
+
*/
+
//XXX
+
long AtomicCompareExchange(long* atomicvar,long compared, long exchange)
+
{
+
    long res;
+
 
+
    res=*atomicvar;
+
    if(*atomicvar == compared){
+
        *atomicvar = exchange;
+
    }
+
 
+
    return res;
+
}
+
//XXX
+
long long AtomicCompareExchange64(long long* atomicvar, long long compared, long long exchange)
+
{
+
    long long res;
+
 
+
    res=*atomicvar;
+
    if(*atomicvar == compared){
+
        *atomicvar = exchange;
+
    }
+
 
+
    return res;
+
}
+
</source>
+
  
 
== Links ==
 
== Links ==
 +
* [http://www.beremiz.org/ Home page of project].
  
* [http://www.beremiz.org/ Home page of project].
+
[[Category:Automation]]

Latest revision as of 16:11, 31 July 2014

Introduction

Beremiz is a Free Software toolkit for automation. It conforms with IEC61131 languages and can graphically drive your system.

Beremiz is divided in two software:

  • Beremiz.py: the graphical toolkit that run on the Host to drive the target,
  • Beremiz_service.py: the target runtime that execute the code compiled by Beremiz.py and sent to it through network.

There are two tricky things to do to use Beremiz on APF* platforms :

  • configure Beremiz.py to cross-compile binary for ARM,
  • run Beremiz_service.py on APF.

Installation

Host

Host part of Beremiz is installable through Armadeus Buildroot menuconfig :

$ make menuconfig

Then select:

Target packages  --->
    Development tools  --->
        [*] matiec 
    ...
    Graphic libraries and applications (graphic/text)  --->
        [*] beremiz framework
  • Build/install it:
$ make
  • Then to launch it:
$ python buildroot/output/host/opt/beremiz/Beremiz.py 

Target

Python 2.7 and Pyro are required to run Beremiz_service.py:

$ make menuconfig
Target packages  --->
    ...
    Interpreter languages and scripting  --->
        ...
        [*] python
        external python modules  --->
            ...
            [*] python-pyro
  • then:
$ make
Install Beremiz_service.py
$ make menuconfig
Target packages  --->
    ...
    Graphic libraries and applications (graphic/text)  --->
        ...
        [*] Beremiz runtime

Simple usage

Target connection

  • When Beremiz.py is launched on your Host, create or open a project then save it.
  • in project "Config" tab set the correct "URI_location":
URI_location: PYRO://192.168.0.33:3000

Replace 192.168.0.33 by the IP of your APF28.

  • then clic on «connect» icon.
  • You can compile your project and try to send it...
  • To configure your compiler, go to project configuration (double clic on head of hierarchy) and adding the path of your compiled armgcc :
YOUR_ARMADEUS_PATH/buildroot/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-gcc

for linker and compiler.

  • You can then compile and transfer the program to the APF...

Links