epics on windows how to install and application example with hands-on

25
EPICS EPICS Seminar 2009, RRCAT, Indor Masanori Satoh, KEK Linac, Jan. 2009. Masanori Satoh/ KEK, Jan. 27-30, 2009 for EPICS seminar at RRCAT, Indore EPICS on Windows How to install and Application example with hands-on Some parts are quoted from Dr. Furukawa’s and Dr. Obina’s lecture materials.

Upload: sydnee-case

Post on 30-Dec-2015

34 views

Category:

Documents


2 download

DESCRIPTION

Masanori Satoh/ KEK, Jan. 27-30, 2009 for EPICS seminar at RRCAT, Indore. EPICS on Windows How to install and Application example with hands-on. Some parts are quoted from Dr. Furukawa’s and Dr. Obina’s lecture materials. Why EPICS on Windows. EPICS on Windows Information: - PowerPoint PPT Presentation

TRANSCRIPT

EPICS

EPICS Seminar 2009, RRCAT, Indor Masanori Satoh, KEK Linac, Jan. 2009.

Masanori Satoh/ KEK,Jan. 27-30, 2009

for EPICS seminar at RRCAT, Indore

EPICS on WindowsHow to install and Application

example with hands-on

Some parts are quoted from Dr. Furukawa’s and Dr. Obina’s lecture materials.

EPICS

EPICS Seminar 2009, RRCAT, Indor Masanori Satoh, KEK Linac, Jan. 2009.

Why EPICS on Windows EPICS on Windows Information:

http://www.aps.anl.gov/epics/base/win32.phphttp://www-linac.kek.jp/jk/win32/

Recently, many devices are running on Windows (2000, XP, Vista) . Digital oscilloscope (Tektronix, Agilent, LeCroy,

…) Network Analyzer Many other measurement instruments etc.

EPICS

EPICS Seminar 2009, RRCAT, Indor Masanori Satoh, KEK Linac, Jan. 2009.

EPICS IOC Example in KEK Linac

Tektronix Oscilloscope DPO7104 for BPM-DAQ

Agilent Network Analyzer E5061A for Vector voltmeter ( 571 MHz Phase)

EPICS

EPICS Seminar 2009, RRCAT, Indor Masanori Satoh, KEK Linac, Jan. 2009.

Building EPICS on Windows: Some possible environments

Cygwin Unix-like environment GNU tools cygwin1.dll

Microsoft Visual C++ (VC6, 2005, .NET, 2008) Commercial Free version (Express Edition)

MinGW Minimalist GNU for Windows Free GNU C compiler msvcrt.dll (Microsoft C)

Borland C++

EPICS

EPICS Seminar 2009, RRCAT, Indor Masanori Satoh, KEK Linac, Jan. 2009.

Building EPICS on Windows: The simplest approach:

Cygwin with the GCC compiler

Recommend: Some Cygwin tools and Microsoft's commercial

Visual C++ compiler (or free Visual C++ 2008 Express Edition).

http://www.microsoft.com/express/vc/

EPICS

EPICS Seminar 2009, RRCAT, Indor Masanori Satoh, KEK Linac, Jan. 2009.

What’s Cygwin? Cygwin is a Linux-like environment for

Windows. A DLL (cygwin1.dll) which acts as a Linux API

emulation layer providing substantial Linux API functionality.

A collection of tools which provide Linux look and feel.

You can get ithttp://www.cygwin.com/

EPICS

EPICS Seminar 2009, RRCAT, Indor Masanori Satoh, KEK Linac, Jan. 2009.

Cygwin Applications Cygwin API

“Cygwin1.dll” provides function of POSIX system call. Development of Windows-native Application is also

Possible Development of DLL is Possible

Most of the Open-Source tools on Unix are ported. Fileutils, XXXutils, Compilers, Debuggers, Editors, Internet

Clients, Interpreters, Dev. Tools, Doc. Tools. Servers

Sshd, Apache (php, etc.), Squid, PostgreSQL, Xinetd, NFS,… X11

EPICS

EPICS Seminar 2009, RRCAT, Indor Masanori Satoh, KEK Linac, Jan. 2009.

What Is Visual Studio Express? You can get it.

http://www.microsoft.com/express/download/ Visual C++, Visual Basic, Visual C#, SQL Server,

Visual Web Developer. Freeware Limited functionality But enough for common usage Needs about 1 GB of disk space

You don’t need:MS Shilverlight RuntimeMS SQL Server

EPICS

EPICS Seminar 2009, RRCAT, Indor Masanori Satoh, KEK Linac, Jan. 2009.

Visual C++ 2008 GUI

EPICS

EPICS Seminar 2009, RRCAT, Indor Masanori Satoh, KEK Linac, Jan. 2009.

How to Build EPICS on Windows (1)

Using Cygwin: The simple way to build EPICS on Windows

Hits for Cygwin setup: Very slow response for some download sites. If you failed to download, try from other

Websites . Default install option does not include the

important commands: cc, make, perl, etc

EPICS

EPICS Seminar 2009, RRCAT, Indor Masanori Satoh, KEK Linac, Jan. 2009.

How to Build EPICS on Windows (1)

Install Cygwin:

EPICS

EPICS Seminar 2009, RRCAT, Indor Masanori Satoh, KEK Linac, Jan. 2009.

How to Build EPICS on Windows (1)

EPICS

EPICS Seminar 2009, RRCAT, Indor Masanori Satoh, KEK Linac, Jan. 2009.

