<div style="text-align:right"><a style="font-size:smaller" href="/edit/Epics/SeqRecordsDelayTimingAndProcessing">edit</a></div>
<div style="text-align:right;font-size:smaller">EpicsTipsAndTricksMultipleIOCs <a href="/edit/Epics/EpicsTipsAndTricksMultipleIOCs">(edit)</a></div>
To have one PC / Computer per IOC/Server seems to be an annoying situation.
Solution would be to be able to have several IOCs running on a PC. But you will be faced by the following Problems
on the client site.
E.g. for MEDM:
<div style="text-align:right;font-size:smaller">EpicsTipsAndTricksCrisAxisAddtionForSeveralEpicsApplications <a href="/edit/Epics/EpicsTipsAndTricksCrisAxisAddtionForSeveralEpicsApplications">(edit)</a></div>
cris-axis addition for several EPICS applications
HOWTO build flex (libfl) for cris-axis crisv32-axis
Since some of the EPICS extensions and modules rely on libfl flex and the standard distribution of AXIS SDK doesn't contain the libfl.a this has to be added:
Prerequisites
Build & Installation
- set some helper variables:
export SRC_DIR=<Source Directory>
export DOWNLOAD_DIR=<Download Directory>
# provided cross compiler and SDK are installed here export ETRAX_DIR=<ETRAX Tools Directory>
- download sources from http://sourceforge.net/projects/flex/ (version 2.5.35) via direct link to
$DOWNLOAD_DIR
- unpack to
$SRC_DIR
mkdir -p ${SRC_DIR:?undefined} &&
cd SRC_DIR &&
tar -jxvf flex-2.5.35.tar.bz
- Source
cris-axis-setup.sh
,defining environment variables, e.g. AXIS_TOP_DIR
, and extending PATH
, needs ETRAX_DIR
to be defined. or just take its main code: oldpwd=$OLDPWD
base=$(pwd)
cd ${ETRAX_DIR:?undefined)/SDK && cd $(ls --color=never -t -1 -d devbo* | head -n 1) && . ./init_env
cd $base
cd ${ETRAX_DIR:?undefined)/ETRAX/compiler && . ./setup.sh
cd $oldpwd
cd $base
unset scriptname base oldpwd epicsDir
- Change to source directory
$SRC_DIR
cd ${SRC_DIR:?undefined}
- Since
configure
automatically sets for cross-compilers 'ac_cv_func_malloc_0_nonnull' and 'ac_cv_func_realloc_0_nonnull' to 'no', (since it cannot check it) those have to be configured by hand:
- cris-axis
-
export myTARGET=cris-axis-linux-gnu
-
make clean
-
./configure --prefix=${AXIS_TOP_DIR:?undefined}/target/${myTARGET:?defined}/usr --host=${myTARGET} --build=i686-pc-linux-gnu ac_cv_func_realloc_0_nonnull=yes ac_cv_func_malloc_0_nonnull=yes
-
make
-
make install
- crisv32-axis
-
export myTARGET=crisv32-axis-linux-gnu
-
make clean
-
./configure --prefix=${AXIS_TOP_DIR:?undefined}/target/${myTARGET:?defined}/usr --host=${myTARGET} --build=i686-pc-linux-gnu ac_cv_func_realloc_0_nonnull=yes ac_cv_func_malloc_0_nonnull=yes
-
make
-
make install
Compact
export SRC_DIR=<Source Directory>
export DOWNLOAD_DIR=<Download Directory>
# provided cross compiler and SDK are installed here
export ETRAX_DIR=<ETRAX Tools Directory>
mkdir -p ${DOWNLOAD_DIR:?undefined} &&
wget http://prdownloads.sourceforge.net/flex/flex-2.5.35.tar.bz2?download
mkdir -p ${SRC_DIR:?undefined} &&
cd SRC_DIR &&
tar -jxvf flex-2.5.35.tar.bz
oldpwd=$OLDPWD
base=$(pwd)
cd ${ETRAX_DIR:?undefined)/SDK && cd $(ls --color=never -t -1 -d devbo* | head -n 1) && . ./init_env
cd $base
cd ${ETRAX_DIR:?undefined)/ETRAX/compiler && . ./setup.sh
cd $oldpwd
cd $base
unset scriptname base oldpwd epicsDir
# crisv-axis
export myTARGET=cris-axis-linux-gnu
cd ${SRC_DIR:?undefined} &&
make clean
./configure --prefix=${AXIS_TOP_DIR:?undefined}/target/${myTARGET:?defined}/usr --host=${myTARGET} --build=i686-pc-linux-gnu ac_cv_func_realloc_0_nonnull=yes ac_cv_func_malloc_0_nonnull=yes &&
make && make install
# crisv32-axis
export myTARGET=crisv32-axis-linux-gnu
cd ${SRC_DIR:?undefined} &&
make clean
./configure --prefix=${AXIS_TOP_DIR:?undefined}/target/${myTARGET:?defined}/usr --host=${myTARGET} --build=i686-pc-linux-gnu ac_cv_func_realloc_0_nonnull=yes ac_cv_func_malloc_0_nonnull=yes &&
make && make install
<div style="text-align:right;font-size:smaller">EpicsTipsAndTricksNewIocCommand <a href="/edit/Epics/EpicsTipsAndTricksNewIocCommand">(edit)</a></div>
new IOC command
The general way how to add a new IOC command, which can be used inside the IOC Shell is described in Chapter 18.3
IOC Shell - IOC Shell Programming of the
IOC Application Developer's Guide (3.14.9).
Here is an example (with the help of
BK) to make the command
dumpTable(mbo, dac, channel, type)
available at the IOC shell.
#include <epicsExport.h>
/* ... */
/***************************************************************************/
static void dumpTable(int mbo, int dac, int channel, short type)
{
/* some function code */
/* ... */
}
/***************************************************************************/
/* Information needed by iocsh */
/* Argument definition */
static const iocshArg dumpTableArg0 = {"mbo number", iocshArgInt};
static const iocshArg dumpTableArg1 = {"dac number", iocshArgInt};
static const iocshArg dumpTableArg2 = {"channel number", iocshArgInt};
static const iocshArg dumpTableArg3 = {"table type", iocshArgInt};
static const iocshArg *dumpTableArgs[] =
{
&dumpTableArg0,
&dumpTableArg1,
&dumpTableArg2,
&dumpTableArg3
};
/* Function definition */
static const iocshFuncDef dumpTableFuncDef = {"dumpTable", 4, dumpTableArgs};
/* Wrapper called by iocsh, selects the argument types that dumpTable needs */
static void dumpTableCallFunc(const iocshArgBuf *args) {
dumpTable(args[0].ival, args[1].ival, args[2].ival, args[3].ival);
}
/* Registration routine, runs at startup */
static void dumpTableRegister(void) {
iocshRegister(&dumpTableFuncDef, dumpTableCallFunc);
}
epicsExportRegistrar(dumpTableRegister);
variable(mySubDebug)
...
registrar(dumpTableRegister)
<div style="text-align:right;font-size:smaller">EpicsTipsAndTricksUseOfMsiWithMultipleTempleateFiles <a href="/edit/Epics/EpicsTipsAndTricksUseOfMsiWithMultipleTempleateFiles">(edit)</a></div>
use of msi with multiple template files
To produce a single db file from multiple template files it is sufficient to include in the Makefile in the app/Db directory the line with the name of the db. This should be a not existing file (because it will be produced). Existing must be the corresponding substitutions file and the template file(s). In case that the substitutions file calls to a multiple template files is necessary to have an independent name from them, otherwise the generated db file will be only based on the same name template file.
Be aware that none of the template files should have the same name as the substitutions file.
Example: To make a db called vulom_1.db use a file vulom_1.substitutions which references for instance vulom.template, vulomreg.template, and vulomreg1.template
vulom_1.substitutions:
file vulom.template {
{ PRE=HAD, NN="0", MM="1"}
}
file vulomreg.template {
{ PRE=HAD, NN="0", MM="1", CC="Del_0", AA="0", LIM="49.5", GAIN="3.3", LLIM="0"}
{ PRE=HAD, NN="0", MM="1", CC="Del_1", AA="1", LIM="49.5", GAIN="3.3", LLIM="0"}
}
file vulomreg1.template {
{ PRE=HAD, NN="0", MM="1", CC="Down_0", AA="7", LIM="15", GAIN="1"}
{ PRE=HAD, NN="0", MM="1", CC="Down_1", AA="8", LIM="15", GAIN="1"}
}
The Makefile should contain a line
DB += vulom_1.db
additional Dependencies
Adding the line in the Makefile
vulom_1_DEPENDS ?= $(shell perl -n -e 'if (/file\s+(\w+.template)/) {print "$$1 \n";}' vulom_1.substitutions )
right after the previous
DB += vulom_1.db
enables EPICS to check for dependencies (q.v.
IOC Application Developer's Guide - 3.14.9 Chapter 4.6.4):
If a <name> substitutions file contains "file" references to other input files, these referenced files should be made
dependencies of the created <name>.db by adding a dependency definition line:
<name>_DEPENDS = <filename1> <filename2> ...
--
PeterZumbruch - 2017-03-31