diff --git a/startup.script_common b/startup.script_common index 52af519..02cd6fc 100644 --- a/startup.script_common +++ b/startup.script_common @@ -1,38 +1,45 @@ -# $Source: /cvs/A/CS/startup/startup.script_common,v $ -# This is the common part of all startup scripts +# This is the common part of all vxWorks startup scripts # It is included by all generated scripts # The following variables should be set before: -# * INSTBASE where to boot from -# * EPICS the epics release (e.g "R3.13.9") +# * EPICS the epics release (e.g "R3.14.12") EPICS_MODULES = "/ioc/modules" -# find a better way later to know current require version -REQUIRE_VERSION="2.9.2" +# Find a better way later to know current require version +REQUIRE_VERSION="2.10.9" -#set EPICS_HOST_ARCH according to vxWorks version and cpu type +# Set EPICS_HOST_ARCH according to vxWorks version and cpu type VX6=(*runtimeVersion>>24)&255-'5' VMI=(*runtimeVersion>>8)&255 EPICS_HOST_ARCH=malloc(16) -sprintf(EPICS_HOST_ARCH,"%s%c-ppc60%d",VX6?"V6":"T",VX6?VMI:VMI>'3'?'2':'1',sysCpu-90) +sprintf EPICS_HOST_ARCH, "%s%c-ppc60%d", VX6 ? "V6" : "T", VX6 ? VMI : VMI>'3' ? '2' : '1', sysCpu-90 +printf "EPICS_HOST_ARCH = %s\n",EPICS_HOST_ARCH -#set target name as IOC name +# Set target name as IOC name IOC=&sysBootParams+60 +printf "IOC = %s\n",IOC BOOTPC=&sysBootHost +printf "BOOTPC = %s\n",BOOTPC STRINGBUFFER=malloc(256) -# set the prompt + +# Set the prompt sprintf STRINGBUFFER, "%s (startup.script aborted) > ", IOC shellPromptSet STRINGBUFFER # Set DNS if necessary -resolvInit "129.129.190.11","psi.ch" +resolvInit "129.129.190.11", "psi.ch" -# do the NFS mounts and other network dependend stuff -< ../../startup/network +# autoSR location +putenv "SRBASE=/ioc/data" +# Do the NFS mounts and other network dependend stuff +nfsAuthUnixSet &sysBootHost,500,9102 +< /ioc/startup/network + +# Set environment variables sprintf STRINGBUFFER, "IOC=%s", IOC putenv STRINGBUFFER @@ -42,10 +49,7 @@ putenv STRINGBUFFER sprintf STRINGBUFFER, "EPICS_HOST_ARCH=%s", EPICS_HOST_ARCH putenv STRINGBUFFER -# create some path variables -BASEBIN=malloc(80) -sprintf BASEBIN, "/epics/base-%s/bin/%s", EPICS+1, EPICS_HOST_ARCH - +# Create some path variables HOME=malloc(80) sprintf HOME, "/ioc/%s", IOC sprintf STRINGBUFFER, "HOME=%s", HOME @@ -60,63 +64,58 @@ putenv STRINGBUFFER STREAM_PROTOCOL_DIR=malloc(80) sprintf STREAM_PROTOCOL_DIR, "%s/cfg", HOME -LIB=malloc(80) -sprintf LIB, "%s/iocBoot/%s/%s", INSTBASE, EPICS, EPICS_HOST_ARCH - -DBD=malloc(80) -sprintf DBD, "dbd:%s/iocBoot/%s/dbd", INSTBASE, EPICS - -sprintf STRINGBUFFER, "EPICS_DRIVER_PATH=.:bin/%s_%s:bin:snl:%s:%s", EPICS, EPICS_HOST_ARCH, EPICS_MODULES, LIB +sprintf STRINGBUFFER, "EPICS_DRIVER_PATH=.:bin/%s_%s:bin:snl:%s", EPICS, EPICS_HOST_ARCH, EPICS_MODULES putenv STRINGBUFFER -TEMPLATES=malloc(80) -sprintf TEMPLATES, ".:%s/iocBoot/templates", INSTBASE - # Release memory above 32 MB # Code loaded after this must be compiled with -mlongcall # at the moment snp24 does not work with this -memAddToPool (sysMemTop(),sysPhysMemTop()-sysMemTop()) +memAddToPool sysMemTop(),sysPhysMemTop()-sysMemTop() EXTENDED_MEMORY=0 -# Setup Time -# 2019: -putenv "EPICS_TIMEZONE=MET::-60:033102:102703" -putenv "EPICS_TS_MIN_WEST=-60" +# Need to branch a few times on EPICS base release +R3_13 = strncmp(EPICS,"R3.13.",6)==0 +R3_14 = strncmp(EPICS,"R3.14.",6)==0 +R3_14_8 = strcmp(EPICS,"R3.14.8")==0 +R3_15 = strncmp(EPICS,"R3.15.",6)==0 +R3 = strncmp(EPICS,"R3.",3)==0 +R7 = strncmp(EPICS,"R7.",3)==0 + +# Time server (must be set before loading iocCoreLibrary.munch for 3.14.12) +# Need EPICS_TS_FORCE_NTPTIME for 7.0 putenv "EPICS_TS_NTP_INET=129.129.190.1" putenv "EPICS_TS_FORCE_NTPTIME=YES" -# Need to branch a few times on EPICS base release -R3_13=strncmp(EPICS,"R3.13.",6)==0 -R3_14=strncmp(EPICS,"R3.14.",6)==0 - # Load EPICS system core (different names for different EPICS versions) -# Unfortunately we have no 'if' and line length is quite limited -# 3.13: load "iocCore" -# 3.14: load "iocCoreLibrary.munch" -# 3.15+: load "softIoc.munch" (could do this from 3.14.12 on) -sprintf STRINGBUFFER, "%s/%s",BASEBIN,R3_13?"iocCore":R3_14?"iocCoreLibrary.munch":"softIoc.munch" +# 3.13: "iocCore" +# 3.14: "iocCoreLibrary.munch" +# 3.15+: "softIoc.munch" (could do this from 3.14.12 on) +EPICS_APP = R3_13 ? "iocCore" : R3_14 ? "iocCoreLibrary.munch" : "softIoc.munch" +sprintf STRINGBUFFER, "/epics/base-%s/bin/%s/%s", EPICS+1, EPICS_HOST_ARCH, EPICS_APP printf "loading %s\n",STRINGBUFFER ld 0, 0, STRINGBUFFER +# Setup Time (must be set after loading iocCoreLibrary.munch) +# 2021: +putenv "EPICS_TIMEZONE=MET::-60:032802:103103" +putenv "TIMEZONE=MET::-60:032802:103103" +putenv "EPICS_TS_MIN_WEST=-60" + +# Allow backward compatible non-monotonic breaktables +dbBptNotMonotonic=1 + # Start Logging -putenv "EPICS_IOC_LOG_INET=gfa-syslog" -putenv "EPICS_IOC_LOG_PORT=1514" +putenv getenv("EPICS_IOC_LOG_INET") ? "" : "EPICS_IOC_LOG_INET=gfa-syslog" +putenv getenv("EPICS_IOC_LOG_PORT") ? "" : "EPICS_IOC_LOG_PORT=1514" +sprintf STRINGBUFFER, R3_13||R3_14_8 ? "putenv \"EPICS_CA_PUT_LOG_PREFIX=%s\"" : "iocLogPrefix \"%s \"", IOC +execute STRINGBUFFER iocLogInit errlogPrintf "Starting EPICS %s\n", EPICS -# Allow backward compatible non-monotonic breaktables for EPICS > 3.14.8 -dbBptNotMonotonic=1 - -# try for user-defined menus scan and convert -dbLoadDatabase "dbd/scan.dbd" -dbLoadDatabase "dbd/convert.dbd" -dbLoadDatabase "dbd/slsConvert.dbd" -taskDelay sysClkRateGet() - -sprintf STRINGBUFFER,R3_13||R3_14?";":"dbLoadDatabase \"/epics/base-%s/dbd/softIoc.dbd\"",EPICS+1 +sprintf STRINGBUFFER, R3_13||R3_14 ? ";" : "dbLoadDatabase \"/epics/base-%s/dbd/softIoc.dbd\"", EPICS+1 execute STRINGBUFFER -sprintf STRINGBUFFER,R3_13||R3_14?";":"softIoc_registerRecordDeviceDriver pdbbase" +sprintf STRINGBUFFER, R3_13||R3_14 ? ";" : "softIoc_registerRecordDeviceDriver pdbbase" execute STRINGBUFFER # load "require" @@ -130,30 +129,12 @@ ld 0, 0, STRINGBUFFER #load standard drivers (allow user to specify version in environment variable) require "base", getenv("base_VERSION") ? getenv("base_VERSION") : "ifexists" registerModule "require", getenv("require_VERSION"), getenv("require_DIR") -sprintf STRINGBUFFER,R3_13?";":"require_registerRecordDeviceDriver pdbbase" +sprintf STRINGBUFFER, R3_13 ? ";" : "require_registerRecordDeviceDriver pdbbase" execute STRINGBUFFER require "utilities", getenv("utilities_VERSION") require "misc", getenv("misc_VERSION") -# caPutLog -#putenv "EPICS_CA_PUT_LOG_ADDR=gfa-syslog:1515 sf-logstash.psi.ch:1515" -sprintf STRINGBUFFER, "EPICS_CA_PUT_LOG_PREFIX=%s",IOC -putenv STRINGBUFFER -require "caPutLog", getenv("caPutLog_VERSION")?getenv("caPutLog_VERSION"):"ifexists" - -# IOC monitoring -require R3_13||R3_14?"iocmon":"iocStats", getenv(R3_13||R3_14?"iocmon_VERSION":"iocStats_VERSION") - -# Battery monitoring -require "M48T37", "ifexists" - -# Database Upload -require "iocinfo", getenv("iocinfo_VERSION")?getenv("iocinfo_VERSION"):"ifexists" - -# Sequencer for backward compatibility with missing dependencies -require "seq", R3_13||R3_14?"2.0":"none" - -# run EPICS only on 1st network port +# Run Channel Access only on 1st network port putenv "EPICS_CA_AUTO_ADDR_LIST=NO" putenv bootInfo("EPICS_CA_ADDR_LIST=%B") putenv bootInfo("EPICS_CAS_INTF_ADDR_LIST=%e") @@ -161,7 +142,7 @@ putenv "EPICS_CAS_AUTO_BEACON_ADDR_LIST=NO" putenv bootInfo("EPICS_CAS_BEACON_ADDR_LIST=%B") # EPICS 3.13 needs this to not use synchronized timestamps -sprintf STRINGBUFFER,R3_13?"TSconfigure(0,10,10,18323,18322,250,1)":";" +sprintf STRINGBUFFER, R3_13 ? "TSconfigure(0,10,10,18323,18322,250,1)" : ";" execute STRINGBUFFER -# end of startup.script_common +# End of startup.script_common diff --git a/startup.script_linux b/startup.script_linux index 268cfdc..80ab1f4 100644 --- a/startup.script_linux +++ b/startup.script_linux @@ -1,7 +1,19 @@ # set EPICS according to BASE or default to 3.14.12 -epicsEnvSet EPICS, R$(BASE=3.14.12) +epicsEnvSet EPICS, R$(EPICS_RELEASE=$(BASE=3.14.12)) -# set up CA search lists for different networks +# Start Logging +date "epicsEnvSet IOC_STARTTIME %Y-%m-%dT%H:%M:%S" > /tmp/$(IOC).starttime +< /tmp/$(IOC).starttime +system "rm /tmp/$(IOC).starttime" +epicsEnvSet EPICS_IOC_LOG_INET, $(EPICS_IOC_LOG_INET=gfa-syslog) +epicsEnvSet EPICS_IOC_LOG_PORT, $(EPICS_IOC_LOG_PORT=1514) + +# iocLogPrefix will fail for EPICS 3 but that's OK +iocLogPrefix "$(IOC) " +iocLogInit +errlog "starting EPICS $(EPICS) at $(IOC_STARTTIME)" + +# Set up CA search lists for different networks # Office (only officicial EPICS subnets, not SLS beamlines!) epicsEnvSet CA_129.129.130,"129.129.131.255 129.129.137.255" @@ -50,23 +62,28 @@ epicsEnvSet EPICS_CAS_BEACON_ADDR_LIST,"$(CA_BEACON_$(NET1=).$(NET2=).$(NET3=)=$ epicsEnvSet EPICS_CAS_AUTO_BEACON_ADDR_LIST,"$(CA_AUTO_BEACON_$(NET1=).$(NET2=).$(NET3=)=$(CA_AUTO_BEACON_$(NET1=).$(NET2=)=$(EPICS_CA_AUTO_ADDR_LIST)))" # set some search paths -epicsEnvSet EPICS_DRIVER_PATH "bin/R$(EPICS_RELEASE)_$(EPICS_HOST_ARCH):bin:snl:$(EPICS_MODULES=/ioc/modules):$(INSTBASE)/iocBoot/R$(EPICS_RELEASE)/$(EPICS_HOST_ARCH)" -epicsEnvSet TEMPLATES, $(INSTBASE)/iocBoot/templates +epicsEnvSet EPICS_DRIVER_PATH "bin/R$(EPICS_RELEASE)_$(EPICS_HOST_ARCH):bin:snl:$(EPICS_MODULES=/ioc/modules)" epicsEnvSet CFG, $(PWD)/cfg epicsEnvSet STREAM_PROTOCOL_PATH, .:$(PWD)/cfg +# Allow non-monotonic breaktables +var dbBptNotMonotonic 1 + # IOC monitoring require iocStats $(iocStats_VERSION=ifexists) # Database Upload require iocinfo $(iocinfo_VERSION=ifexists) -# Logging -epicsEnvSet EPICS_IOC_LOG_INET, gfa-syslog -epicsEnvSet EPICS_IOC_LOG_PORT, 1514 -iocLogInit -epicsEnvSet EPICS_CA_PUT_LOG_ADDR, "gfa-syslog:1515 sf-logstash.psi.ch:1515" -epicsEnvSet EPICS_CA_PUT_LOG_PREFIX, $(IOC) +# caPutLog +epicsEnvSet EPICS_CA_PUT_LOG_ADDR, "gfa-syslog:1515 gfa-logstash.psi.ch:1515" +# Set EPICS_CA_PUT_LOG_PREFIX for EPICS 3 but not for 7 because there we have iocLogPrefix +epicsEnvSet EPICS_CA_PUT_LOG_PREFIX_CMD_3 "epicsEnvSet EPICS_CA_PUT_LOG_PREFIX $(IOC)" +$(EPICS_CA_PUT_LOG_PREFIX_CMD_$(EPICS_VERSION_MAJOR=3)=) require caPutLog $(caPutLog_VERSION=ifexists) -! iocBootNotify.sh $(IOC) - \"\${SHELLBOX#*:}\" - $(_) $(PWD)/startup.script - $(EPICS) - +# sw installation version number +require versionnumbers ifexists + +# autoSR location +epicsEnvSet SRBASE /ioc/data diff --git a/startup.script_part2 b/startup.script_part2 index cb5cbc0..9017e94 100644 --- a/startup.script_part2 +++ b/startup.script_part2 @@ -1,5 +1,17 @@ -# $Source: /cvs/A/CS/startup/startup.script_part2,v $ -# 2nd part of common startup +# 2nd part of common vxWorks startup + +# caPutLog +putenv "EPICS_CA_PUT_LOG_ADDR=gfa-syslog:1515 gfa-logstash.psi.ch:1515" +require "caPutLog", getenv("caPutLog_VERSION")?getenv("caPutLog_VERSION"):"ifexists" + +# IOC monitoring +require R3_13?"iocmon":"iocStats", getenv(R3_13?"iocmon_VERSION":"iocStats_VERSION") + +# Battery monitoring +require "M48T37", getenv("M48T37_VERSION")?getenv("M48T37_VERSION"):"ifexists" + +# Database Upload +require "iocinfo", getenv("iocinfo_VERSION")?getenv("iocinfo_VERSION"):"ifexists" #Enable memory >32MB on IOC that have it. (Is a NOOP on all others) memAddToPool sysMemTop(), EXTENDED_MEMORY diff --git a/startup.script_part3 b/startup.script_part3 index 0385467..c9496cb 100644 --- a/startup.script_part3 +++ b/startup.script_part3 @@ -1,4 +1,4 @@ -# $Source: /cvs/A/CS/startup/startup.script_part3,v $ +# 3rd part of common vxWorks startup # EPICS 3.13 needs this to upload iocinfo to database sprintf STRINGBUFFER,strncmp(EPICS,"R3.13.",6) ? ";" : "iocinfo"