Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Panel
6. Where and how do I create a new EPICS application?  How do I setup a new IOC to use linuxRT-86_64 OS?  

(a) Create directories as shown below using cpu-b34-bd32 as an example:

  $IOC/cpu-b34-bd32

  $IOC_DATA/cpu-b34-bd32

  $IOC_DATA/vioc-b34-bd32

  $IOC_DATA/vioc-b34-bd32/autosave

  $IOC_DATA/vioc-b34-bd32/autosave-req

  $IOC_DATA/vioc-b34-bd32/iocInfo

TO DO list: Generate a script to create above directories automatically via a single python or perl script.

Note: this script is available from Ken Brobeck  on softegr@lcls-srv01:/usr/local/admin/scripts/setup-ioc-dir

$APP/MyTest  (look at this as an example)

 Now create an EPICS application in your home directory called, 'MyTest'  , using standard templates and scripts in the above example.

 (b) In your home directory, create a sandbox area called 'MyTest', which will contain your EPICS IOC application.

cd ~

mkdir MyTest

 (c) cd MyTest

You are currently in:

 ~/MyTest

 (d) Now, create a new EPICS IOC Application called,'MyTest'  as follows:

 makeBaseApp.pl -t slac MyTest

 The perl script, makeBaseApp.pl  populates your application using the icdTemplates module that has standard ICD templates.

 These templates are used by ICD to support our style of IOC Application Building for all facilities we support.

 The location for icdTemplates module was defined, when you sourced go_epics_3-14-12-4_1-0.bash

 EPICS_MBA_TEMPLATE_TOP=/afs/slac/g/lcls/epics/R3-14-12-4_1-0/modules/icdTemplates/icdTemplates-R1-2-0 

If you would like to know more about makeBaseApp.pl type:

makeBaseApp.pl -help

 (e) Now, open the configure/RELEASE file in your new  IOC Application

(i) Notice how the following line appears towards the beginning:

# EPICS Templates
TEMPLATE_TOP=/afs/slac/g/lcls/epics/R3-14-12-4_1-0/modules/icdTemplates/icdTemplates-R1-2-0

(ii) Notice the following line next:

include $(TOP)/RELEASE_SITE

 The above sets the paths for EPICS base, modules, packages, tools etc. to point to version R3-14-12-4_1-0.

 (iii) The file has the following line towards the end of it: 

# Location of Linux Kernel Modules:

LINUX_KERNEL_MODULES=$(PACKAGE_SITE_TOP)/linuxKernel_Modules

 (iv) Modify configure/RELEASE as necessary to use the version of EPICS modules that your application needs.

 Ensure that the specific versions included in your RELEASE file DO EXIST under the modules directory and are consistent.

 They must also have been built for your target kernel (such as linuxRT_glibc-x86_64). If something is missing, contact Ernest.  

In our example, we will be needing the EVENT module for our EVR:

 EVENT_MODULE_VERSION=event-R4-1-6

 (f) Open MyTestApp/src/Makefile and notice that the IOC application is referred to as 'MyTest"

 (g) Now it is time to add your linuxRT_glibc-x86_64 virtual ioc (vioc) startup scripts. vioc-b34-bd32 is used here as an example.

 From $(TOP) type the following command to create a boot directory for 'vioc-b34-bd32':

 makeBaseApp.pl -i -t slac vioc-b34-bd32

 When prompted to choose target architecture, choose linuxRT-x86 or inuxRT_glibc-x86_64.

Now iocBoot directory has been created under $(TOP) and underneath it 'vioc-b34-bd32' has been created.

Two files are modified based on this selection.

(1) iocBoot/vioc-b34-bd32/st.cmd

Open iocBoot/vioc-b34-bd32/Makefile and notice that ARCH is set to the target platform you you chose - linuxRT-x86 or linuxRT_glibc-x86_64. 

(2) iocBoot/vioc-b34-bd32/Makefile.

Open iocBoot/vioc-b34-bd32/st.cmd and notice that this script is setup to pick the binary from  from your target's directory - linuxRT-x86 or linuxRT_glibc-x86_64 directory.

When prompted with 'Application name?'  type 'MyTest'.

This will use the application name MyTest that was created in  MyTestApp/src/Makefile as described in step (f).

 If you just hit 'Enter' without specifying your application name, then your ioc name vioc-b34-bd32 will be used as the default for the dbd file in the st.cmd

 (h) icdTemplates created MyTestApp/src/Makefile.

 Open this file and notice how it is populated.

 It has support for base, iocAdmin, autosave-restore which all IOCs must include.

 It also includes support for Till Straumann's Cexp shell.

 Look at Cexp Shell Examples to see how to invoke Cexp and how to call C-functions from this interactive shell. For more information on Cexp, read  What is Cexp?

 Additionally, the Makefile includes 'system.dbd' - this is mainly for linux-based IOCs.

 For linuxRT, 'system' command is useful for changing kernel thread priorities for kernel drivers at run-time. This is explained later under rtPrioritySetup.cmd.

 (i) If you do not have an EVR in your system, comment out all lines pertaining to EVR in MyTestApp/src/Makefile:

MyTest_DBD += evrSupport.dbd

MyTest_DBD += devMrfEr.dbd

...

MyTest_LIBS += evrSupport

MyTest_LIBS += devMrfEr

....

MyTest_LIBS += mrfVme64x

....

MyTest_LIBS += drvMrf

 For a PMC EVR230 or PCI-e EVR300 that is installed in your system, the above is all you need.

Modify MyTestApp/src/Makefile adding more libraries and DBDs as needed for your application.

 (j) Replace the macros in the EPICS database files under MyTestApp/Db or add more databases as needed for your application.

Modify MyTestApp/Db/Makefile to ensure that you have included all your databases for the make process.

(k) Now 'make' your application from the top level directory  $(TOP) to ensure all your changes are good:

 There should be no build errors.

Refer to notes from Ernest regarding building the application for several targets here: linuxRT targets and cross compiler notes.

(l) Having tested this phase, you can now uninstall the binaries and cleanup the make-generated files using the following command:

make clean uninstall

 Do the above before committing the files to CVS, and make sure to cram your IOC application

(m) Add your application to CVS and commit the source files.

Here are some slides that explains a few guidelines for importing new applications into CVS:

cvs-vendor-import.txt

CVS-Importing-Merging.pdf

CVS-At-SLAC.pdf

TO DO list: icdTemplates module that provides default templates is a work in progress.

 Make changes to the MyTestApp/Db/* files and iocBoot/vioc-b34-bd32/st.cmd as needed for your application.

Follow the example MyTest and create similar database files and st.cmd.

 The EVR-related screens have been added for vioc-b34-bd32.

 You can see them when the vioc-b34-bd32 is running as follows from lcls-dev2:

lclshome -> User Dev Displays.... -> Test IOCs/Dev Event IOCs....

 The buttons for the various panels for VIOC:B34:BD32 are towards the bottom of this screen.

For easy access to your IOC's EVR panels in LCLSDEV, add the necessary buttons to this page.

 The 'Pattern' button brings up the 'Pattern Diagnostics' screen.

 'PMC EVR:B34:BD32' button brings up the Low Level 'Diagnostics' screen for EVR;B34:BD32

 'Triggers' button brings up 'Trigger Configuration' setup screen.

...