# Presentation: 525697

## IOC Development Environment

- Marty Kraimer
- APS

## Reference

- EPICS IOC Applications
- Building
- and
- Source Release Control
- Marty Kraimer,Janet Anderson,Ralph Lange
- June 15, 1998

## Overview

- Create and build IOC applications
- databases
- vxWorks startup files
- SNL programs
- New record, device, driver support
- Access security configuration files
- Other IOC code
- Special Host code
- Source management features
- CVS can be used
- IOC software is divided into <top> areasEach <top> is separately managed
- gnumake + rules builds all components
- User prerequisites
- Understands C
- Knows how to use a text editor
- Has superficial knowledge of make

## <top> Directory Structure

- <top>/
- 	config/		Configuration + Rules
- 	xxxApp/		All source files except startup
- 		src/		Code
- 		xxxSrc/		Arbitrary number of xxxSrc
- 		Db/		Databases
- 		xxxDb		Arbitrary number of xxxDb
- 		...		May have others: adl, etc
- 	xxxApp/		Arbitrary number of xxxApp
- 	iocBoot/		Only one iocBoot
- 		iocxxx		Directory for each ioc
- 		...
- 	bin/			install directory
- 		<host_arch>/
- 		<target_arch>/
- 		...
- 	<other install directories>

## Install directories

- By default installed into <top>/<xxx>
- <top>
- 	bin/		Object and executables
- 		solaris/
- 		mv167/
- 	lib/		Object libraries
- 		<arch>
- 	include/	e.g. xxxRecord.h
- 	dbd/	menu, recordtype, device, driver,etc
- 	db/		record instances, templates, etc
- 	...

## gnumake

- make (gnumake) at any level
- <top>
- gnumake clean uninstall
- gnumakeBuilds and installs everything that is not up to date
- xxxApp
- gnumake <arguments>Same as issuing command in each subdirectory
- xxxApp/xxxSrc
- Builds in O.<arch>; Installs in <top>/<something>
- gnumakeBuilds and installs all out of date components
- <args>
- <arch>Build only for specified architecturegnumake mv167
- cleanRemove all O.<arch> directories
- xxxApp/xxxDbgenerates and installs database instance files + more
- iocBoot/iocxxxCreates the cdCommands file

## config files

- Files meant to be modified
- CONFIG - Can override make variablesCROSS_COMPILER_TARGET_ARCHS = mv167
- CONFIG_APPDefinitions for <top>s referenced in RELEASE
- RELEASELocation of other <top> areasEPICS_BASE=/usr/local/epics/baseR3.13.1
- Other files
- RULES.xxxFiles containing make rules
- *.plPerl scripts used by make rules
- Structure of shared <top> areas
- Just another <top>
- Everything intended for use by other <top>s is installed.

## xxxApp/src files

- base.dbd - definitions supplied by base
- get from base or other <top> and edit
- menu, recordtype, device, driver taken from base
- much support commented outinclude “menuGlobal.dbd”...#include “egRecord.dbd”...#device(ai,VME_IO,devAiXy566Se,”XYCOM-566 SE Scanned”)
- baseLIBOBJS - objects supplied by base
- get from base or other <top> and edit
- object modules for record, device, driver support
- Like base.dbd much support commented out
- changes made to this must match base.dbd

## base.dbd and baseLIBOBJS

- include "menuGlobal.dbd"
- include "menuConvert.dbd"
- include "aiRecord.dbd"
- #include "aaiRecord.dbd"
- include "aoRecord.dbd"
- #include "aaoRecord.dbd"
- device(ai,CONSTANT,devAiSoft,"Soft Channel")
- device(ai,CONSTANT,devAiSoftRaw,"Raw Soft Channel")
- #device(ai,VME_IO,devAiXy566Se,"XYCOM-566 SE Scanned")
- #driver(drvGpib)
- driver(drvBitBus)
- #driver(drvBb910)

- #LIBOBJS += $(EPICS_BASE_BIN)/aaiRecord.o
- #LIBOBJS += $(EPICS_BASE_BIN)/aaoRecord.o
- LIBOBJS += $(EPICS_BASE_BIN)/aiRecord.o
- LIBOBJS += $(EPICS_BASE_BIN)/aoRecord.o
- LIBOBJS += $(EPICS_BASE_BIN)/devAiSoft.o
- LIBOBJS += $(EPICS_BASE_BIN)/devAiSoftRaw.o
- #LIBOBJS += $(EPICS_BASE_BIN)/devAiXy566Se.o
- #LIBOBJS += $(EPICS_BASE_BIN)/drvBb910.o
- LIBOBJS += $(EPICS_BASE_BIN)/drvBitBus.o
- #LIBOBJS += $(EPICS_BASE_BIN)/drvGpib.o

- base.dbd

- baseLIBOBJS

## xxxApp/src continued

- Makefile.Host
- RECTYPES += xxxRecord.h
- DBDEXPAND += xxxInclude.dbd
- DBDNAME = xxxApp.dbd
- xxxInclude.dbd
- include “base.dbd”
- include “xxxRecord.dbd”
- device(xxx,CONSTANT,devXxxSoft,”Softchannel”)
- Makefile.Vx
- LIBOBJS += xxxRecord.o
- LIBOBJS += sncExample.o
- include ../baseLIBOBJS
- LIBNAME = xxxLib
- INSTALLS += iocCore seq
- PROD += xxx.o

## xxxApp/xxxDb/Makefile.Host

- databases installed into <top>/db
- DB += xxx.db
- Template files expanded on host
- yyy.template has the format
- record(ai,”$(USER):aiExample$(NO)”){... }
- yyy.substitutions
- file yyy.template {{USER=“mrk”,NO=“1”}{USER=“mrk”,NO=“2”}
- }
- DB += yyy.db
- USES_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

## iocBoot

- iocBoot/MakefileExecutes make in  each subdirectory
- iocBoot/iocxxx/MakefileCreates cdCommands. Make sure that
- ARCH = <arch>
- is defined correctly
- cdCommands looks like
- startup=“<full path to iocxxx>“
- appbin=“<full path to top/bin/arch>“
- ...
- st.cmd looks like
- < cdCommands
- cd appbin
- ld < iocCore
- ld < xxxLib
- cd startup
- dbLoadDatabase(“../../dbd/xxxApp.dbd”)
- dbLoadRecords(“../../db/xxx.db”,”user=mrk”)
- iocInit

## makeBaseApp

- Execute the commands
- cd ~/ioc
- mkdir example
- cd example
- <path>/makeBaseApp.pl -t example example
- <path>/makeBaseApp.pl -i -t example example
- The first command creates:
- <top>/
- 	Makefile
- 	config/
- 			...
- 	exampleApp	src/
- 			...
- 		Db/
- 			...
- The second command creates:
- <top>/iocBoot
- 	Makefile
- 	iocexample/
- 		...
- Each command can be issued multiple times
- Look at example!!!

## Application Templates

- makeBaseApp uses templates
- base supplies the following
- <base>/templates/makeBaseApp/top/Makefileconfig
- 	exampleAppexampleBootsimpleAppsimpleBoot
- Application templates can be created.
- <top>/config/RELEASE contains
- 		TEMPLATE_TOP = <full path to template top>
- Templates are just like another <top>