How to Build EPICS on Windows (1)

Choose a download site. If you failed, try from other download

sites.

EPICS

EPICS Seminar 2009, RRCAT, Indor Masanori Satoh, KEK Linac, Jan. 2009.

How to Build EPICS on Windows (1)

Select Packages you want. At least, select cc, vim, make, Perl,

and so on. X11 is also available if you select.

EPICS

EPICS Seminar 2009, RRCAT, Indor Masanori Satoh, KEK Linac, Jan. 2009.

How to Build EPICS on Windows (1)

Select Packages: Editors

Vim, Emacs,…

Devel make gcc-g++, gcc-core

Perl Other packages if you need

EPICS

EPICS Seminar 2009, RRCAT, Indor Masanori Satoh, KEK Linac, Jan. 2009.

How to Build EPICS on Windows (1)

Set EPICS_HOST_ARCH environment var. bash: export EPICS_HOST_ARCH=cygwin-x86 csh: setenv EPICS_HOST_ARCH cygwin-x86 c.f.) for MinGW,export EPICS_HOST_ARCH=win32-x86-mingw

Then, in the base directory Just type “make” Typically, it takes about 10 minutes.

(Intel Core2 1.2 GHz, 2 GB RAM)

EPICS

EPICS Seminar 2009, RRCAT, Indor Masanori Satoh, KEK Linac, Jan. 2009.

How to Build EPICS on Windows (2)

Cygwin tools and Microsoft's Visual Studio C++ compiler combination. make, perl (Cygwin) cl, link, (Visual Studio C++)

EPICS_HOST_ARCH: bash: export EPICS_HOST_ARCH=win32-x86 csh: setenv EPICS_HOST_ARCH win32-x86 c.f.) for Borland compilerexport EPICS_HOST_ARCH=win32-x86-borland

EPICS

EPICS Seminar 2009, RRCAT, Indor Masanori Satoh, KEK Linac, Jan. 2009.

How to Build EPICS on Windows (2)

EPICS_HOST_ARCH variable: You can set it as the Windows Environment

Variable. “Control Panel” => “System” => “System

Property” => “Environment Variables” => “System variables”

EPICS

EPICS Seminar 2009, RRCAT, Indor Masanori Satoh, KEK Linac, Jan. 2009.

How to Build EPICS on Windows (2)

You can find cygwin.bat file in c:\cygwin (default setting) or root directory you choosed.

In cygwin.bat file, add one line.@echo off

C:

chdir C:\cygwin\bin

call "C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat“

bash --login -i

EPICS

EPICS Seminar 2009, RRCAT, Indor Masanori Satoh, KEK Linac, Jan. 2009.

How to Build EPICS on Windows (2)

Modify /etc/profile filePATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:$PATH

export PATH

=>

PATH=$PATH:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin

export PATH You can check the path setting by “which” command.

$ which link

/cygdrive/c/Program Files/Microsoft Visual Studio 8/VC/BIN/link

$ which cl

/cygdrive/c/Program Files/Microsoft Visual Studio 8/VC/BIN/cl

EPICS

EPICS Seminar 2009, RRCAT, Indor Masanori Satoh, KEK Linac, Jan. 2009.

Hands-on (1) Build EPICS base on Windows

Use Cygwin export EPICS_HOST_ARCH=cygwin-x86

Use Visual Studio C++ and Cygwin(make, perl) export EPICS_HOST_ARCH=win32-x86 Modify the /etc/profile file PATH= $PATH:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin

EPICS

EPICS Seminar 2009, RRCAT, Indor Masanori Satoh, KEK Linac, Jan. 2009.

Hands-on (2) Open a Cygwin command window Check environment

printenv printenv |grep EPICS make –v perl –v cl

EPICS

EPICS Seminar 2009, RRCAT, Indor Masanori Satoh, KEK Linac, Jan. 2009.

Hands-on (3) Create an Example Application on Windows/home/username>mkdir testApp /home/username>cd testApp/home/username/testApp>makeBaseApp.pl -t example myexample/home/username/testApp>makeBaseApp.pl -i -t example myexample/home/username/testApp>make..... wait for a while ...../home/username/testApp>cd iocBoot\iocmyexample/home/username/testApp/iocBoot/iocmyexample>vi st.cmd..... edit "st.cmd" .....dbLoadRecords("db/dbExample1.db","user=username")dbLoadRecords("db/dbExample1.db","user=your_favorite_name")/home/username/testApp/iocBoot/iocmyexample>../../bin/win32-

x86/example.exe st.cmd..... open another cmd window, try caget, camonitor

EPICS

EPICS Seminar 2009, RRCAT, Indor Masanori Satoh, KEK Linac, Jan. 2009.

Hits for Hands-on (3)

Set path configuration /usr_epics_base_directory/bin/win32-

x86 e.g.) /epics/base-3.14.10/bin/win32-

x86

Modify .bashrc (bash), .cshrc (csh) Or, Modify Environment Variables on

Windows

EPICS

EPICS Seminar 2009, RRCAT, Indor Masanori Satoh, KEK Linac, Jan. 2009.

How to use CA.DLL Dynamic-Link Library (DLL)

Microsoft’s implementation of the shared library concept in the Windows operating systems

*.so (In Linux or other UNIX-like operating system)

Example: caClient by VBA macro Visual Basic for Application In KEK Linac, VBA is used for E5061A(Agilent) for

Vector voltmeter.