Converting an EPICS R3.14.1 application to R3.14.2


This document describes how to convert a R3.14.1 application so that it builds with release R3.14.2.

Gnumake clean uninstall

First do a "gnumake clean uninstall" in the application's root directory to remove all files created by earlier builds.

INSTALL_LOCATION_APP

If your application is NOT being installed into $(TOP), move your INSTALL_LOCATION_APP definition to the configure/RELEASE file.

Building db files from templates changed

Now if the template needed to build <name>.db is not named <name>*.template add the line
 <name>_template = <templatename>
to the *Db/Makefile.

Remove any

USES_TEMPLATE =
definitions from your <name>App/*Db/Makefile files; these definitions are no longer used.

File base.dbd no longer needed

You now can add the line include "base.dbd" to your <appname>Include.dbd file and remove the file <name>App/src/base.dbd from your src directory. The base.dbd from R3.14.2 base/dbd will be included. However, if you only want a subset of record definitions from base you should keep your base.dbd file.

Record support

Add the following line after all existing #includes
#include "epicsExport.h"
The structure rset is now a typedef so change
struct rset RSET={ ...
to
rset RSET={ ...
and add the following line after the "rset <recordname>RSET=" definition.
epicsExportAddress(rset,xxxRSET);

Device support

Add the following line after all existing #includes
#include "epicsExport.h"
and add the following line after the dset dev<devname> definition
epicsExportAddress(dset,dev<devname>);

Driver support

Add the following line after all existing #includes
#include "epicsExport.h"
and add the following line after the drvet dev<devname> definition
epicsExportAddress(drvet,drv<devname>);

Registration code changed

Registration code for application specific functions, e.g. subroutine record init and process functions, has been changed as follows

1) Include the registration support header files:

#include "dbDefs.h"
#include "registryFunction.h"
2) Include the export definitions header file after including all other header files:
#include "epicsExport.h"
3) Make the application specific functions static functions, e.g.
static long mySubInit(subRecord *precord,processMethod process)
static long mySubProcess(subRecord *precord)
4) Define a registryFunctionRef array of the application specific functions to be registered, e.g.
static registryFunctionRef mySubRef[] = {
    {"mySubInit",(REGISTRYFUNCTION)mySubInit},
    {"mySubProcess",(REGISTRYFUNCTION)mySubProcess}
};
5) Add a new function to do the registration of the registryFunctionRef array elements, e.g.
void mySub(void)
{
    registryFunctionRefAdd(mySubRef,NELEMENTS(mySubRef));
}
6) Call the epicsExportRegistrar with the new registration function: e.g.
epicsExportRegistrar(mySub);
7) Remove the existing function lines in <appname>Include.dbd: e.g. remove
function("mySubInit")
function("mySubProcess")
8) Add a registrar statement to <name>Include.dbd with the new registration function as parameter: e.g. add
registrar("mySub")

<name>App/src/Makefile changed and simplified

1) Libraries from support modules defined in configure/RELEASE no longer need the <libname>_DIR definitions. You can remove lines like the following from your src/Makefile
ca_DIR           = $(EPICS_BASE_LIB)
Com_DIR          = $(EPICS_BASE_LIB)
2) Libraries from EPICS_BASE do not have to be specified individually. For HOST products and libraries specify the following
<myhostprodorlib>_LIBS += $(EPICS_BASE_HOST_LIBS)
For IOC products and libraries specify the following
<myiocprodorlib>_LIBS += $(EPICS_BASE_IOC_LIBS)
3) All record, device, and driver support must now exist in shared libraries. You will need to create an IOC library containing your application specific support.
LIBRARY_IOC += exampleIoc

exampleIoc_SRCS += xxxRecord.c
exampleIoc_SRCS += devXxxSoft.c
exampleIoc_SRCS += dbSubExample.c
exampleIoc_LIBS += $(EPICS_BASE_IOC_LIBS)
4) Add your new record, device, and driver support library to your ioc product's libraries: e.g.
PROD_IOC = example example_LIBS += exampleIoc example_LIBS += $(EPICS_BASE_IOC_LIBS)