Files
pcas/documentation/ConvertingR3.14.1AppsToR3.14.2.html
2003-04-09 13:39:33 +00:00

244 lines
6.7 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="jba">
</head>
<body>
<center>
<h2>Converting an EPICS R3.14.1 application to R3.14.2</h2>
</center>
<p>This document describes how to convert a R3.14.1 application so that it
builds with release R3.14.2.</p>
<p><span style="font-weight: bold">MAJOR CHANGE since 3.14.1</span></p>
<p>The base supplied record and device support are now build as regular
libraries rather than as just object files. This allows simplified build
ruiles. The changes do require changes to:</p>
<ul>
<li>any record, device, or driver support you provide.</li>
<li>changes to any subroutines for subRecord.</li>
<li>replace any DBD <span style="font-family: courier">function</span>
statements with <span style="font-family: courier">register</span>
statements</li>
</ul>
<p>Please read the new chapter "Getting Started" of the Application
Developer's Guide for more information about building support and ioc
applications.</p>
<h3>Gnumake clean uninstall</h3>
<blockquote>
First do a "<tt>gnumake clean uninstall"</tt> in the application's root
directory to remove all files created by earlier builds.</blockquote>
<h3>INSTALL_LOCATION_APP</h3>
<blockquote>
If your application is NOT being installed into $(TOP), move your
INSTALL_LOCATION_APP definition to the configure/RELEASE file.</blockquote>
<h3>Building db files from templates changed</h3>
<blockquote>
Now if the template needed to build &lt;name&gt;.db is not named
&lt;name&gt;*.template add the line
<blockquote>
<pre> &lt;name&gt;_template = &lt;templatename&gt;</pre>
</blockquote>
to the *Db/Makefile.
<p>Remove any</p>
<blockquote>
<pre>USES_TEMPLATE =</pre>
</blockquote>
definitions from your &lt;name&gt;App/*Db/Makefile files; these definitions
are no longer used.</blockquote>
<h3>File base.dbd no longer needed</h3>
<blockquote>
You now can add the line include "base.dbd" to your
&lt;appname&gt;Include.dbd file and remove the file
&lt;name&gt;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.</blockquote>
<h3>Record support</h3>
<blockquote>
Add the following line after all existing #includes
<blockquote>
<pre>#include "epicsExport.h"</pre>
</blockquote>
The structure rset is now a typedef so change
<blockquote>
<pre>struct rset <recordname>RSET={ ...</pre>
</blockquote>
to
<blockquote>
<pre>rset <recordname>RSET={ ...</pre>
</blockquote>
and add the following line after the "rset &lt;recordname&gt;RSET="
definition.
<blockquote>
<pre>epicsExportAddress(rset,xxxRSET);</pre>
</blockquote>
</blockquote>
<h3>Device support</h3>
<blockquote>
Add the following line after all existing #includes
<blockquote>
<pre>#include "epicsExport.h"</pre>
</blockquote>
and add the following line after the dset dev&lt;devname&gt; definition
<blockquote>
<pre>epicsExportAddress(dset,dev&lt;devname&gt;);</pre>
</blockquote>
</blockquote>
<h3>Driver support</h3>
<blockquote>
Add the following line after all existing #includes
<blockquote>
<pre>#include "epicsExport.h"</pre>
</blockquote>
and add the following line after the drvet dev&lt;devname&gt; definition
<blockquote>
<pre>epicsExportAddress(drvet,drv&lt;devname&gt;);</pre>
</blockquote>
</blockquote>
<h3>Registration code changed</h3>
<blockquote>
Registration code for application specific functions, e.g. subroutine
record init and process functions, has been changed as follows
<p>1) Include the registration support header files:</p>
<blockquote>
<pre>#include "dbDefs.h"
#include "registryFunction.h"</pre>
</blockquote>
2) Include the export definitions header file after including all other
header files:
<blockquote>
<pre>#include "epicsExport.h"</pre>
</blockquote>
3) Make the application specific functions static functions, e.g.
<blockquote>
<pre>static long mySubInit(subRecord *precord,processMethod process)
static long mySubProcess(subRecord *precord)</pre>
</blockquote>
4) Define a registryFunctionRef array of the application specific functions
to be registered, e.g.
<blockquote>
<pre>static registryFunctionRef mySubRef[] = {
{"mySubInit",(REGISTRYFUNCTION)mySubInit},
{"mySubProcess",(REGISTRYFUNCTION)mySubProcess}
};</pre>
</blockquote>
5) Add a new function to do the registration of the registryFunctionRef
array elements, e.g.
<blockquote>
<pre>void mySub(void)
{
registryFunctionRefAdd(mySubRef,NELEMENTS(mySubRef));
}</pre>
</blockquote>
6) Call the epicsExportRegistrar with the new registration function: e.g.
<blockquote>
<pre>epicsExportRegistrar(mySub);</pre>
</blockquote>
7) Remove the existing function lines in &lt;appname&gt;Include.dbd: e.g.
remove
<blockquote>
<pre>function("mySubInit")
function("mySubProcess")</pre>
</blockquote>
8) Add a registrar statement to &lt;name&gt;Include.dbd with the new
registration function as parameter: e.g. add
<blockquote>
<pre>registrar("mySub")</pre>
</blockquote>
</blockquote>
<h3>&lt;name&gt;App/src/Makefile changed and simplified</h3>
<blockquote>
1) Libraries from support modules defined in configure/RELEASE no longer
need the &lt;libname&gt;_DIR definitions. You can remove lines like the
following from your src/Makefile
<blockquote>
<pre>ca_DIR = $(EPICS_BASE_LIB)
Com_DIR = $(EPICS_BASE_LIB)</pre>
</blockquote>
2) Libraries from EPICS_BASE do not have to be specified individually. For
HOST products and libraries specify the following
<blockquote>
<pre>&lt;myhostprodorlib&gt;_LIBS += $(EPICS_BASE_HOST_LIBS)</pre>
</blockquote>
For IOC products and libraries specify the following
<blockquote>
<pre>&lt;myiocprodorlib&gt;_LIBS += $(EPICS_BASE_IOC_LIBS)</pre>
</blockquote>
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.
<blockquote>
<pre>LIBRARY_IOC += exampleIoc
exampleIoc_SRCS += xxxRecord.c
exampleIoc_SRCS += devXxxSoft.c
exampleIoc_SRCS += dbSubExample.c
exampleIoc_LIBS += $(EPICS_BASE_IOC_LIBS)</pre>
</blockquote>
4) Add your new record, device, and driver support library to your ioc
product's libraries: e.g.
<pre>
<blockquote>
PROD_IOC = example
example_LIBS += exampleIoc
example_LIBS += $(EPICS_BASE_IOC_LIBS)</blockquote>
</pre>
</blockquote>
</body>
</html>