From 3276ada78a86c6143674310326b2156b30039965 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Wed, 8 May 2019 17:32:50 +0200 Subject: [PATCH 1/6] build for DeltaTau with ELDK-5.3 for newer C++ compiler --- configure/os/CONFIG_SITE.linux-x86.Common | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/configure/os/CONFIG_SITE.linux-x86.Common b/configure/os/CONFIG_SITE.linux-x86.Common index 9b213dc61..b809d9b4b 100644 --- a/configure/os/CONFIG_SITE.linux-x86.Common +++ b/configure/os/CONFIG_SITE.linux-x86.Common @@ -4,6 +4,9 @@ INSTALL_LOCATION=/usr/local/epics/base-7.0.1 GNU_HOST_ARCH=i686 GNU_HOST_OS=linux +# LD_LIBRARY_PATH may cause problems for eldk53-ppc4xxFP +LD_LIBRARY_PATH= + # vxWorks 5.5 for MVxxxx boards CROSS_COMPILER_TARGET_ARCHS += T2-ppc604 @@ -27,7 +30,7 @@ CROSS_COMPILER_TARGET_ARCHS += eldk52-e500v2 # DeltaTau PowerPMAC CROSS_COMPILER_TARGET_ARCHS += eldk42-ppc4xxFP -#CROSS_COMPILER_TARGET_ARCHS += eldk53-ppc4xxFP +CROSS_COMPILER_TARGET_ARCHS += eldk53-ppc4xxFP # Test other vxWorks versions #CROSS_COMPILER_TARGET_ARCHS += V66-ppc603 From 74d9749255cc590aae644cfa0281195820629dbe Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Wed, 3 Apr 2019 15:10:28 +0200 Subject: [PATCH 2/6] fix install location --- configure/os/CONFIG_SITE.linux-x86.Common | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure/os/CONFIG_SITE.linux-x86.Common b/configure/os/CONFIG_SITE.linux-x86.Common index b809d9b4b..12bd19968 100644 --- a/configure/os/CONFIG_SITE.linux-x86.Common +++ b/configure/os/CONFIG_SITE.linux-x86.Common @@ -1,5 +1,5 @@ -INSTALL_LOCATION=/usr/local/epics/base-7.0.1 -#EPICS_SITE_VERSION:=$(shell date +%Y-%m-%d) +INSTALL_LOCATION=/usr/local/epics/base-$(EPICS_VERSION).$(EPICS_REVISION).$(EPICS_MODIFICATION) +EPICS_SITE_VERSION:=$(shell date +%Y-%m-%d) GNU_HOST_ARCH=i686 GNU_HOST_OS=linux From d12d38f970c960517507015f62de817d0d4823d9 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Fri, 10 May 2019 11:08:48 +0200 Subject: [PATCH 3/6] re-enable -fno-strict-aliasing for vxWorks --- configure/os/CONFIG.Common.vxWorksCommon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure/os/CONFIG.Common.vxWorksCommon b/configure/os/CONFIG.Common.vxWorksCommon index 7fe56b874..95459dcf2 100644 --- a/configure/os/CONFIG.Common.vxWorksCommon +++ b/configure/os/CONFIG.Common.vxWorksCommon @@ -132,7 +132,7 @@ export TOOL_FAMILY = GNU #-------------------------------------------------- # Operating system flags OP_SYS_CPPFLAGS += -DvxWorks=vxWorks -OP_SYS_CFLAGS += -fno-builtin +OP_SYS_CFLAGS += -fno-builtin -fno-strict-aliasing # Fix for vxWorks headers that use macros defined in vxWorks.h but # which don't actually include vxWorks.h themselves, for example the From 4acdd83984aaab7b2a5b3e44e2a2809a629c0a5c Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Wed, 3 Apr 2019 15:14:34 +0200 Subject: [PATCH 4/6] also build pcas --- modules/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/Makefile b/modules/Makefile index cd782fe80..890aebb7a 100644 --- a/modules/Makefile +++ b/modules/Makefile @@ -36,6 +36,9 @@ pva2pva_DEPEND_DIRS = pvAccess SUBMODULES += example example_DEPEND_DIRS = pva2pva pvaClient +SUBMODULES += pcas +pcas_DEPEND_DIRS = ca + # Allow sites to add extra submodules -include Makefile.local From 0bb80e373b0b386e8019f97076937b9ae131abd2 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Fri, 10 May 2019 14:44:17 +0200 Subject: [PATCH 5/6] add simple calculations to macros --- modules/libcom/src/macLib/macCore.c | 185 ++++++++++++++++++++++++++++ 1 file changed, 185 insertions(+) diff --git a/modules/libcom/src/macLib/macCore.c b/modules/libcom/src/macLib/macCore.c index 55d31719e..845b009bb 100644 --- a/modules/libcom/src/macLib/macCore.c +++ b/modules/libcom/src/macLib/macCore.c @@ -568,6 +568,186 @@ static MAC_ENTRY *create( MAC_HANDLE *handle, const char *name, int special ) return entry; } +#define SUCCESS 0 +#define NOVALUE 1 +#define UNTERMINATED 2 +#define DIVZERO 3 + +static int parseExpr( const char** pp, int* v, int level ); + +/* Value is a number or an expression in () */ +static int parseValue( const char** pp, int* v ) +{ + int status; + int val; + const char *p = *pp; + int neg = 0; + + while (isspace((unsigned char)*p)) p++; + if (*p == '+' || *p == '-') neg = *p++ == '-'; + while (isspace((unsigned char)*p)) p++; + if (*p == '(') + { + p++; + if ((status = parseExpr(&p, &val, 0)) != SUCCESS) return status; + if (*p++ != ')') + { + printf("macLib: missing ) after '%s'\n", *pp); + return UNTERMINATED; + } + } + else + { + char* e; + val = strtol(p, &e, 0); + if (e == p) return NOVALUE; + p = e; + } + if (neg) val = -val; + *pp = p; + *v = val; + return SUCCESS; +} + +/* Expr is a sum or product of Values or a conditional */ +static int parseExpr( const char** pp, int* v, int level ) +{ + const char *p = *pp; + int o = 0; + int val0, val1, val2; + int status = SUCCESS; + int stat1, stat2; + + val0 = 0; + /* handle sums and differences */ + do { + if ((stat1 = parseValue(&p, &val1)) != SUCCESS) + { + if (o && stat1 == NOVALUE) + printf ("macLib: missing operand after '%c'\n", o); + return stat1; + } + while (isspace((unsigned char)*p)) p++; + o = *p; + /* handle products and quotients */ + while (o == '*' || o == '/' || o == '%') + { + p++; + if ((stat2 = parseValue(&p, &val2)) != SUCCESS) + { + if (stat2 == NOVALUE) + printf ("macLib: missing operand after '%c'\n", o); + return stat2; + } + if (o == '*') val1 *= val2; + else if (val2 == 0) + { + status = DIVZERO; + val1 = 1; + } + else if (o == '/') val1 /= val2; + else val1 %= val2; + while (isspace((unsigned char)*p)) p++; + o = *p; + } + val0 += val1; + } while (o == '+' || o == '-'); + + /* handle comparisons */ + o = *p; + if (o == '<' || o == '>') + { + p++; + if ((stat1 = parseExpr(&p, &val1, 1)) != SUCCESS) + { + if (stat1 == NOVALUE) + printf ("macLib: missing expression after '%c'\n", o); + return stat1; + } + if (o == '<') + val0 = (val0 < val1); + else + val0 = (val0 > val1); + } + + /* handle conditionals */ + if (*p == '?' && level == 0) + { + p++; + while (isspace((unsigned char)*p)) p++; + if (*p != ':') + { + stat1 = parseExpr(&p, &val1, 0); + } + else + { + val1 = val0; + stat1 = status; + } + if (*p != ':') + { + printf("macLib: missing : after '%s'\n", *pp); + return UNTERMINATED; + } + p++; + stat2 = parseExpr(&p, &val2, 0); + status = val0 ? stat1 : stat2; + val0 = val0 ? val1 : val2; + } + + *v = val0; + *pp = p; + return status; +} + +static MAC_ENTRY *evalExpr( MAC_HANDLE *handle, const char *expr ) +{ + MAC_ENTRY *entry = NULL; + int status; + const char* p = expr; + int value; + char valuestr[40]; + char format[20] = "%d"; + + while (isspace((unsigned char)*p)) p++; + if (*p == '%') + { + int i = 1; + p++; + while (i < sizeof(format) && strchr(" #-+0", *p)) + format[i++] = *p++; + while (i < sizeof(format) && strchr("0123456789", *p)) + format[i++] = *p++; + if (i < sizeof(format) && strchr("diouxXc", *p)) + { + format[i++] = *p++; + format[i] = 0; + } + else + return NULL; + } + status = parseExpr(&p, &value, 0); + if (status == DIVZERO) + printf ("macLib: division by zero\n"); + if (status != SUCCESS) + return NULL; + while (isspace((unsigned char)*p)) p++; + if (*p) + { + printf("macLib: rubbish at end of expression: %s\n", p); + return NULL; + } + sprintf(valuestr, format, value); + entry = create( handle, expr, TRUE ); + if ( entry ) + { + entry->type = "calculation"; + if ( rawval( handle, entry, valuestr ) == NULL ) + return NULL; + } + return entry; +} + /* * Look up macro entry with matching "special" attribute by name */ @@ -579,6 +759,10 @@ static MAC_ENTRY *lookup( MAC_HANDLE *handle, const char *name, int special ) printf( "lookup-> level = %d, name = %s, special = %d\n", handle->level, name, special ); + if ( (special == FALSE) ) { + entry = evalExpr( handle, name ); + if (entry) return entry; + } /* search backwards so scoping works */ for ( entry = last( handle ); entry != NULL; entry = previous( entry ) ) { if ( entry->special != special ) @@ -698,6 +882,7 @@ static void trans( MAC_HANDLE *handle, MAC_ENTRY *entry, int level, /* return immediately if raw value is NULL */ if ( *rawval == NULL ) return; + /* discard quotes and escapes if level is > 0 (i.e. if these aren't the user's quotes and escapes) */ discard = ( level > 0 ); From 5589deb3adf64a2ddf361646a8c51cc9cfaa1ebc Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Mon, 22 Jul 2019 15:17:18 +0200 Subject: [PATCH 6/6] make sure softIoc for vxWorks contains all functions --- modules/database/src/std/softIoc/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/database/src/std/softIoc/Makefile b/modules/database/src/std/softIoc/Makefile index a432d358d..10feee089 100644 --- a/modules/database/src/std/softIoc/Makefile +++ b/modules/database/src/std/softIoc/Makefile @@ -12,6 +12,8 @@ SRC_DIRS += $(STDDIR)/softIoc PROD_IOC_DEFAULT = softIoc PROD_IOC_iOS = -nil- +PROD_LDFLAGS_vxWorks = --whole-archive + DBD += base.dbd DBD += asSub.dbd DBD += softIoc.dbd