InputOutput Controller IOC Overview Andrew Johnson Computer Scientist

  • Slides: 16
Download presentation
Input/Output Controller (IOC) Overview Andrew Johnson Computer Scientist, AES Controls Group

Input/Output Controller (IOC) Overview Andrew Johnson Computer Scientist, AES Controls Group

IOC Overview • • • What is an EPICS Input/Output Controller How to create

IOC Overview • • • What is an EPICS Input/Output Controller How to create a new IOC application How to build an IOC application How to run an IOC application on various platforms Console interaction with an IOC application (iocsh)

Reference EPICS IOC Application Developers Guide Go to EPICS home page: http: //www. aps.

Reference EPICS IOC Application Developers Guide Go to EPICS home page: http: //www. aps. anl. gov/epics/ then follow links, as shown

What is an Input/Output Controller? The answer used to be easy – “A single-board

What is an Input/Output Controller? The answer used to be easy – “A single-board computer running the vx. Works real-time operating system and installed in a VME chassis”.

What is an Input/Output Controller? An IOC can also be an embedded micro-controller, a

What is an Input/Output Controller? An IOC can also be an embedded micro-controller, a rack-mount server, a laptop PC or Mac, a desktop PC or Mac, or a standalone single-board computer. RTEMS It may be running on Linux, Windows, Solaris, Darwin, RTEMS or vx. Works

‘Host-based’ and ‘Target’ IOCs • ‘Host-based’ IOC – Runs in the same environment as

‘Host-based’ and ‘Target’ IOCs • ‘Host-based’ IOC – Runs in the same environment as which it was compiled – ‘Native’ software development tools (compilers, linkers) – Sometimes called a ‘Soft’ IOC – IOC is an program like any other on the machine – Possible to have many IOCs on a single machine • ‘Target’ IOC – Runs in a different environment than where compiled – ‘Cross’ software development tools – vx. Works, RTEMS – IOC boots from some medium (usually network) – IOC is the only program running on the machine

IOC Software Development Area • IOC software is usually divided into different <top> areas

IOC Software Development Area • IOC software is usually divided into different <top> areas – Each <top> provides a place to collect and compile files and configuration data used by a group of similar IOCs, or used to create products that are used by different groups of IOCs – Each <top> is managed separately – A <top> is designed to use products from other <top> areas • EPICS base can be thought of as a <top> providing products that all IOCs need to use

IOC Software Development Tools • EPICS uses the GNU version of make – Almost

IOC Software Development Tools • EPICS uses the GNU version of make – Almost every directory from the <top> on down contains a ‘Makefile’ – Make recursively descends through the directory tree • Determines what needs to be [re]built • Invokes compilers and other tools as instructed in Makefile – GNU C/C++ compilers or vendor compilers can be used • No fancy ‘integrated development environment’

The ‘make. Base. App. pl’ program • Part of the EPICS Base distribution •

The ‘make. Base. App. pl’ program • Part of the EPICS Base distribution • Populates a new, or adds files to an existing, <top> area • Requires the environment variable EPICS_HOST_ARCH be set (EPICS base contains scripts which can set this as part of your login sequence) – linux-x 86, darwin-ppc, solaris-sparc, win 32 -x 86 • Creates a directory structure based on a selected template • Templates provided with Base include – ioc - A generic IOC application skeleton – example – An example IOC application

Creating a <top> directory structure • Running make. Base. App. pl using the example

Creating a <top> directory structure • Running make. Base. App. pl using the example template creates the following directories in the current directory, making it a <top> configure/ - Configuration files test. App/ - Files associated with the ‘test. App’ application Db/ - Databases, templates and substitution files src/ - Source code • Every directory contains a ‘Makefile’

<top>/configure files • Some may be modified as needed • CONFIG_SITE Specify make variables

<top>/configure files • Some may be modified as needed • CONFIG_SITE Specify make variables (e. g. to build for a particular target): CROSS_COMPILER_TARGET_ARCHS = vx. Works-68040 • RELEASE Point to other <top> areas used by this <top> area • Other files under configure/ are part of the (complex!) build system and should be left alone.

<top> directory structure • Running make. Base. App. pl from the <top> directory with

<top> directory structure • Running make. Base. App. pl from the <top> directory with a -i flag creates additional directories for an IOC to boot from ioc. Boot/ - Directory containing per-IOC boot directories ioctest/ - Boot directory for the ‘ioctest’ IOC

<top> directory structure after running make • Additional directories appear in <top> after running

<top> directory structure after running make • Additional directories appear in <top> after running make bin/ - Directory for per-architecture binary directories linux-x 86/ - Executables for this architecture lib/ - Directory for per-architecture library directories linux-x 86/ - Object libraries for this architecture dbd/ - Database definition files db/ - Database files (record instances, templates) • There may be other directories under bin/ and lib/, too.

IOC startup • IOCs read startup commands from a script – Typically ‘st. cmd’

IOC startup • IOCs read startup commands from a script – Typically ‘st. cmd’ in the <top>/ioc. Boot/<iocname>/ directory • On vx. Works IOCs the target shell usually executes these scripts • On other OS’s the EPICS iocsh shell does the execution • The command syntax is similar, but iocsh is less strict • Script was created by ‘make. Base. App. pl -i’ command • It must usually be edited by hand to add commands that configure hardware modules, start sequence programs, update log files, etc.

Example application startup script 1 #!. . /bin/linux-x 86/first 2 3 ## You may

Example application startup script 1 #!. . /bin/linux-x 86/first 2 3 ## You may have to change first to something else 4 ## everywhere it appears in this file 5 6 < env. Paths 7 8 cd ${TOP} 9 10 ## Register all support components 11 db. Load. Database("dbd/first. dbd") 12 first_register. Record. Device. Driver(pdbbase) 13 14 ## Load record instances 15 db. Load. Records("db/db. Example 1. db", "user=norume. Host") 16 db. Load. Records("db/db. Example 2. db", "user=norume. Host, no=1, scan=1 second") 17 db. Load. Records("db/db. Example 2. db", "user=norume. Host, no=2, scan=2 second") 18 db. Load. Records("db/db. Example 2. db", "user=norume. Host, no=3, scan=5 second") 19 db. Load. Records("db/db. Sub. Example. db", "user=norume. Host") 20 21 ## Set this to see messages from my. Sub 22 #var my. Sub. Debug 1 23 24 cd ${TOP}/ioc. Boot/${IOC} 25 ioc. Init() 26 27 ## Start any sequence programs 28 #seq snc. Example, "user=norume. Host”

Review • IOC applications can be host-based or target-based • The make. Base. App.

Review • IOC applications can be host-based or target-based • The make. Base. App. pl script is used to create IOC application modules and IOC startup directories • The <top>/configure/RELEASE file specifies the location of other <top> areas used by this <top> area • <top>/ioc. Boot/<iocname>/st. cmd is an IOC startup script • The EPICS build system requires the use of GNU make • vx. Works IOCs use the vx. Works shell, non-vx. Works IOCs use iocsh • The EPICS Application Developer’s Guide contains a wealth of information