1 2003/p571: ioc development environment epics ioc development environment with epics on ubuntu...
TRANSCRIPT
12003/P571: IOC Development Environment
EPICS
IOC Development Environmentwith
EPICS on Ubuntu
Based on “IOC Development Envirnment” by Andrew Johnson, APS
12003/P571: IOC Development Environment
EPICSPreamble
This talk describes the IOC development environment that comes with EPICS Base R3.14.9 on Ubuntu Linux IOC Development
Database configuration Operation Panel Sequencer program Device/Record Support
Sometimes called makeBaseApp After the PERL script that creates application areas
It uses the same major structure and build rules as Base Allows independent compilation of the same source
modules for multiple target architectures
12003/P571: IOC Development Environment
EPICSReference Documentation
EPICS: Input / Output ControllerApplication Developer's Guide
Release 3.14.10, 27 October 2008
Accessible through the R3.14.1 page on the EPICS website
Chapter 4 covers the EPICS build system in great detail, and is more recent (and accurate) than much of this talk
The R3.14 build system has evolved quite a bit since R3.13.x
12003/P571: IOC Development Environment
EPICS Purpose of an IOC DE
What is an IOC development area for? A place to collect files and configuration data
associated with one or more similar IOCs device, driver and/or record support other related software
Provides simple ways to configure and automate some very complex compilation procedures involving Databases and database templates Startup command files Record, device & driver support SNL programs Other IOC code Portable CA Server applications Other host software
12003/P571: IOC Development Environment
EPICSOther Features
IOC Software is usually divided into different <top> areas Each <top> area is managed separately A <top> may use products from other <top> areas EPICS Base is mainly regarded as just another <top>
The Gnu version of make is used to build all products Almost every directory has a Makefile in it Make recursively descends through the directory structure
Determines what needs to be [re]built Invokes compilers and other tools as instructed in the Makefile
CVS can be used for revision control of source code and configuration files
12003/P571: IOC Development Environment
EPICSEPICS on Ubuntu/Live-CD
Ubuntu 1-CD/DVD Linux distrribution Boot from CD/DVD Don't need to install it on HDD. /Can install the system on to HDD Run Most PC platform. Insert CD in the CD drive and just restart,
EPICS on Ubunti Start terminal window from menu after booting Ubuntu. For the envrionment setting use
. /opt/epics/etc/cshrc.EPICS
12003/P571: IOC Development Environment
EPICS makeBaseApp
To create a new application area, execute the commands
mkdir ~/heatercd ~/heatermakeBaseApp.pl -t example watermakeBaseApp.pl -t example -i water
example: a name of template
makeBaseApp.pl -l
will give you a list of available template
12003/P571: IOC Development Environment
EPICS makeBaseApp
makeBaseApp.pl -t example watermakeBaseApp.pl -t example -i heater
The first command creates:<top>/
Makefileconfigure/
...waterApp
src/...
Db/...
The second command creates:<top>/iocBoot
Makefileiocheater/
…
makeBaseApp.pl can be run multiple times to create new subdirectories
Run env EPICS_HOST_ARCH=linux-x86 make install
12003/P571: IOC Development Environment
EPICS <top> Directory Structure
The example directory is an application <top> A <top> is structured like this:<top>/
configure/ Configuration data filesxxxApp/ All source files except startup
src/ Source codexxxSrc/ There can be multiple xxxSrc directoriesDb/ Databases, templates & substitutions filesxxxDb There can be multiple xxxDb directories... May have others dirs too such as adl, edm, etc
yyyApp/ Any number of *App directoriesiocBoot/ Only one iocBoot
iocxxx Directory for each ioc...
<install directories>
12003/P571: IOC Development Environment
EPICS <top> Install Directories
By default, build products are installed into various subdirectories under <top>:
<top>/bin/ Object files and executables
linux-x86/vxWorks-68040/
lib/ Object librarieslinux-x86/ etc.
include/ e.g. xxxRecord.hdbd/ menu, recordtype, device, driver,etcdb/ record instances, templates, etcjavalib/ .jar files
DONT touch files in these directory. They will be OVERWRITTEN when you run “make” in the application directories
12003/P571: IOC Development Environment
EPICS <top>/configure files
Files meant to be modified CONFIG - Can override make variables
CROSS_COMPILER_TARGET_ARCHS = vxWorks-68040 CONFIG_APP
Some other definitions RELEASE
Location of other <top> areas used in this applicationEPICS_BASE=/opt/epics/R3.14.7/base
Other files not meant to be modified RULES*
Files containing (pointers to) make rules in base Makefile
Some configuration tasks
12003/P571: IOC Development Environment
EPICS <top>/xxxApp/src files
Source code for Device support Record support Sequencer (snl) program Subroutines Commands for iocsh, ....
12003/P571: IOC Development Environment
EPICS <top>/xxxApp/src files
base.dbd - definitions supplied by base Edit this if you don't want to load some base record or device
types Links to menu, recordtype, device, drivers provided by base Earlier versions of base included hardware support too, not
R3.14.1 Not fully expanded, contains many component include
statements
include “menuGlobal.dbd”include “menuConvert.dbd”include “aiRecord.dbd”...
include "waveformRecord.dbd"device(ai,CONSTANT,devAiSoft,"Soft Channel")...
device(waveform,CONSTANT,devWfSoft,"Soft Channel")
12003/P571: IOC Development Environment
EPICS xxxApp/src continued
Makefile defines what is to be built, from which source files
TOP=../..include $(TOP)/configure/CONFIGDBDINC += xxxRecordDBD += example.dbdPROD_IOC = exampleexample_SRCS += xxxRecord.c devXxxSoft.c exampleMain.cppexample_SRCS += example_registerRecordDeviceDriver.cppexample_LIBS += iocsh miscIoc rsrvIoc dbtoolsIoc asIoc dbIocexample_LIBS += registryIoc dbStaticIoc ca Cominclude $(TOP)/configure/RULES
ExampleInclude.dbdinclude “base.dbd”include “xxxRecord.dbd”device(xxx,CONSTANT,devXxxSoft,”Soft Channel”)
12003/P571: IOC Development Environment
EPICS xxxApp/xxxDb/Makefile Databases installed into <top>/db
DB += xxx.db Template files expanded on host
yyy.template has the formatrecord(ai,”$(USER):aiExample$(NO)”){
… } yyy.substitutions contains
file yyy.template {{USER=“mrk”,NO=“1”}{USER=“mrk”,NO=“2”}
}DB += yyy.dbUSES_TEMPLATE += yyy.template
Template files to be expanded at boot time via dbLoadTemplate()
DB += zzz.template zzz.substitutions Support for capfast generated files Can also expand .dbd files
12003/P571: IOC Development Environment
EPICS iocBoot/iocxxx
iocBoot/iocxxx/MakefileCreates cdCommands file for vxWorks targets. Make sure that
ARCH = <arch> is defined correctly in the Makefile
For a vxWorks target the cdCommands output file looks likestartup=“<full path to iocxxx>“appbin=“<full path to top/bin/arch>“…
A vxWorks st.cmd file looks like< cdCommands
cd appbinld < iocCoreld < xxxLibcd startupdbLoadDatabase(“../../dbd/xxxApp.dbd”)dbLoadRecords(“../../db/xxx.db”,”user=mrk”)iocInit
12003/P571: IOC Development Environment
EPICS Make Targets (commands)
It is possible to run make (gnumake) in any <top> subdirectory
<top> make clean uninstall
Removes all products, leaving just the original source files make
Builds and installs everything that is not up to date configure
makeConstructs target-specific files from contents of RELEASE
iocBoot make
Same as issuing command in each iocxxx subdirectory iocBoot/iocxxx
makeCreates the envPath file, if appropriate for the IOC's architecture
12003/P571: IOC Development Environment
EPICSMake Targets (commands) cont.
xxxApp make <command>
Same as issuing command in each subdirectory xxxApp/xxxSrc
Builds in O.<arch>; installs products in <top>/<something> make
Builds and installs all out of date components make <arch>
Build only for specified architecture(s), e.g.make vxWorks-ppc604
make cleanRemove all O.<arch> directories
XxxApp/xxxDb make
Generates and installs database instance files etc.
12003/P571: IOC Development Environment
EPICS Application Templates
MakeBaseApp uses templates for the files it creates New application templates can be created by anyone Base supplies the following<base>/templates/makeBaseApp/top/
MakefileconfigureexampleAppexampleBootsimpleAppsimpleBoot
Template files undergo textual substitutions when installed
Use “makeBaseApp.pl -l”to get the list of installed template
12003/P571: IOC Development Environment
EPICSiocsh
Iocsh EPICS database/CA server program st.cmd : startup script for iocsh
Database download Sequencer program Start ioc operation: iocInit
Command to start iocsh <top>/bin/<arch>/<application> st.cmd
Or Chmod +x st.cmd “./st.cmd” to start iocsh
12003/P571: IOC Development Environment
EPICS
Commands for debugging
Try first:
epics> help Then, try some of the other commands:epics> thread
epics> dbl
epics> dbpr “record_name”
epics> scanppl
epics> …
12003/P571: IOC Development Environment
EPICSCommands to check channel
base/bin/<arch> caConnTest.o CaEventRate ca_test Caget Camonitor Caput catime Cainfo callbackTestHost
12003/P571: IOC Development Environment
EPICSHands-on preparation
Boot you PC using Ubuntu CD Wait for a while When Ubuntu desktop is up. Open “terminal”
Applications -> Accessories -> Terminal Insert your USB memory, if you have
In “Terminal”, input the following commands ls /media Cd /media/<your usb memory>
Create working directory mkdir Group<group#>App
Replace <group#> with your group number shown on your PC Set User Environment variable
export USER=<group #>
Starting Ubuntu
← Just after rebooting PC. Press Enter to proceed.
→ Automatically log in to Ubuntuas user: ubuntu
Ubuntu:Network configuration
← select network configuration
←select eth0.And click “edit” button
→ setup IP address/mask or use DHCP
Ubuntu:Open Terminal
12003/P571: IOC Development Environment
EPICSHands on
cd Group<group#>App makeBaseApp.pl -t example myexample makeBaseApp.pl -i -t example myexample make Run Iocsh:
do: cd iocBoot/iocmyexample ../../bin/linux-x86/myexample st.cmd
or cd iocBoot/iocmyexample chmod +x ./st.cmd ./st.cmd
12003/P571: IOC Development Environment
EPICS
In inocsh try: dbl dbpr <your channel name> scnppl
In Unix shell try: caget <your channel name> cainfo <your channel name> camonitor <your channel name> caput <your channel name> , <new value>
Create User Interface with edm/medm