PAUL SCHERRER INSTITUT
EPICS at PSI
PSIEPICSSLSSwissFELProscan

EPICS

EPICS at PSI
Software
Training

web epics.web.psi.ch
Download the Controls Talk
ppt pdf ps

Author: Dirk Zimoch
Phone: +41 56 310 5182
Updated: 26.04.2006


Printer friendly version
 

[Validate HTML][Validate CSS]

EPICS Client Applications (aka "Extensions")

Contents

What is an EPICS extension?

Strictly speaking it is everything which is not part of EPICS base. But usually people mean EPICS client programs such as medm or StripTool which do not run on IOCs (unlike drivers) or interfaces to other tools, such as scripting languages.

For the scope of this document, an EPICS extension is C code which runs on console type computers and uses Channel Access, the EPICS networking protocol. This can be a stand-alone program (e.g. a GUI) or a library which acts as an interface to some other tool (e.g. a scripting language). The scripts or GUI configurations files are not an EPICS extension in this sense, they use an EPICS extension.

Pitfalls building EPICS extensions on Linux Systems

Our consoles run different operating systems. Even among Linux systems, we have major differences. Scinetific Linux 3 is not the same as RedHat Linux 7.3, but the default EPICS Makefiles don't know the difference. Code compiled on RH7.3 should run on SL3, but code compiled on SL3 does not necessarily run on RH7.3. Mixed code, e.g. two libraries compiled on different systems, usually do not work together.

How to overcome that problem?

Write EPICS compatible Makefiles and use our versions of EPICS extension configuration files from CVS. Also use them for your own local applications! If you don't want, you don't need to put your local application into CVS, but nevertheless use our configuration files! Extensions build configure files as you can download them from the EPICS homepage are not sufficient.

Also do not build your own version of EPICS base. Always use the one installed in /usr/local/epics/base.

How to get the correct config files?

Checkout the module extensions-cfg from cvs:
cvs checkout extensions-cfg

This creates a directory tree like this

extensions/
|-- Makefile
|-- config/
|-- configure/
|-- src/
    |-- Makefile

How to build an application?

Go to extensions/src and create a subdirectory for your application containing all your sources. In that directory create a Makefile like this: (If you do not want your project as a subdirectory of extensions/src, you have to fix the TOP macro in the Makefile.)

TOP = ../..
include $(TOP)/configure/CONFIG

##########################################
# If you build a standalone host program #
##########################################

PROD_HOST = myCAClient

# Specify your source files (these are just examples)
PROD_SRCS += myCAClient.c
PROD_SRCS += myToolbox.c

# Which EPICS libs do you need? Most probably Com and ca.
PROD_LIBS = Com ca

##########################################
# If you build a shared library (as an   #
# interface to other programs)           #
##########################################

LOADABLE_LIBRARY_HOST = myCAInterface
# This builds libmyCAInterface.so on Linux systems

# Specify your source files (these are just examples)
LIB_SRCS += myCAInterface.c
LIB_SRCS += myToolbox.c
LIB_SRCS += myCAHelpers.cc
 
# Which EPICS libs do you need? Most probably Com and ca.
LIB_LIBS = Com ca

###########################
# Optional Configurations #                      
###########################

# Which compiler style?
# Use NORMAL if you need GNU extensions.
# STRICT is default for maximum portability.
# CMPLR = ANSI
# CMPLR = STRICT
# CMPLR = NORMAL

# Uncomment to enable debug infos
# HOST_OPT = NO

# Do you need extra compiler flags?
# USR_CFLAGS += -DIMPORTANT_MACRO=1

# Do you need extra include paths?
# USR_INCLUDES += -I/usr/local/sometool/include

# Install shared library to some non-EPICS location?
# INSTALL_SHRLIB = /usr/local/sometool/lib

include $(TOP)/configure/RULES

There are many more configuration options. For a list of macro names see EPICS: Input / Output Controller Application Developper's Guide, chapter 4.7. Some hardcopies of version 3.14.6 are in a shelf at my office (WSLA/206).

Running make will create a O.<arch> subdirectory with all object code and the resulting library or program. Depending on your system <arch> is linux-x86 or SL3-x86. It will also try to install the libraries to /usr/local/epics/extensions/lib/<arch> and programs to /usr/local/epics/extensions/bin/<arch>. If you are not on pc4015 hou have probably to make these directories writable. You can change the install location with the macros INSTALL_SHRLIB and INSTALL_PROD.


Author: Dirk Zimoch   Phone: +41 56 310 5182   Email: dirk.zimoch@psi.ch   Updated: 26.04.2006   Source: /afs/psi.ch/project/epics/webhosting/help/extensions.php