LoginSignup
1
0
この記事誰得? 私しか得しないニッチな技術で記事投稿!

Make and install a [EtheCAT] tool, [siitool]. I tried to check some options.

Last updated at Posted at 2018-01-17

We can download Ethercat tool, siitool from

https://github.com/synapticon/siitool
on the LICENSE file(last section), Copyright (c) 2013, Synapticon GmbH All rights reserved.

I have some warnings and an error on MacOS 10.13.2 and Mac OS 10.12.6.

This section is currently in the process of being written. I will add it one by one in the future.

make

$ cd ~/Downloads/siitool-master
$ make
fatal: Not a git repository (or any of the parent directories): .git
gcc -g -Wall -Wextra -O2 -std=gnu99 -DDEBUG=0 `xml2-config --cflags` -DVERSION=\"\" -c -o main.o main.c
fatal: Not a git repository (or any of the parent directories): .git
gcc -g -Wall -Wextra -O2 -std=gnu99 -DDEBUG=0 `xml2-config --cflags` -DVERSION=\"\" -c -o sii.o sii.c
fatal: Not a git repository (or any of the parent directories): .git
gcc -g -Wall -Wextra -O2 -std=gnu99 -DDEBUG=0 `xml2-config --cflags` -DVERSION=\"\" -c -o esi.o esi.c
fatal: Not a git repository (or any of the parent directories): .git
gcc -g -Wall -Wextra -O2 -std=gnu99 -DDEBUG=0 `xml2-config --cflags` -DVERSION=\"\" -c -o esifile.o esifile.c
fatal: Not a git repository (or any of the parent directories): .git
gcc -g -Wall -Wextra -O2 -std=gnu99 -DDEBUG=0 `xml2-config --cflags` -DVERSION=\"\" -c -o crc8.o crc8.c
gcc -o siitool main.o sii.o esi.o esifile.o crc8.o -g  -Wall -Wextra `xml2-config --libs`

A compile is success. A siitool are made. There are some git errors.
I don't know that git errors may from lines on the makefile, or not.

tarball:
	git archive --format=tar --prefix="$(TARGET)-$(VERSION)/" HEAD | gzip > $(TARGET)-$(VERSION).tar.gz

I have installed git using "brew install git", and the version of git is now 2.15.1 as the command

git --version
git version 2.15.1

make install

$ sudo make install
Password:
install -b siitool.1 /usr/local/share/man/man1/siitool.1
strip siitool
install -b siitool /usr/local/bin

You can use siitool from any directory.

make lint

make lint
clang --analyze `xml2-config --cflags` main.c sii.c esi.c esifile.c
In file included from main.c:40:
./sii.h:9:10: fatal error: 'unistd.h' file not found
#include <unistd.h>
         ^~~~~~~~~~
1 error generated.
make: *** [lint] Error 1

Only "make" use gcc and "make lint" use clang. Therefore it may be a configuration issue on clang. The gcc and clang versions are below.

$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.39.2)
Target: x86_64-apple-darwin17.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

$ clang --version
clang version 5.0.1 (tags/RELEASE_501/final)
Target: x86_64-apple-darwin17.3.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin

If you have some advices, please inform me.

Success on an example file(71Kb)

$ /usr/local/bin/siitool -p  ./examples/Somanet_CiA402-multi.xml
First print preamble and config
Preamble:
PDI Control: ................ 0x0e08
PDI Config: ................. 0x8802
Sync Impulse Length: ........ 0 ns (raw: 0x0000)
PDI Config 2: ............... 0x0000
Configured Station Alias: ... 0x0000
Checksum of Preamble: ....... 0x002f (ok)
Identity:
  Vendor ID:

* snip *

 Latch Description
    Latch 0 PosEdge: ............ single
    Latch 0 NegEdge: ............ continous
    Latch 1 PosEdge: ............ continous
    Latch 1 NegEdge: ............ continous
    Latch 0 PosEvnt: ............ no Event
    Latch 0 NegEvnt: ............ no Event
    Latch 1 PosEvnt: ............ no Event
    Latch 1 NegEvnt: ............ no Event
    Latch0PosEdgeValue: ......... 0x00000000
    Latch0NegEdgeValue: ......... 0x01000000
    Latch1PosEdgeValue: ......... 0x00060001
    Latch1NegEdgeValue: ......... 0x00000000

Execution error on a big file(15Mb)

$/usr/local/bin/siitool -o O2  bigfile.xml 
Segmentation fault: 11

20180118 added. At 1.1Mb file, Segmentation fault is occurred.

Success on a small file(261Kb)

$/usr/local/bin/siitool -p  smallfile.xml 
First print preamble and config
Preamble:
PDI Control: ................ 0x0c08
PDI Config: ................. 0x0c00
Sync Impulse Length: ........ 1000 ns (raw: 0x0064)
PDI Config 2: ............... 0x0000
Configured Station Alias: ... 0x0000
Checksum of Preamble: ....... 0x00a9 (ok)
Identity:
  Vendor ID: ................ 

