-
Notifications
You must be signed in to change notification settings - Fork 2
Duplicating IOCs
Wiki > The Backend System > Creating and Basics of IOCs > Duplicating IOCs
If you need more than 1 IOC (i.e. you are making the second IOC) there is only a process to follow, rather than a script, as various IOCs can have their own nuances: so take this with a grain of salt. Let us refer to the IOC you are duplicating as newIOC
, for clarity.
Navigate to an IOC folder which has two or more IOCs: here we have two folders to focus on, <ioc>/iocBoot/
and <ioc>/<ioc>-IOC-0<n>App
(where n
is the number of IOCs). Make sure this IOC has a st-common.cmd
file (to make your life easier!). Let us refer to this as refIOC
.
Now, let's get cracking!
- Create a new
ioc<newIOC>-IOC-02
folder in/iocBoot/
. - Navigate to the
config.xml
file ofrefIOC
. In01
you will see macros being defined, in02
you will see the01
config file being referenced. Create aconfig.xml
file inioc<newIOC>-IOC-02
and do the same. - Check that there is a
st-common.cmd
file inioc<newIOC>-IOC-01
- if there is, note how
st.cmd
references this. Copy this file intoioc<newIOC>-IOC-02
and refactor all instances of01
to02
. Then, where the file callsst-common.cmd
, you will need to add a line that navigates to theioc<newIOC>-IOC-01
directory above it (there will be an example of this inioc<refIOC>-IOC-02
). - if there is not, note how the
st.cmd
andst-common.cmd
are set up inrefIOC
. Inioc<newIOC>-IOC-01
, transition thest.cmd
contents to ast-common.cmd
file and refactor thest.cmd
to reference this in a similar way. Now follow the step above!
- if there is, note how
- Copy across the
Makefile
- this stays unchanged. - Copy across
dllPath<...>
,envPaths
andrelPaths
files. These also stay unchanged.
This one may be slightly less straightforward. There may be nuances and additional things in this folder to deal with that aren't mentioned below - either try find another IOC with similar oddities or ask someone!
- Create a new
<newIOC>-IOC-02App
folder in/<newIOC>/
- Navigate to
<newIOC>-IOC-01App
and copy acrossDb
to the02App
folder.- Empty the
O.
folders of all.db
files. - Delete all
.substitutions
files from top level. - In
Db\O.windows-x64\Makefile
, refactor the lineDB += something.db ...
with#DB += xxx.db
(e.g just comment it out)
- Empty the
- Navigate to
<newIOC>-IOC-01App
and copy acrosssrc
to the02App
folder.- Empty the contents of both
O.
folders. - Delete the
build.mak
file - Rename the
...Main.cpp
file with the correct IOC number, and rename the header in the file itself. - In the
Makefile
, updateAPPNAME
with the correct IOC number - but theinclude ...
line needs to stay the same.
- Empty the contents of both
-
make
thenewIOC
folder -
make iocstartups
in EPICS top - Try to run your new IOC!
Navigate to IOCTestframework
or the ioc/<newIOC>
folder (wherever the IOC tests live).
Refactor DEVICE_PREFIX
to newIOC_02
and you will need to refactor any calls to get_default_ioc_dir() with additional parameter iocnum
(or whatever the equivalent is in your test module, this should be pretty intuitive).
WARNING: If you will also be making more IOCs via the method below, you should be very confident that your new newIOC_02
behaves the same as newIOC_01
before duplicating: any issues with newIOC_02
will be propagated in every other new IOC you make as well.
If you need more than 2 IOCs there is a script to duplicate IOCs, more information can be found here.