Prerequisites
First, review the materials in units 1, 2, 3, and 6 of the EPICS Training Slides linked above.
Next, let's prepare to solve the problem. We need to do some work to set up accounts and environments to build against EPICS at SLAC.
Use your unix account to log into the a SLAC controls development server (instructions).
- The link above suggests using FastX as a method to connect to the remote server. Any X-windows forwarding should work (for the Mac, there's XQuartz). SLAC IT supports a few options. NoMachine works well. Most of them are available using the SLAC Self Service application.
- Also, when the above link has you create your .bashrc file from the
get_my_bash
script, it sources two scripts, one of which is listed below.
Log into the development server. The main development server is lcls-dev3:
ssh -Y <unix_username>@lcls-dev3
Note: If you are using a Mac running macOS Ventura (or later?), the ssh version that is running won't automatically select the key algorithm that works on lcls3-dev
. To remedy this, you need to edit your ssh config file. It should be at ~/.ssh/config
. You need to do this, for example, if, when you execute the above command, you get something like the following back: Unable to negotiate with 134.79.216.240 port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss
.
Additionally, the ssh key/exchange mechanism doesn't work without a similar workaround. To apply both of these workarounds, make the following changes to you ssh config file. The "*" means that it applies to all hosts.
Host *
HostKeyAlgorithms=+ssh-rsa
PubkeyAcceptedKeyTypes=+ssh-rsa
It could well be, also, that you are logging into an environment where it's entirely authenticated via Kerberos to authenticate AFS. That's the usual case. Look here for help with that. Setting that up will make it so that, like the ssh key exchange, logging in will be passwordless.
SLAC Controls Software Group maintains a standard environment that can be set up by sourcing a single setup script
source /afs/slac/g/lcls/tools/script/ENVS64.bash
Running this script will set up many environment variables and symbolic links that are very useful for your work. You will become familiar with them as you move forward. For now, you can make sure the environment was set up properly:
[jmock@lcls-dev3 ~]$ printenv | grep EPICS_BASE
EPICS_BASE_HOST_BIN=/afs/slac.stanford.edu/g/lcls/vol9/package/anaconda/envs/python3.8envs/v2.5/epics/bin/linux-x86_64
EPICS_BASE_VERSION=7.0.6.1
EPICS_BASE_RELEASE=/afs/slac/g/lcls/epics/base/R7.0.3.1-1.0
EPICS_BASE=/afs/slac/g/lcls/epics/base/R7.0.3.1-1.0
EPICS_BASE_VER=R7.0.3.1-1.0
Note: As of May 5, 2023, EPICS_BASE_HOST_BIN
and EPICS_BASE_VERSION
don't show up when you execute the above command. So, it now looks more like:
[0 jmpdude@lcls-dev3 ~]$ printenv | grep EPICS_BASE
EPICS_BASE_RELEASE=/afs/slac/g/lcls/epics/base/R7.0.3.1-1.0
EPICS_BASE=/afs/slac/g/lcls/epics/base/R7.0.3.1-1.0
EPICS_BASE_VER=R7.0.3.1-1.0
Now, you are ready to create an EPICS application to use for testing. First, it is recommended to create a working directory in your home directory (~) to store the test application. Then we will use makeBaseApp.pl (script in EPICS Base) to create the application. You can find reference material about this script in the Application Developer's Guide, or here.
Calling makeBaseApp.pl with the flag -t and type ioc will create the Application and configure directories as well as makefiles needed for a basic EPICS application. Calling it a second time with the -i flag will create an iocBoot directory and test IOC. See the output example in the code block below.
jmock@lcls-dev3 $ pwd
/u/ld/jmock
jmock@lcls-dev3 $ mkdir JeremyTest
jmock@lcls-dev3 $ cd JeremyTest/
jmock@lcls-dev3 $ makeBaseApp.pl
Usage:
<base>/bin/<arch>/makeBaseApp.pl -h
display help on command options
<base>/bin/<arch>/makeBaseApp.pl -l [options]
list application types
<base>/bin/<arch>/makeBaseApp.pl -t type [options] [app ...]
create application directories
<base>/bin/<arch>/makeBaseApp.pl -i -t type [options] [ioc ...]
create ioc boot directories
where
app Application name (the created directory will have "App" appended)
ioc IOC name (the created directory will have "ioc" prepended)
jmock@lcls-dev3 $ makeBaseApp.pl -t ioc
Name the application(s) to be created.
Names given will have "App" appended to them.
Application names? JeremyTest
jmock@lcls-dev3 $ ls
JeremyTestApp/ Makefile configure/
jmock@lcls-dev3 $ makeBaseApp.pl -i -t ioc
Name the IOC(s) to be created.
Names given will have "ioc" prepended to them.
IOC names? sioc-b34-jeremy
The following target architectures are available in base:
rhel6-x86_64
RTEMS-beatnik
RTEMS-mvme3100
RTEMS-uC5282
RTEMS-svgm
linuxRT-x86_64
linuxRT-i686
linuxRT-arm_zynq
rhel7-x86_64
ubuntu1904-x86_64
ubuntu20041-x86_64
What architecture do you want to use? rhel7-x86_64
The following applications are available:
JeremyTest
What application should the IOC(s) boot?
The default uses the IOC's name, even if not listed above.
Application name? JeremyTest
jmock@lcls-dev3 $ ls
JeremyTestApp/ Makefile configure/ iocBoot/
The directory structure you should find at this point is a typical EPICS application structure. You can find a layout of the directory structure here.
At this point, you can build the application. From <TOP>, simply type make. Pay attention to what directories and files exist before and after the build process. From <TOP> you can also call make clean
, make clean uninstall
and make distclean
. Explore around the application structure.
Now we will move on to the problem to solve.