Skip to content

Commit 3a314e0

Browse files
committed
Initial commit
0 parents  commit 3a314e0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+35439
-0
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Dockerfile
2+
LICENSE.txt
3+
Readme.md

Dockerfile

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#use latest armv7hf compatible raspbian OS version from group resin.io as base image
2+
FROM resin/armv7hf-debian
3+
4+
#enable building ARM container on x86 machinery on the web (comment out next line if built on Raspberry)
5+
RUN [ "cross-build-start" ]
6+
7+
#labeling
8+
LABEL maintainer="[email protected]" \
9+
version="V0.9.1.0" \
10+
description="Debian(jessie) with netX real-time ethernet programming examples"
11+
12+
#version
13+
ENV HILSCHERNETPI_NETX_PROGRAMMING_EXAMPLES_VERSION 0.9.1.0
14+
15+
#install ssh, gcc, create user "pi" and make him sudo
16+
RUN apt-get update \
17+
&& apt-get install -y openssh-server build-essential \
18+
&& mkdir /var/run/sshd \
19+
&& useradd --create-home --shell /bin/bash pi \
20+
&& echo 'pi:raspberry' | chpasswd \
21+
&& adduser pi sudo
22+
23+
#create needed folders
24+
RUN mkdir /home/pi/manuals /home/pi/firmwares /home/pi/driver /home/pi/includes /home/pi/sources \
25+
/home/pi/includes/EtherNetIP /home/pi/includes/PROFINET /home/pi/includes/EtherCAT \
26+
/home/pi/devicedescriptions/ \
27+
/home/pi/devicedescriptions/PROFINET \
28+
/home/pi/devicedescriptions/EtherNetIP \
29+
/home/pi/devicedescriptions/EtherCAT \
30+
/home/pi/objs
31+
32+
#set the working directory
33+
WORKDIR /home/pi
34+
35+
#copy the manuals
36+
COPY ./manuals/* manuals/
37+
38+
#copy the firmware packages
39+
COPY ./firmwares/* firmwares/
40+
41+
#copy the netx driver
42+
COPY ./driver/* driver/
43+
44+
#copy the include files
45+
COPY examples/includes/EtherCAT/* includes/EtherCAT/
46+
COPY examples/includes/EtherNetIP/* includes/EtherNetIP/
47+
COPY examples/includes/PROFINET/* includes/PROFINET/
48+
COPY examples/includes/SystemPackets.h includes/
49+
COPY examples/includes/App.h includes/
50+
COPY examples/includes/PacketHandlerPNS.h includes/
51+
COPY examples/includes/PacketHandlerEIS.h includes/
52+
COPY examples/includes/PacketHandlerECS.h includes/
53+
54+
#copy the device description files such as GSDML, EDS
55+
COPY electronic-data-sheets/PROFINET/* devicedescriptions/PROFINET/
56+
COPY electronic-data-sheets/EtherNetIP/* devicedescriptions/EtherNetIP/
57+
COPY electronic-data-sheets/EtherCAT/* devicedescriptions/EtherCAT/
58+
59+
#copy the makefile and the application source codes
60+
COPY examples/Makefile ./
61+
COPY examples/sources/* sources/
62+
63+
#install the driver
64+
RUN dpkg -i ./driver/netx-docker-pi-drv-1.1.3.deb
65+
66+
#compile the applications
67+
RUN make
68+
69+
#SSH port
70+
EXPOSE 22
71+
72+
#the entrypoint shall start ssh
73+
ENTRYPOINT ["/usr/sbin/sshd", "-D"]
74+
75+
#set STOPSGINAL
76+
STOPSIGNAL SIGTERM
77+
78+
#stop processing ARM emulation (comment out next line if built on Raspberry)
79+
RUN [ "cross-build-end" ]

LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2017 - Hilscher Gesellschaft fuer Systemautomation mbH
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
## netX programming examples
2+
3+
Made for [netPI RTE 3](https://www.netiot.com/netpi/), the Open Edge Connectivity Ecosystem with Real-Time Ethernet
4+
5+
### netX sample applications for PROFINET, EtherNet/IP and EtherCAT
6+
7+
Base of this image builds a tagged version of [debian:jessie](https://hub.docker.com/r/resin/armv7hf-debian/tags/) with enabled [SSH](https://en.wikipedia.org/wiki/Secure_Shell) and created user 'pi'.
8+
9+
Additionally the image provides netX programming examples in source code (and as precompiled executables) for
10+
11+
* PROFINET IO device
12+
* EtherNet/IP adapter
13+
* EtherCAT slave
14+
15+
#### Container prerequisites
16+
17+
##### Port mapping
18+
19+
For enabling remote login to the container across SSH the container's SSH port 22 needs to be exposed to the host.
20+
21+
##### Host device
22+
23+
To grant access to the netX from inside the container the `/dev/spidev0.0` host device needs to be added to the container.
24+
25+
#### Getting started
26+
27+
STEP 1. Open netPI's landing page under `https://<netpi's ip address>`.
28+
29+
STEP 2. Click the Docker tile to open the [Portainer.io](http://portainer.io/) Docker management user interface.
30+
31+
STEP 3. Enter the following parameters under **Containers > Add Container**
32+
33+
* **Image**: `hilschernetpi/netpi-netx-programming-examples`
34+
35+
* **Port mapping**: `Host "22" (any unused one) -> Container "22"`
36+
37+
* **Restart policy"** : `always`
38+
39+
* **Runtime > Devices > add device**: `Host "/dev/spidev0.0" -> Container "/dev/spidev0.0"`
40+
41+
STEP 4. Press the button **Actions > Start container**
42+
43+
Pulling the image from Docker Hub may take up to 5 minutes.
44+
45+
#### Accessing
46+
47+
The container starts the SSH service automatically.
48+
49+
Login to it with an SSH client such as [putty](http://www.putty.org/) using netPI's IP address at your mapped port. Use the credentials `pi` as user and `raspberry` as password when asked and you are logged in as non-root user `pi`.
50+
51+
##### Files and folders
52+
53+
The login directs you to the pi user home directory /home/pi with following structure
54+
55+
```
56+
/home/pi/
57+
|
58+
+--/devicedescriptions - device description files such as EDS, GSDML, ESI needed for master engineering
59+
+--/driver - netX driver installation package
60+
+--/firmwares - netX firmware installation packages
61+
+--/includes - protocol specific include files for compilation
62+
+--/manuals - common cifX API manual and protocol specific API manuals
63+
+--/objs - folder where the object files of the compilation process are stored to
64+
+--/sources - protocol specific source codes of the demos
65+
| Makefile - Makefile to compile all example applications using 'make' command
66+
| PNS_simpleConfig - precompiled and executable PROFINET IO device example
67+
| EIS_simpleConfig - precompiled and executable EtherNet/IP adapter example
68+
| ECS_simpleConfig - precompiled and executable EtherCAT slave example
69+
```
70+
##### netX driver installation
71+
72+
To install the netX SPI driver package move to the `driver` folder and call
73+
74+
`dpkg -i netx-docker-pi-drv-1.1.3.deb`
75+
76+
The driver will be installed into the folder `/opt/cifx`.
77+
78+
The cifX API function library needed for linking will be installed into folder `/usr/lib`.
79+
80+
Basic include files needed for the compilation process will be installed into folder `/usr/include`.
81+
82+
##### netX firmware installation
83+
84+
To install a firmware package move to the folder `firmwares` and call
85+
86+
* `dpkg -i netpi-docker-pi-pns-3.12.0.2.deb` for PROFINET IO device firmware or
87+
* `dpkg -i netpi-docker-pi-eis-2.12.5.0.deb` for EtherNet/IP adapter firmware or
88+
* `dpkg -i netpi-docker-pi-ecs-4.7.0.2.deb` for EtherCAT slave firmware
89+
90+
Any firmware package extracts its firmware into the folder `/opt/cifx/deviceconfig/FW/channel0`.
91+
92+
The firmware will be loaded by the driver into netX the first time the driver is accessed with `cifXDriverInit()` command.
93+
94+
There can be only one installed firmware package at a time. An existing package will be automatically uninstalled during installation.
95+
96+
##### Compiling the programming examples
97+
98+
To compile the programming examples simply call `make` in the pi home directory. The command will locate the `Makefile` which initiates the compilation process.
99+
100+
The following executables will be compiled
101+
102+
* `PNS_simpleConfig` as PROFINET IO device demo
103+
* `EIS_simpleConfig` as EtherNet/IP adapter demo
104+
* `ECS_simpleConfig` as EtherCAT slave demo
105+
106+
You may be faced with the following warning during compilation process
107+
108+
`make: warning: Clock skew detected. Your build may be incomplete.`
109+
110+
There is a discrepancy between netPI's system clock and the time the executeables/object files have been generated. Call `make clean` and remove the executeable. Then start the compilation process again. Make also sure you have set netPI's system clock correctly.
111+
112+
##### Starting the executables
113+
114+
To start the compiled examples call the following executeables in the pi home directory
115+
116+
* `sudo ./PNS_simpleConfig` for the PROFINET IO device example
117+
* `sudo ./EIS_simpleConfig` for the EtherNet/IP adapter example
118+
* `sudo ./ECS_simpleConfig` for the EtherCAT slave example
119+
120+
The examples check if the corresponding firmware package has been installed properly, if not they install it automatically.
121+
122+
##### Linking the cifX library to applications
123+
124+
To link the cifX driver library to own applications just add the option `-lcifx` to your GCC compilation command.
125+
126+
##### The cifX API reference (netX driver API)
127+
128+
The cifX driver function API is described in the manual
129+
130+
`cifX_API_PR_04_EN.pdf`
131+
132+
located in the `manuals` folder.
133+
134+
##### The protocol specific APIs (PROFINET, EtherNet/IP ... APIs)
135+
136+
A netX firmware has a common part that is behaving the same for all firmwares and a protocol dependent specific part. Particularly the configuration varies from protocol to protocol and shows different characteristics.
137+
138+
The protocol specific dependencies are described in these manuals
139+
140+
* `PROFINET_IO-Device_V3.12_Protocol_API_17_EN.pdf` for PROFINET IO device
141+
* `EtherNetIP_Adapter_Protocol_API_19_EN.pdf` for EtherNet/IP adapter
142+
* `EtherCAT Slave V4 Protocol API 09 EN.pdf` for EtherCAT slave
143+
144+
located in the `manuals` folder.
145+
146+
#### Tags
147+
148+
* **hilscher/netPI-net-programming-examples:latest** - non-versioned latest development output of the master branch. Can run on any netPI RTE 3 system software version.
149+
150+
#### GitHub sources
151+
152+
The image is built from the GitHub project [netPI-netx-programming-examples](https://github.com/Hilscher/netPI-netx-programming-examples). It complies with the [Dockerfile](https://docs.docker.com/engine/reference/builder/) method to build a Docker image [automated](https://docs.docker.com/docker-hub/builds/).
153+
154+
To build the container for an ARM CPU on [Docker Hub](https://hub.docker.com/)(x86 based) the Dockerfile uses the method described here [resin.io](https://resin.io/blog/building-arm-containers-on-any-x86-machine-even-dockerhub/).
155+
156+
[![N|Solid](http://www.hilscher.com/fileadmin/templates/doctima_2013/resources/Images/logo_hilscher.png)](http://www.hilscher.com) Hilscher Gesellschaft fuer Systemautomation mbH www.hilscher.com

driver/netx-docker-pi-drv-1.1.3.deb

91.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)