Hi Martin,
I think the dbLoad* routines only support simple macro substitution and
not the
full msi feature set, so I think you're best trying to do this at build
time by invoking
msi twice.
The .db and .substitutions suffixes are significant as RULES.Db knows
how to build
%.db from %.substitutions, but I think you can use anything in place of
.template,
including another .db.
I solved this need for multiple substitutions several years ago by
creating a new
%.db: %.sub2 rule in my local Db/Makefile, but I think it's easier to do
this by having
two directories. For example, you could create a module for your
device that builds
mydevice.db, and then your ioc Db directory could have another
substitutions file
that creates a single db file w/ all 60 instances.
You could also create a deviceDb folder in your ioc/*App directory as
long as you
add a dependency so deviceDb gets built before Db.
Cheers,
- Bruce
On 4/4/2016 11:43 AM, Konrad, Martin wrote:
Hi all,
I need to create an EPICS database for a soft IOC with 60 identical
devices. Each of these devices has a set of records that are identical
for multiple inputs. Having the DRY pattern in mind, I was wondering if
I could somehow use two levels of DB templates. Here is what I have in mind:
st.cmd:
dbLoadTemplate("myproject.substitutions")
myproject.substitutions:
global { SYS=...,SUBSYS=... }
file mydevice.db {
pattern { ... }
{ ... }
{ ... }
}
mydevice.db:
<some records here>
substitute "INPUT=1"
include "myinput.db"
substitute "INPUT=2"
include "myinput.db"
myinput.db:
<a couple of records needed for each input>
A manual run of MSI tool on mydevice.db handles both the "substitute"
and the "include" keyword correctly but by default macro expansion is
done at dbLoadTemplate time. This however results in
Error: syntax error
at or before "substitute" in file "mydevice.db" line 16
It seems like dbLoadTemplate doesn't support the "substitute" keyword. I
found a BNF definition of the substitution file format in chapter 6.12.1
of the Application Developer's Guide [1]. Unfortunately I did not find a
definition like this for DB files/templates. Can you please help me out
here?
I am aware that I could use 60 dbLoadTemplate lines instead (that would
clutter IOC boot output, though). I could also pull in both mydevice.db
and myinput.db from the substitutions file directly - but for that I
need to add N lines referring to myinput.db in the substitution file for
each line referring to mydevice.db (assuming a device with N inputs). Is
there a nicer way to do this?
Thanks a lot,
Martin
P.S.: BTW: Is there a difference between a DB file and a template? Are
their file names supposed to have different suffix (".template" vs. ".db"?
[1] http://www.aps.anl.gov/epics/base/R3-15/3-docs/AppDevGuide.pdf
- References:
- Multiple layers of DB templates? Konrad, Martin
- Navigate by Date:
- Prev:
Re: Cross Compiling EPICS base for Xilinx Zynq, Petalinux- Recipe Steve Shoaf
- Next:
Re: Multiple layers of DB templates? Andrew Johnson
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
<2016>
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Multiple layers of DB templates? Konrad, Martin
- Next:
Re: Multiple layers of DB templates? Andrew Johnson
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
<2016>
2017
2018
2019
2020
2021
2022
2023
2024
|