Fixed the Linux DLMSTP standalone test application Makefile. (#1055)

This commit is contained in:
Steve Karg
2025-07-31 09:40:18 -05:00
committed by GitHub
parent f31193998c
commit f88f5a3424
5 changed files with 54 additions and 7 deletions
+6
View File
@@ -369,6 +369,10 @@ xplained-clean: ports/xplained/Makefile
mstpsnap: ports/linux/mstpsnap.mak
$(MAKE) -s -C ports/linux -f mstpsnap.mak clean all
.PHONY: dlmstp-linux
dlmstp-linux: ports/linux/dlmstp.mak
$(MAKE) -s -C ports/linux -f dlmstp.mak clean all
.PHONY: lwip
lwip: ports/lwip/Makefile
$(MAKE) -s -C ports/lwip clean all
@@ -520,6 +524,8 @@ clean: ports-clean
$(MAKE) -s -C apps/fuzz-libfuzzer clean
$(MAKE) -s -C ports/lwip clean
$(MAKE) -s -C test clean
$(MAKE) -s -C ports/linux -f mstpsnap.mak clean
$(MAKE) -s -C ports/linux -f dlmstp.mak clean
rm -rf ./build
.PHONY: test
+21
View File
@@ -117,6 +117,27 @@ BACNET_IP_NAT_ADDR - dotted IPv4 address of the public facing router
BACNET_IP_BROADCAST_BIND_ADDR - dotted IPv4 address to bind broadcasts
When the tools are compiled to use MS/TP datalink, the following
environment variables are used:
BACNET_MAX_INFO_FRAMES - BACnet MS/TP max-info-frames parameter.
Defaults to 127.
BACNET_MAX_MASTER - BACnet MS/TP max-master parameter.
Defaults to 127.
BACNET_MSTP_BAUD - BACnet MS/TP baud rate.
Defaults to 38400.
BACNET_MSTP_MAC - BACnet MS/TP MAC address.
Defaults to 127.
BACNET_IFACE - interface to use for the MS/TP datalink layer
For Linux, this is something like /dev/ttyS0 or /dev/ttyUSB0
For Windows, this is something like COM4 or COM23
Defaults to /dev/ttyUSB0 on Linux and COM4 on Windows
and /dev/cu.usbserial-7 on macOS.
Example Usage
-------------
You can communicate with the virtual BACnet Device by using the other BACnet
+4 -1
View File
@@ -10,7 +10,7 @@ to configure the network.
BACNET_IFACE - interface to use for the datalink layer
For Linux, this is something like eth0 or /dev/ttyS0.
For Windows, this is something like 192.168.0.1 or COM4
Defaults to NULL.
Defaults to NULL which tries to discover the localhost.
BACNET_IP_PORT - BACnet/IP port number.
Defaults to 47808.
@@ -27,6 +27,9 @@ BACNET_BBMD_ADDRESS - dotted IP address or domain name of BBMD.
BACNET_MAX_INFO_FRAMES - BACnet MS/TP max-info-frames parameter.
Defaults to 127.
BACNET_MAX_MASTER - BACnet MS/TP max-master parameter.
Defaults to 127.
BACNET_MSTP_BAUD - BACnet MS/TP baud rate.
Defaults to 38400.
+3 -2
View File
@@ -1159,9 +1159,9 @@ static char *Network_Interface = NULL;
int main(int argc, char *argv[])
{
uint16_t pdu_len = 0;
uint16_t pdu_len;
/* argv has the "COM4" or some other device */
/* argv has the "/dev/ttyUSB0" or some other device */
if (argc > 1) {
Network_Interface = argv[1];
}
@@ -1176,6 +1176,7 @@ int main(int argc, char *argv[])
MSTP_Create_And_Send_Frame(
&MSTP_Port, FRAME_TYPE_TEST_REQUEST, MSTP_Port.SourceAddress,
MSTP_Port.This_Station, NULL, 0);
(void)pdu_len;
}
return 0;
+20 -4
View File
@@ -1,15 +1,30 @@
#Makefile to build test case
CC = gcc
BASEDIR = .
BACNET_SRC_DIR ?= $(realpath ../../src)
# -g for debugging with gdb
DEFINES = -DBIG_ENDIAN=0 -DBACDL_MSTP=1 -DTEST_DLMSTP
INCLUDES = -I. -I../../
DEFINES += -DBACNET_STACK_DEPRECATED_DISABLE
INCLUDES = -I. -I$(BACNET_SRC_DIR)
CFLAGS = -Wall $(INCLUDES) $(DEFINES) -g
SRCS = rs485.c \
dlmstp.c \
../../mstp.c \
../../crc.c
mstimer-init.c \
$(BACNET_SRC_DIR)/bacnet/datalink/cobs.c \
$(BACNET_SRC_DIR)/bacnet/datalink/crc.c \
$(BACNET_SRC_DIR)/bacnet/datalink/mstp.c \
$(BACNET_SRC_DIR)/bacnet/datalink/mstptext.c \
$(BACNET_SRC_DIR)/bacnet/basic/sys/debug.c \
$(BACNET_SRC_DIR)/bacnet/basic/sys/fifo.c \
$(BACNET_SRC_DIR)/bacnet/basic/sys/mstimer.c \
$(BACNET_SRC_DIR)/bacnet/basic/sys/ringbuf.c \
$(BACNET_SRC_DIR)/bacnet/bacaddr.c \
$(BACNET_SRC_DIR)/bacnet/bacdcode.c \
$(BACNET_SRC_DIR)/bacnet/bacint.c \
$(BACNET_SRC_DIR)/bacnet/bacreal.c \
$(BACNET_SRC_DIR)/bacnet/bacstr.c \
$(BACNET_SRC_DIR)/bacnet/indtext.c \
$(BACNET_SRC_DIR)/bacnet/npdu.c
OBJS = ${SRCS:.c=.o}
@@ -19,6 +34,7 @@ all: ${TARGET}
${TARGET}: ${OBJS}
${CC} -pthread -o $@ ${OBJS}
size $@
.c.o:
${CC} -c ${CFLAGS} $*.c -o $@