Feature/router mstp example app (#101)

* Ported router-ipv6 app to router-mstp

* Fixed router-ipv6 build

* Added router-ipv6 and router-mstp to pipeline

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
This commit is contained in:
Steve Karg
2020-07-02 22:46:13 -05:00
committed by GitHub
parent cfb82a937f
commit de7f7e9782
9 changed files with 1330 additions and 5 deletions
+79
View File
@@ -0,0 +1,79 @@
#Makefile to build BACnet Application for the GCC port
# tools - only if you need them.
# Most platforms have this already defined
# CC = gcc
# Executable file name
TARGET = router-mstp
TARGET_BIN = ${TARGET}$(TARGET_EXT)
# BACNET_PORT, BACNET_PORT_DIR, BACNET_PORT_SRC are defined in common Makefile
# BACNET_SRC_DIR is defined in common apps Makefile
BACNET_OBJECT_DIR = $(BACNET_SRC_DIR)/bacnet/basic/object
SRC = main.c \
$(BACNET_OBJECT_DIR)/netport.c \
$(BACNET_OBJECT_DIR)/client/device-client.c
PORT_MSTP_SRC = \
$(BACNET_PORT_DIR)/rs485.c \
$(BACNET_PORT_DIR)/dlmstp.c \
$(BACNET_SRC_DIR)/bacnet/datalink/mstp.c \
$(BACNET_SRC_DIR)/bacnet/datalink/mstptext.c \
$(BACNET_SRC_DIR)/bacnet/datalink/crc.c
PORT_BIP_SRC = \
$(BACNET_PORT_DIR)/bip-init.c \
$(BACNET_SRC_DIR)/bacnet/datalink/bvlc.c \
$(BACNET_SRC_DIR)/bacnet/basic/bbmd/h_bbmd.c
# WARNINGS, DEBUGGING, OPTIMIZATION are defined in common apps Makefile
# BACNET_DEFINES is defined in common apps Makefile
# put all the flags together
INCLUDES = -I$(BACNET_SRC_DIR) -I$(BACNET_PORT_DIR)
CFLAGS += $(WARNINGS) $(DEBUGGING) $(OPTIMIZATION) $(BACNET_DEFINES) $(INCLUDES)
LFLAGS += -Wl,$(SYSTEM_LIB)
ifneq (${BACNET_LIB},)
LFLAGS += -Wl,$(BACNET_LIB)
endif
# GCC dead code removal
CFLAGS += -ffunction-sections -fdata-sections
LFLAGS += -Wl,--gc-sections
BACNET_SRC = \
$(wildcard $(BACNET_SRC_DIR)/bacnet/*.c) \
$(wildcard $(BACNET_SRC_DIR)/bacnet/basic/*.c) \
$(wildcard $(BACNET_SRC_DIR)/bacnet/basic/binding/*.c) \
$(wildcard $(BACNET_SRC_DIR)/bacnet/basic/service/*.c) \
$(wildcard $(BACNET_SRC_DIR)/bacnet/basic/sys/*.c) \
$(BACNET_SRC_DIR)/bacnet/basic/npdu/h_routed_npdu.c \
$(BACNET_SRC_DIR)/bacnet/basic/npdu/s_router.c \
$(BACNET_SRC_DIR)/bacnet/basic/tsm/tsm.c
SRCS = ${SRC} ${BACNET_SRC} ${PORT_MSTP_SRC} ${PORT_BIP_SRC}
OBJS += ${SRCS:.c=.o}
.PHONY: all
all: Makefile ${TARGET_BIN}
${TARGET_BIN}: ${OBJS}
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
size $@
cp $@ ../../bin
.c.o:
${CC} -c ${CFLAGS} $*.c -o $@
.PHONY: depend
depend:
rm -f .depend
${CC} -MM ${CFLAGS} *.c >> .depend
.PHONY: clean
clean:
rm -f core ${TARGET_BIN} ${OBJS} $(TARGET).map
.PHONY: include
include: .depend
File diff suppressed because it is too large Load Diff
+34
View File
@@ -0,0 +1,34 @@
BACnet Simple Router Demo
=========================
The Simple Router demo connects one BACnet/IP and one BACnet MS/TP network.
It also includes a BBMD so that Foreign Device Registration can be used
to tunnel local command line demos to BACnet/IP and BACnet MS/TP networks.
Configuration
=============
It uses environment variables to configure
the MS/TP COM port and BACnet/IP address on Windows:
set BACNET_IFACE=192.168.0.1
set BACNET_MSTP_IFACE=COM1
set BACNET_MSTP_BAUD=38400
set BACNET_MSTP_MAC=99
It uses environment variables to configure
the MS/TP COM port and BACnet/IP address on Linux:
export BACNET_IFACE=eth0
export BACNET_MSTP_IFACE=/dev/ttyUSB0
export BACNET_MSTP_BAUD=38400
export BACNET_MSTP_MAC=99
Also uses these configurations, but defaults to these values if not set:
set BACNET_MAX_INFO_FRAMES=128
set BACNET_MAX_MASTER=127
set BACNET_IP_PORT=47808
set BACNET_IP_NET=1
set BACNET_MSTP_NET=2
Note: NET number must be unique and 1..65534 (never 0 or 65535)