-
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-02folder in/iocBoot/. - Navigate to the
config.xmlfile ofrefIOC. In01you will see macros being defined, in02you will see the01config file being referenced. Create aconfig.xmlfile inioc<newIOC>-IOC-02and do the same. - Check that there is a
st-common.cmdfile inioc<newIOC>-IOC-01- if there is, note how
st.cmdreferences this. Copy this file intoioc<newIOC>-IOC-02and refactor all instances of01to02. Then, where the file callsst-common.cmd, you will need to add a line that navigates to theioc<newIOC>-IOC-01directory above it (there will be an example of this inioc<refIOC>-IOC-02). - if there is not, note how the
st.cmdandst-common.cmdare set up inrefIOC. Inioc<newIOC>-IOC-01, transition thest.cmdcontents to ast-common.cmdfile and refactor thest.cmdto 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<...>,envPathsandrelPathsfiles. 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-02Appfolder in/<newIOC>/ - Navigate to
<newIOC>-IOC-01Appand copy acrossDbto the02Appfolder.- Empty the
O.folders of all.dbfiles. - Delete all
.substitutionsfiles 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-01Appand copy acrosssrcto the02Appfolder.- Empty the contents of both
O.folders. - Delete the
build.makfile - Rename the
<...>Main.cppfile with the correct IOC number, and rename the header in the file itself. - In the
Makefile, updateAPPNAMEwith the correct IOC number - but theinclude ...line needs to stay the same.
- Empty the contents of both
- Check whether
<newIOC>-IOC-01Apphas aprotocolfile- If it does, just copy this across. As far as I can see, the Makefiles and folder contents seem to be the same.
-
makethe<newIOC>folder -
make iocstartupsin 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.