EPICS Base Installation

From CLONWiki
Jump to navigation Jump to search

Procedure was used to install EPICS R3.14.8.2 base into $CLAS area (this is NOT a replacement for Slow Control Group's EPICS environment; it will be used to develop Soft IOCs to provide Channel Access in frame of CLAS Monitoring Upgrade project).

Login to clon10 (or other solaris-sparc) machine

Go to $CLAS directory, create R3.14.8.2 directory, go into it, create .setup file with following contents and execute it (normally it must be called from .cshrc; env vars OSTYPE and MACHINE are set in CLAS startup procedure):

 if ( ($OSTYPE = "SunOS") && ($MACHINE = "sun4u") ) then
   ##setenv EPICS_HOST_ARCH solaris-sparc64
   setenv EPICS_HOST_ARCH solaris-sparc
 endif
 if ( ($OSTYPE = "SunOS") && ($MACHINE = "i86pc") ) then
   setenv EPICS_HOST_ARCH solaris-x86
 endif
 if ( ($OSTYPE = "Linux") && ($MACHINE = "i686") ) then
   setenv EPICS_HOST_ARCH linux-x86
 endif
 if ( ($OSTYPE == "Linux") && ($MACHINE == "ppc") ) then
   setenv EPICS_HOST_ARCH linux-ppc
 endif
 setenv EPICS_VER 3.14.8.2
 setenv EPICS_BASE $CLAS/R$EPICS_VER/base-$EPICS_VER
 setenv EPICS_EXTENSIONS $CLAS/R$EPICS_VER/extensions
 setenv EPICS_BASE_LIB $EPICS_BASE/lib/$EPICS_HOST_ARCH
 setenv EPICS_BASE_INC $EPICS_BASE/include
 setenv PATH "$PATH":$EPICS_BASE/bin/$EPICS_HOST_ARCH
 #setenv EPICS_CA_ADDR_LIST "129.57.255.4 129.57.163.255"
 setenv EPICS_CA_ADDR_LIST 129.57.167.60

Get the base tar file baseR3.14.8.2.tar.gz from http://www.aps.anl.gov/epics/ into current $CLAS/R3.14.8.2 directory

Untar it and build via:

 gunzip baseR3.14.8.2.tar.gz
 tar -xvf baseR3.14.8.2.tar
 rm baseR3.14.8.2.tar
 cd base-3.14.8.2
 ### source startup/Site.cshrc

Edit configure/CONFIG_SITE:

 set CROSS_COMPILER_TARGET_ARCHS=vxWorks-ppc604_long
 set CROSS_COMPILER_HOST_ARCHS=solaris-sparc
 you may also consider to change STATIC_BUILD=NO to STATIC_BUILD=YES,
   this way you can move the resulting binaries to other linux-x86 platforms
   [like a pc104 card] and they will run without needed to find shared libraries;
   unfortunately some other platforms may not build with STATIC_BUILD=YES ...

NOTE: you may use gmake -e CROSS_COMPILER_TARGET_ARCHS=vxWorks-ppc604_long then you probably do not need to modify 'configure/CONFIG_SITE'

Edit configure/os/CONFIG.Common.solaris-x86 and configure/os/CONFIG.Common.solaris-sparc:

 add OP_SYS_LDLIBS_10 += -lCrun -lc -lCstd

Edit configure/os/CONFIG_SITE.Common.vxWorksCommon:

 set VX_DIR = /usr/local/clas/devel_new/VxWorks55/ppc
   (do not do VX_DIR = $(WIND_BASE), it will not work !!!)

Fix src/libCom/test/epicsExceptionTest.cpp:

 replace 'exThread athread;' with  'exThread *athread;'
 replace 'athread.waitForCompletion();' with 'athread->waitForCompletion();'

Compile:

 gmake

Making example IOC shell and boot script for Solaris

Just for testing, normally will be done in $EPICSB, see corresponding documants.

 bin/solaris-sparc/makeBaseApp.pl -b $EPICS_BASE -t example ioctest
 bin/solaris-sparc/makeBaseApp.pl -b $EPICS_BASE -i -t example ioctest
   answers:
     solaris-sparc
     ioctest

NOTE: use 'bin/solaris-sparc/makeBaseApp.pl -b $EPICS_BASE -h' to get all possible options; for example: bin/solaris-sparc/makeBaseApp.pl -b $EPICS_BASE -i -t caClient caclient bin/solaris-sparc/makeBaseApp.pl -b $EPICS_BASE -t caServer caserver Directories 'caclientApp' and 'caserverApp' will be created; you can go inside and type 'gmake' and use contents as examples

 cd ioctestApp
 gmake
 cd ../iocBoot/ioctest
 chmod +x st.cmd
 edit st.cmd:
   comment out '< envPaths'
   change all 'dbLoadRecords("db...' to 'dbLoadRecords("../../db...'
 ./st.cmd

This will fire up the epics ioc shell.....if this results in an epics> prompt...you're looking pretty. At the epics> prompt type dbl to see the database records loaded in this example.

If you want, on some host, direct your EPICS_CA_ADDR_LIST to ioctest and from there you can caget or StripTool the records being processed on your ioc.

For vxWorks ioc, use following boot script:

#
# simple epics boot example
#
# usage:
#   cd "$CODA/VXWORKS_ppc/bootscripts"
#   < epics.boot
#
cd "$CLON/R3.14.8.2/base-3.14.8.2/bin/vxWorks-ppc604_long"
ld < ioctest.munch
###sysAtReboot not found. epicsExit will not be called by reboot
cd "$CLON/R3.14.8.2/base-3.14.8.2"
dbLoadDatabase("dbd/ioctest.dbd",0,0)
ioctest_registerRecordDeviceDriver(pdbbase)
dbLoadRecords("db/dbExample1.db","user=boiarino")
dbLoadRecords("db/dbExample2.db","user=boiarino,no=1,scan=1 second")
dbLoadRecords("db/dbExample2.db","user=boiarino,no=2,scan=2 second")
dbLoadRecords("db/dbExample2.db","user=boiarino,no=3,scan=5 second")
dbLoadRecords("db/dbSubExample.db","user=boiarino")
iocInit()
dbl

To build on other UNIX platforms:

 cd $EPICS_BASE
 gmake clean
 gmake
 cd ioctestApp
 gmake
 cd ../iocBoot/ioctest
 edit first line in st.cmd setting appropriate path to 'ioctest'
 ./st.cmd

IOCs examples were successfully started on 4 unix platforms mentioned above, and on 5 Motorola controllers under vxWorks: mvme2306, mvme2432, mvme5100, mvme5500, mvme6100. For vxWorks make sure following C++ flags are defined in prjParams.h:

 #define INCLUDE_CPLUS
 #define INCLUDE_CPLUS_DEMANGLER
 #define INCLUDE_CPLUS_LANG
 #define INCLUDE_CPLUS_STRING
 #define INCLUDE_CPLUS_STL
 #define INCLUDE_CPLUS_IOSTREAMS
 #define INCLUDE_CPLUS_STRING_IO
==================================================================

FROM ARNE's INSTRUCTIONS, UNTESTED: Building the sequencer/SNC example:

 get the source from: http://www.slac.stanford.edu/comp/unix/package/epics/sequencer/
 put the tarball in the base-3.14/src area
        1. cd $EPICS_BASE/src
        2. tar -zxvf seq-2.0.4.tar.gz
 OK at this point I got bitten by the impenetrable epics Makefile scheme and had to kludge my way to a working build.
        1. cd seq-2.0.4/configure
        2. chmod a+rw *
        3. comment out the line that starts with EPICS_BASE in RELEASE
        4. cd ../
        5. make # this will fail....but don't fret
        6. cd include
        7. ln -s ../../../include/* .
        8. cd ../
        9. ln -s ../lib .
       10. make # this too will result in an error message.....
       11. cd test/simple/O.linux-x86
       12. ls -l sncExample
 if sncExample has been built then you are in good shape.....
 follow the instructions in the R3.14.0beta1 howto on how to test the sequencer/state code........
 I've had builds go where sncExample did not get correctly built unless I editted a seq-2.0.4/test/simple/Makefile
   changing EPICS_BASE_HOST_LIBS to EPICS_BASE_IOC_LIBS. If you get a bunch of unresolved function calls you might have to do this edit as well....