*snip*

 Latch Description
    Latch 0 PosEdge: ............ single
    Latch 0 NegEdge: ............ continous
    Latch 1 PosEdge: ............ continous
    Latch 1 NegEdge: ............ continous
    Latch 0 PosEvnt: ............ no Event
    Latch 0 NegEvnt: ............ no Event
    Latch 1 PosEvnt: ............ no Event
    Latch 1 NegEvnt: ............ no Event
    Latch0PosEdgeValue: ......... 0x00000000
    Latch0NegEdgeValue: ......... 0x01000000
    Latch1PosEdgeValue: ......... 0x00060001
    Latch1NegEdgeValue: ......... 0x00000000

COPYRIGHT file

 Copyright (c) 2013, Synapticon GmbH  All rights reserved.

  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this
     list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice,
     this list of conditions and the following disclaimer in the documentation
     and/or other materials provided with the distribution.
  3. Execution of this software or parts of it exclusively takes place on hardware 
      produced by Synapticon GmbH.

   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

   The views and conclusions contained in the software and documentation are those
   of the authors and should not be interpreted as representing official policies,
   either expressed or implied, of the Synapticon GmbH.

20180117 p.s.1

$ make
fatal: Not a git repository (or any of the parent directories): .git
gcc -g -Wall -Wextra -O2 -std=gnu99 -DDEBUG=0 `xml2-config --cflags` -DVERSION=\"\" -c -o main.o main.c
fatal: Not a git repository (or any of the parent directories): .git
gcc -g -Wall -Wextra -O2 -std=gnu99 -DDEBUG=0 `xml2-config --cflags` -DVERSION=\"\" -c -o sii.o sii.c
fatal: Not a git repository (or any of the parent directories): .git
gcc -g -Wall -Wextra -O2 -std=gnu99 -DDEBUG=0 `xml2-config --cflags` -DVERSION=\"\" -c -o esi.o esi.c
fatal: Not a git repository (or any of the parent directories): .git
gcc -g -Wall -Wextra -O2 -std=gnu99 -DDEBUG=0 `xml2-config --cflags` -DVERSION=\"\" -c -o esifile.o esifile.c
fatal: Not a git repository (or any of the parent directories): .git
gcc -g -Wall -Wextra -O2 -std=gnu99 -DDEBUG=0 `xml2-config --cflags` -DVERSION=\"\" -c -o crc8.o crc8.c
gcc -o siitool main.o sii.o esi.o esifile.o crc8.o -g  -Wall -Wextra `xml2-config --libs`
ld: file not found: /usr/lib/system/libsystem_darwin.dylib for architecture x86_64
collect2: error: ld returned 1 exit status
make: *** [siitool] Error 1
KM-S05:siitool-master administrator$ gcc -version
gcc: error: unrecognized command line option '-version'
gcc: fatal error: no input files
compilation terminated.
$ gcc --version
gcc (Homebrew GCC 6.4.0) 6.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

This may be only MacOS Sierra (10.12.6) problem
see missing libsystem_darwin.dylib (Xcode 9)
https://github.com/Homebrew/homebrew-php/issues/4590
You can avoid this issue like this.

$ sudo rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install
$ sudo xcode-select -s /Library/Developer/CommandLineTools

Then you can make.

p.s.2 ubuntu(docker run -it ubuntu:xenial /bin/bash), add gcc,make,

$ make
make: git: Command not found
gcc -g -Wall -Wextra -O2 -std=gnu99 -DDEBUG=0 `xml2-config --cflags` -DVERSION=\"\" -c -o main.o main.c
/bin/sh: 1: xml2-config: not found
make: git: Command not found
gcc -g -Wall -Wextra -O2 -std=gnu99 -DDEBUG=0 `xml2-config --cflags` -DVERSION=\"\" -c -o sii.o sii.c
/bin/sh: 1: xml2-config: not found
make: git: Command not found
gcc -g -Wall -Wextra -O2 -std=gnu99 -DDEBUG=0 `xml2-config --cflags` -DVERSION=\"\" -c -o esi.o esi.c
/bin/sh: 1: xml2-config: not found
esi.c:11:27: fatal error: libxml/parser.h: No such file or directory
compilation terminated.
Makefile:49: recipe for target 'esi.o' failed
make: *** [esi.o] Error 1

This article is an individual impression based on the individual's past experience. It has nothing to do with the organization or business to which I currently belong.

p.s.
I am in the way of writing. I will add some informations as necessary. Please advise from your precious experience.

<この記事は個人の過去の経験に基づく個人の感想です。現在所属する組織、業務とは関係がありません。>

文書履歴(document history)

ver. 0.01 初稿  20180117
ver. 0.02 ありがとう追記 20230513

最後までおよみいただきありがとうございました。

いいね 💚、フォローをお願いします。

Thank you very much for reading to the last sentence.

Please press the like icon 💚 and follow me for your happy life.

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0