80 likes | 295 Views
Working with an IOC. Marty Kraimer APS. Typical Directory Structure for EPICS Applications. All directories and files are referenced relative to some user-defined <top> directory under which all IOC related files exist e.g. <top> = /home/phoebus/STUDNTn/ioc/linac
E N D
Working with an IOC Marty Kraimer APS
Typical Directory Structure for EPICS Applications • All directories and files are referenced relative to some user-defined <top> directory under which all IOC related files exist • e.g. <top> = /home/phoebus/STUDNTn/ioc/linac <top> = /home/phoebus/STUDNTn/ioc/example <top> = /home/phoebus/STUDNTn/ioc/project • /home/phoebus/STUDNTn/ioc/linac is provided for you and already contains appropriate .dbd and .db files for the IOCs. You will create the other top directories during the lab sessions.
Directory Structure of <top> • <top>/ • config/ - configuration and make rules • linacApp/ - ioc related source files • Db/ • Makefile.Host - must edit to add database files • xxLinacSim.db - Example database file • *.db - other database files as required • src • Makefile.Host - Rules to build linacApp.dbd • Makefile.Vx • Rules to build linacLib • Rules to install iocCore and sequencer • *.c - C files for added device support, records, etc • *.st - sequence programs • base.dbd and baseLIBOBJS • select components from epics base • linacInclude.dbd • Specifies additional components to be included in linacApp.dbd
Directory Structure of <top> • <top>/ • iocBoot/ • ioclinac/ • st.cmd - startup script for vxWorks • bin • db • dbd • include • lib • ... Install directories created and maintained by ‘gnumake’. Do not edit files in these directories.
Connecting to the IOC’s Console Port • In an xterm window on the Unix workstation • cu -l cua/a • If vxWorks is running, you now have access to the vxWorks shell • bootChange - edit boot parameters • CTL-X - cause a reboot • help - displays vxWorks debugging commands • ____ - any global function loaded at boot time • If vxWorks is not running, you are interacting with a ROM-based debugger • p - Print boot parameters • c - Change boot parameter • @ - Start boot process • ? - help (shows available commands)
Booting an IOC • vxWorks Boot Parameters '.' = clear field; '-' = go to previous field; ^D = quit boot device : ei processor number : 0 host name : phoebus file name : /usr/local/vxWorks/5.3/mv167bp0/vxWorks inet on ethernet (e) : 164.54.8.xxx:fffffe00 inet on backplane (b) : host inet (h) : 164.54.8.167 gateway inet (g) : user (u) : <USER_ID> ftp password (pw) (blank = use rsh): <PASSWORD> flags (f) : 0x0 target name (tn) : iocuspasn startup script (s) : /home/phoebus/STUDNTn/ioc/linac/ioclinac/st.cmd other (o) : • The only parameter you will need to change is ‘startup script’
vxWorks Startup Script • A vxWorks startup script is used to load EPICS software and databases. The path for the startup script is specified in the boot parameters. • Typical startup script (st.cmd) # Example vxWorks startup file # Following must be added for many board support packages #cd <full path to target bin directory> < cdCommands /* defines appbin, startup */ cd appbin ld < iocCore /* loads ioc system software */ ld < seq /* loads the EPICS sequencer */ ld < linacLib /* loads user specified object code */ cd startup dbLoadDatabase("../../dbd/linacApp.dbd") dbLoadRecords("../../db/xxLinacSim.db","user=studnt1") iocInit /* starts ioc software */ seq &bpmTrajectory, "user=studnt0” /* starts a sequence program */
IOC Test Facilities • Useful vxWorks routines • i - list tasks • d <address> - dump memory • ld < filename.o - load object module • lkup “name” - find address of global variable • spy - show CPU usage per task • Useful EPICS-supplied routines (See Chapter 6 Application Developer’s Guide) • dbl - list records • dbnr - list number of each record type • dbpr “<pvname>“, 5 - print all fields of a record • dbgf “<pvname>“ - get field value • dbpf “<pvname>“,”<value>“ -put field value • dbior - print driver/device report • casr - Channel Access Server Report • dbel “<record” - CA Event list report • dbcar - Database CA Report