Table of Contents Previous Chapter Chapter 5: User Interface
This chapter explains how to create an application that uses base products. This normally means IOC applications. Channel access client extensions can also be executed in this environment.
The environment described here is fine for small applications and for testing. If you have a large application there is an extension product (Application Source/Release Control System) that provides a much more complete environment.
Execute the following commands:
mkdir <appdir>
cd <appdir>
You will need a vxWorks startup script file. The following is a sample:
# vxWorks startup script to load and execute system (iocCore) software.
ld < targetmv167/iocCore
ld < targetmv167/drvSup
ld < targetmv167/devSup
ld < targetmv167/recSup
ld < src/O.mv167/myobj1.o
ld < src/O.mv167/myobj2.o
dbLoad "default.dctsdr"
dbLoadRecords "<app1>.db"
dbLoadRecords "<app2>.db"
iocLogDisable=1
iocInit
<app1>.db and <app2>.db are database files created in gdct database format.
If this is a new application or if you want to use a new base release execute the command:
<epics_path>/base/tools/getrel <epics_path> <iocarch> [<iocarch>]
where <epics_path> is the location of an EPICS tree. For example if you want release 3.12 and you have an mv167 IOC processor then issue the command:
/usr/local/epics/R3.12/base/tools/getrel /usr/local/epics/R3.12 mv167
After issuing this command issue the ls command. You will see that getrel created several soft links for you. These links allow you to:
- Create, load, and execute IOC databases and sequence programs,
- Create and use private record/device/driver support,
- Create and use other IOC software.
You can also build Unix code in this environment but you might prefer to do this in an extension development environment. Included are the soft links:
- ascii - This is a directory containing all the ASCII files that are part of the release.
- base - This is the base directory tree for the release.
- config - This is a soft link to the config files used to generate the release.
- default.dctsdr - The file used by database configuration tools and by the IOC for obtaining the information contained in the ascii files. Note that if you run makesdr (see the next section) this soft link will be replaced by a hard file.
- default.sdrsum - A file containing checksum output from the command:
"sum default.dctsdr".
- include - A soft link to the include files that belong to the release.
- targetmv167 - This is a soft link to the base/bin directory for the mv167. Similar links are developed for each architecture requested by the getrel command.
- vxWorksmv167 - A soft link to the vxWorks image for the mv167.
The following are sample IOC boot parameters.
boot device : ei
processor number : 0
host name : <boot host name>
file name : <full path name to your app dir>/vxWorksmv167
inet on ethernet (e) : <inet address of ioc>:ffffff00
inet on backplane (b):
host inet (h) : <inet address of host>
gateway inet (g) :
user (u) : <userid for ioc>
ftp password (pw) (blank = use rsh): <password for ioc>
flags (f) : 0x0
target name (tn) :
startup script (s) : st.cmdmv167
other (o) :
The getrel environment allows you to create private record/device/driver support as well as override the support provided with a release. The first step is to create two directories:
- replace_ascii
This directory contains any ASCII files, supplied with a release, that you want to completely replace. PLEASE THINK HARD BEFORE DOING THIS. Normally you should not replace EPICS supplied support. Note that getrel created a file "ascii" which is a soft link to the ASCII files supplied as part of a release.
- cat_ascii
This directory contains two types of files: The first is files that should be concatenated to the end of the corresponding file located via the ascii soft link. The second type of file is new ASCII files such as files defining new record types.
As an example let's say that you want to create:
- A new record type called myRecord.
- Device support for the new record called devMyRecord.
- A new driver called myDriver.
The following files are placed in cat_ascii:
After you have created or modified the local ASCII files (or after a new getrel) then just execute the command:
makesdr
This command creates the file default.dctsdr which contains the information from all the ASCII files including yours. It also creates a directory sdrH/rec, which contains all the record type header files.
If you want to develop private components for use on Unix and/or in an IOC (record support, etc.) then it is a good idea to create a subdirectory called src. It is then possible to create makefiles that use base development configuration files. This document describes these configuration files in Chapter 8, Section "Configuration Files" on page 37. The following samples are intended to show how simple makefiles can be. The following makefiles assume that they and all the source files reside in a directory one level below where getrel is executed.
Components for all site supported architectures will be built in automatically generated O.<arch> subdirectories via the command "gmake" from the src directory.
The Makefiles for building the private source files have the same structure and features as the Makefiles described in Chapter 6, Section "Using EPICS Makefiles" on page 24 and Chapter 6, Section "Creating High-level Makefiles" on page 25, except that the default rule has been set to "build" instead of "install" because "install" is not meaningful when in an application directory.
Makefile
EPICS=..
include $(EPICS)/config/CONFIG_BASE
default: build
include $(EPICS)/config/RULES_ARCHS
Makefile.Vx
Execution of this Makefile is from O.<arch> subdirectory.
EPICS=../..
include Target.include
include $(EPICS)/config/CONFIG_BASE
USR_INCLUDES = -I$(EPICS)/replace_ascii -I$(EPICS)/cat_ascii \
-I$(EPICS)/sdrH/rec -I$(EPICS)/include/rec
SRCS.C = ../<src1>.c ../<src2>.c ../<src3>.c ../<src4>.c
TARGETS = <src1>.o <src2>.o <src3>.o <src4>.o
default: build
include $(EPICS)/config/RULES.Vx
Makefile.Unix
Execution of this Makefile is from the O.<arch> subdirectory.
EPICS=../..
include Target.include
include $(EPICS)/config/CONFIG_BASE
DEPLIBS = $(EPICS_BASE_LIB)/libca.a $(EPICS_BASE_LIB)/libCom.a
USR_LDLIBS = -lca -lCom
SRCS.c = ../src1.c ../src2.c ../src3.c
OBJS = obj1.c obj2.c obj3.c
TARGETS = target
default: build
include $(EPICS)/config/RULES.Unix
target: $(OBJS) $(DEPLIBS)
$(RM) $@
$(LINK.c) -o $@ ${OBJS} $(LDLIBS)
Table of Contents Next Chapter