Skip to content
Snippets Groups Projects
Commit 0e65f6d7 authored by Graziano Scalamera's avatar Graziano Scalamera
Browse files
parent ff8f84b4
No related branches found
No related tags found
No related merge requests found
Showing with 4479 additions and 0 deletions
---
BasedOnStyle: WebKit
AlignAfterOpenBracket: AlwaysBreak
BinPackArguments: true
BinPackParameters: false
PenaltyBreakBeforeFirstCallParameter: 1
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlignEscapedNewlines: Left
AlignArrayOfStructures: None
PointerAlignment: Right
BreakBeforeBraces: Linux
BreakBeforeBinaryOperators: None
KeepEmptyLinesAtTheStartOfBlocks: false
IndentCaseLabels: true
IndentWidth: 4
UseTab: Never
SortIncludes: false
ColumnLimit: 80
---
Language: JavaScript
DisableFormat: true
...
set print pretty on
set print union on
set print address on
list
# Ignore formatting change commits when determining blame
# git config --global blame.ignoreRevsFile .git-blame-ignore-revs
# Mark any lines that have had a commit skipped using --ignore-rev with a `?`
# git config --global blame.markIgnoredLines true
# Mark any lines that were added in a skipped commit and can not be attributed with a `*`
# git config --global blame.markUnblamableLines true
# make pretty - apps/ and src/ with clang-format version 14
cc4911a185c39ea3211530f6ad6b2007b1855d79
# Set the default behavior, in case you have core.autocrlf set.
* text=auto
# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.c text
*.cpp text
*.cxx text
*.h text
*.hpp text
*.s text
Makefile.* text
Makefile text
*.mak text
*.MAK text
*.xml text
*.aps text
*.mcp text
*.hwp text
*.lkr text
*.lua text
*.txt text
*.htm text
.cproject text
.project text
.gdbinit text
.slintrc text
*.sh text
README.* text
# Declare files that will always have CRLF line endings on checkout.
*.sln text eol=crlf
*.vcxproj text eol=crlf
*.filters text eol=crlf
*.atsln text eol=crlf
*.cproj text eol=crlf
*.tpi text eol=crlf
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
# Set update schedule for GitHub Actions
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
branches:
- label: enhancement
prefix: feature/
- label: bug
prefix: bugfix/
- label: documentation
prefix: chore/
- label: '*'
prefix: issues/
name: CodeQL
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
schedule:
- cron: '36 11 * * 6'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'cpp' ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# Attempt to build any compiled languages (C/C++, C#, or Java).
- run: make clean all
# Analysis
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
name: GCC
on:
push:
branches:
- master
pull_request:
branches:
- '*'
jobs:
bip-apps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create Build Environment
run: |
sudo apt-get update -qq
sudo apt-get install -qq libconfig-dev
- name: Build Demo Apps GNU89
run: |
gcc --version
make clean
make LEGACY=true CSTANDARD="-std=gnu89" all
- name: Build Demo Apps GNU99
run: |
make clean
make CSTANDARD="-std=gnu99" all
- name: LEGACY=true Build Demo Apps GNU11
run: |
make clean
make LEGACY=true CSTANDARD="-std=gnu11" all
- name: Build Demo Apps GNU17
run: |
make clean
make LEGACY=true CSTANDARD="-std=gnu17" all
bip-no-bbmd-apps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create Build Environment
run: |
sudo apt-get update -qq
sudo apt-get install -qq libconfig-dev
- name: Build Demo Apps BBMD=none
run: |
gcc --version
make clean
make LEGACY=true BBMD=none all
bip-client-bbmd-apps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create Build Environment
run: |
sudo apt-get update -qq
sudo apt-get install -qq libconfig-dev
- name: Build Demo Apps BBMD=client
run: |
gcc --version
make clean
make LEGACY=true BBMD=client all
gateway:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create Build Environment
run: |
sudo apt-get update -qq
sudo apt-get install -qq libconfig-dev
- name: Build Gateway Demo
run: |
gcc --version
make clean
make LEGACY=true gateway
router:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create Build Environment
run: |
sudo apt-get update -qq
sudo apt-get install -qq libconfig-dev
- name: Build Router Demo
run: |
gcc --version
make clean
make LEGACY=true router
router-ipv6:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create Build Environment
run: |
sudo apt-get update -qq
sudo apt-get install -qq libconfig-dev
- name: Build Router IPv6 Demo
run: |
gcc --version
make clean
make LEGACY=true router-ipv6
router-mstp:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create Build Environment
run: |
sudo apt-get update -qq
sudo apt-get install -qq libconfig-dev
- name: Build Router MSTP Demo
run: |
gcc --version
make clean
make LEGACY=true router-mstp
bip6:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create Build Environment
run: |
sudo apt-get update -qq
sudo apt-get install -qq libconfig-dev
- name: Build BACnet/IPv6 Demo Apps
run: |
gcc --version
make clean
make LEGACY=true bip6
mstp:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create Build Environment
run: |
sudo apt-get update -qq
sudo apt-get install -qq libconfig-dev
- name: Build MSTP Demo Apps
run: |
gcc --version
make clean
make LEGACY=true mstp
ethernet:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create Build Environment
run: |
sudo apt-get update -qq
sudo apt-get install -qq libconfig-dev
sudo apt-get install -qq libcap-dev
- name: Build Ethernet Demo Apps
run: |
gcc --version
make clean
make LEGACY=true ethernet
ports-arm-makefile:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create Build Environment
run: |
sudo apt-get update -qq
sudo apt-get install -qq build-essential
sudo apt-get install -qq gcc-arm-none-eabi
sudo apt-get install -qq libnewlib-arm-none-eabi
- name: ports-arm-makefile
run: |
make clean
arm-none-eabi-gcc --version
make LEGACY=true stm32f10x
make LEGACY=true stm32f4xx
make LEGACY=true at91sam7s
ports-arm-cmake:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create Build Environment
run: |
sudo apt-get update -qq
sudo apt-get install -qq build-essential
sudo apt-get install -qq gcc-arm-none-eabi
sudo apt-get install -qq libnewlib-arm-none-eabi
sudo apt-get install -qq cmake
- name: ports-arm-cmake
run: |
arm-none-eabi-gcc --version
make stm32f4xx-cmake
make at91sam7s-cmake
ports-avr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create Build Environment
run: |
sudo apt-get update -qq
sudo apt-get install -qq build-essential
sudo apt-get install -qq gcc-avr avr-libc binutils-avr
- name: ports-avr
run: |
avr-gcc --version
make LEGACY=true atmega168
make LEGACY=true bdk-atxx4-mstp
make LEGACY=true xplained
ports-lwip:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create Build Environment
run: |
sudo apt-get update -qq
sudo apt-get install -qq build-essential
sudo apt-get install -qq liblwip-dev
- name: ports-lwip
run: |
make lwip
mingw:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create Build Environment
run: |
sudo apt-get update -qq
sudo apt-get install -qq build-essential
sudo apt-get install -qq mingw-w64
- name: Build Win32 Demo Apps
run: |
export CC=i686-w64-mingw32-gcc
export LD=i686-w64-mingw32-ld
i686-w64-mingw32-gcc --version
make win32
- name: Build Win32 Demo IP to IPv6 Router
run: make LEGACY=true BUILD=win32 router-ipv6
- name: Build Win32 Demo IP to MS/TP Router
run: make LEGACY=true BUILD=win32 router-mstp
- name: Build Win32 Demo Gateway
run: make LEGACY=true BUILD=win32 gateway
name: Quality
on:
push:
branches:
- master
pull_request:
branches:
- '*'
jobs:
scan-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create LLVM clang-tools scan-build Workspace
run: |
sudo apt-get update -qq
sudo apt-get install -qq clang-tools
- name: Static Defect Analysis using scan-build
run: |
make clean
make scan-build
splint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create SPLint Workspace
run: |
sudo apt-get update --quiet --assume-yes
sudo apt-get install --quiet --assume-yes splint
- name: Static Defect Analysis using SPLint
run: make splint
cppcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create CPPcheck Workspace
run: |
sudo apt-get update -qq
sudo apt-get install -qq cppcheck
- name: Static Defect Analysis using CPPcheck
run: |
cppcheck --version
make clean
make cppcheck
flawfinder:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create Flawfinder Workspace
run: |
sudo apt-get update -qq
sudo apt-get install -qq flawfinder
- name: Static Defect Analysis using flawfinder
run: |
flawfinder --version
make clean
make flawfinder
codespell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create codespell Workspace
run: |
sudo apt-get update -qq
sudo apt-get install -qq codespell
- name: Static Spelling Analysis using codespell
run: make spell
unittest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create Build Environment
run: |
sudo apt-get update -qq
sudo apt-get install -qq lcov
- name: Run Unit Test with Code Coverage
run: make test
name: CMake
on:
push:
branches:
- master
pull_request:
branches:
- '*'
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: RelWithDebInfo
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macOS-latest]
project: [root, test]
exclude:
# Currently does not build. Need to be fixed at some point.
- os: windows-latest
project: test
steps:
- uses: actions/checkout@v4
- name: Install Dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest' && matrix.project == 'root'
run: |
sudo apt-get update
# apps/router needs libconfig-dev.
sudo apt-get install -y libconfig-dev
- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{runner.workspace}}/build
- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
working-directory: ${{runner.workspace}}/build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: |
if [ "${{ matrix.project }}" == "test" ]; then
source_dir=$GITHUB_WORKSPACE/test
else
source_dir=$GITHUB_WORKSPACE
fi
cmake_options="-DCMAKE_COMPILE_WARNING_AS_ERROR=ON"
# Compile as much as possible to at least compile test code.
c_flags="$c_flags -DBACFILE=ON"
c_flags="$c_flags -DPRINT_ENABLED=1"
c_flags="$c_flags -DBACNET_TIME_MASTER=ON"
c_flags="$c_flags -DBACAPP_COLOR_RGB_CONVERSION_ENABLED=ON"
cmake_options="$cmake_options -DCMAKE_C_FLAGS=$c_flags"
# TODO: Add BACDL_BIP6=ON when it builds withous errors.
cmake_options="$cmake_options -DBACDL_BIP=ON"
cmake_options="$cmake_options -DBACNET_PROTOCOL_REVISION=24"
if [[ "$RUNNER_OS" != "macOS" ]]; then
# Apple does not have port yet for this.
cmake_options="$cmake_options -DBACDL_MSTP=ON"
fi
if [[ "$RUNNER_OS" == "Linux" ]]; then
# Apple nor Windows does not have port yet for this.
cmake_options="$cmake_options -DBACDL_ARCNET=ON"
# Currently Windows fails because of pcab.h not found.
# Apple does not have port yet for this.
cmake_options="$cmake_options -DBACDL_ETHERNET=ON"
fi
cmake $source_dir -DCMAKE_BUILD_TYPE=$BUILD_TYPE $cmake_options
- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config $BUILD_TYPE
name: Raspberry Pi
on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
tags:
description: 'Test scenario tags'
required: false
type: boolean
environment:
description: 'Environment to run tests against'
type: environment
required: true
jobs:
log-the-inputs:
runs-on: raspios/base:latest
steps:
- run: |
echo "Log level: $LEVEL"
echo "Tags: $TAGS"
echo "Environment: $ENVIRONMENT"
env:
LEVEL: ${{ inputs.logLevel }}
TAGS: ${{ inputs.tags }}
ENVIRONMENT: ${{ inputs.environment }}
raspi-bip-apps:
runs-on: raspios/base:latest
steps:
- uses: actions/checkout@v4
- name: Create Build Environment
run: |
sudo apt-get update -qq
sudo apt-get install -qq libconfig-dev
- name: Build Demo Apps
run: |
gcc --version
make clean
make all
piface:
runs-on: raspios/base:latest
steps:
- uses: actions/checkout@v4
- name: Create Build Environment
run: |
sudo apt-get update -qq
- name: Build Demo Apps
run: |
gcc --version
cd apps/piface && ./configure && cd ../../
make piface
blinkt:
runs-on: raspios/base:latest
steps:
- uses: actions/checkout@v4
- name: Create Build Environment
run: |
sudo apt-get update -qq
sudo apt-get install -qq libpigpio-dev libpigpiod-if-dev pigpiod
- name: Build Demo Apps
run: |
gcc --version
make blinkt
name: Zephyr OS CMake
on:
push:
branches:
- master
pull_request:
branches:
- '*'
jobs:
build:
runs-on: ubuntu-latest
container: zephyrprojectrtos/ci:latest
env:
CMAKE_PREFIX_PATH: /opt/toolchains
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: bacnet-stack
- name: Initialize
working-directory: bacnet-stack
run: |
west init -l .
west update
- name: Twister Tests unit_testing
working-directory: bacnet-stack
run: |
rm -rf twister-out.unit_testing &&
../zephyr/scripts/twister -O twister-out.unit_testing -p unit_testing -T zephyr/tests &&
for file in CMakeFiles CMakeCache.txt cmake_install.cmake Makefile
do
find twister-out.unit_testing -name $file -exec rm -rf {} \; || true
done
- name: Archive firmware
uses: actions/upload-artifact@v4
with:
name: firmware
path: bacnet-stack/twister-out.unit_testing
*.su
*.nm
*.pyc
*.log
*.a
*.o
*.obj
*.exe
*.bak
*~
*.dep
*.orig
*.hex
*.map
*.bin
*.out
*.sim
*.dbgdt
*.dni
*.jlink
*.wsdt
*.config
*.pbd
*.ewd
*.ewt
*.d
*.r90
*.r90
*.s90
*.d90
*.a90
*.pbi
*.cap
*.pcapng
*.pcap
*.patch
*.cout
*.lst
*.cap
*.csv
*.CAP
*.xcl
*.zip
*.wspos
*.browse
*.ewsample
*.asm
*.ind
*.7z
*.hex
*.elf
*.eep
*.emSession
*.depend
*.layout
*.dmp
tags
test-results.xml
.vscode/
.vs/
Debug/
settings/
*.componentinfo.xml
Backup*
BACnet_BDT_table
address_cache
**/build/*
**/_build/*
CMakeLists.txt.user
**/out/*
Obj/
Release/
/twister-out/*
/test/build/
/cmake-build-*
/.idea
# exclude the bin folder, except for some files
bin/*
!bin/*.sh
!bin/*.bat
!bin/*.txt
# exclude the apps folder, except for some source files
apps/*
!apps/Makefile
!apps/*.md
apps/**/*
!apps/**/
!apps/**/*.c
!apps/**/*.h
!apps/**/*.txt
!apps/**/*.md
!apps/**/Makefile
!apps/**/CMakeLists.txt
apps/piface/libmcp23s17/
apps/piface/libpifacedigital/
*.vcxproj.user
.mailmap 0 → 100644
# Map some author/committer cryptic names to name and E-Mail addresses
# sourceforge mappings
root <root@users.sourceforge.net> <root@1e814d3a-8a88-4260-be86-c0dc25669c1e>
Steve Karg <skarg@users.sourceforge.net> <skarg@1e814d3a-8a88-4260-be86-c0dc25669c1e>
Tom Brennan <tbrennan3@users.sourceforge.net> <tbrennan3@1e814d3a-8a88-4260-be86-c0dc25669c1e>
John Minack <minack@users.sourceforge.net> <minack@1e814d3a-8a88-4260-be86-c0dc25669c1e>
Peter Mc Shane <petermcs@users.sourceforge.net> <petermcs@1e814d3a-8a88-4260-be86-c0dc25669c1e>
Edward Hague <bitstest@users.sourceforge.net> <ekh@1e814d3a-8a88-4260-be86-c0dc25669c1e>
Edward Hague <bitstest@users.sourceforge.net> <bitstest@1e814d3a-8a88-4260-be86-c0dc25669c1e>
Tom Pacheco <netp@users.sourceforge.net> <netp@1e814d3a-8a88-4260-be86-c0dc25669c1e>
Mark Norton <s3rock@users.sourceforge.net> <s3rock@1e814d3a-8a88-4260-be86-c0dc25669c1e>
John Goulah <bigjohngoulah@users.sourceforge.net> <bigjohngoulah@1e814d3a-8a88-4260-be86-c0dc25669c1e>
Andrew Chu akchu <akchu@users.sourceforge.net> <akchu@1e814d3a-8a88-4260-be86-c0dc25669c1e>
Carl Neilson <cneilson@users.sourceforge.net> <cneilson@1e814d3a-8a88-4260-be86-c0dc25669c1e>
Richard Bray <brayra@users.sourceforge.net> <brayra@1e814d3a-8a88-4260-be86-c0dc25669c1e>
Duane L. King <kingdl802@users.sourceforge.net> <kingdl802@1e814d3a-8a88-4260-be86-c0dc25669c1e>
Piotr Grudzinski <bacpack@users.sourceforge.net> <bacpack@1e814d3a-8a88-4260-be86-c0dc25669c1e>
Rob Hoeye <rhoeye@users.sourceforge.net> <rhoeye@1e814d3a-8a88-4260-be86-c0dc25669c1e>
Krzysztof Malorny <k001a@users.sourceforge.net> <k001a@1e814d3a-8a88-4260-be86-c0dc25669c1e>
Paul Grinberg <gri6507@users.sourceforge.net> <gri6507@1e814d3a-8a88-4260-be86-c0dc25669c1e>
Frédéric Chaxel <fchaxel@users.sourceforge.net> <fchaxel@1e814d3a-8a88-4260-be86-c0dc25669c1e>
Miroslav Novotny <koby3101@users.sourceforge.net> <koby3101@1e814d3a-8a88-4260-be86-c0dc25669c1e>
Boris Weitsch <bow2@users.sourceforge.net> <bow2@1e814d3a-8a88-4260-be86-c0dc25669c1e>
Vasyl Tkhir <vasyl-tkhir@users.sourceforge.net> <vasyl-tkhir@1e814d3a-8a88-4260-be86-c0dc25669c1e>
# github mappings
Greg Shue <greg.shue@outlook.com> <32416235+shuegr-personal@users.noreply.github.com>
Greg Shue <greg.shue@outlook.com> <32416235+gregshue@users.noreply.github.com>
Anthony DeLorenzo <anthony@crystalpeaksecurity.com> <108027248+anthony-crystalpeak@users.noreply.github.com>
Nathan Zimmerman <83723367+jci-zimm@users.noreply.github.com>
Maria <bakmaria@users.sourceforge.net> <99472506+bakmaria@users.noreply.github.com>
Mikhail Antropov <michail.antropov@dsr-corporation.com> <103285038+Michail-Antropov@users.noreply.github.com>
Alexander Wells <79699091+AlexanderWells-diamond@users.noreply.github.com>
Alonso Cárdenas <11150989+alonsobsd@users.noreply.github.com>
Anonymous Maarten <madebr@users.noreply.github.com>
Chris Salisbury <20709243+ChrisSalisbury@users.noreply.github.com>
Jefrin <83201502+jefrin-dev@users.noreply.github.com>
Jonathan <74002342+jd-imi@users.noreply.github.com>
Joshua Smith <3375071+josmithua@users.noreply.github.com>
Mateusz Klatecki <47118568+MateuszKlatecki@users.noreply.github.com>
Mikael <9700710+Machinegon@users.noreply.github.com>
Nick Schaf <85998881+NickSchaf-jci@users.noreply.github.com>
Sebastian Weyer <50481737+DocSepp@users.noreply.github.com>
SpaceIm <30052553+SpaceIm@users.noreply.github.com>
antocout <149781661+antocout@users.noreply.github.com>
gducerf <59971684+gducerf@users.noreply.github.com>
rcb-tcs <114009722+rcb-tcs@users.noreply.github.com>
# other mappings
Geert Linders <geert_l@outlook.com> <g.linders@ame.nu>
Greg Shue <greg.shue@outlook.com> <gregory.shue@legrand.us>
Steve Karg <skarg@users.sourceforge.net> <steve@kargs.net>
Steve Karg <skarg@users.sourceforge.net> <steve@kargservice.com>
Steve Karg <skarg@users.sourceforge.net> <steve.karg@legrand.us>
Steve Karg <skarg@users.sourceforge.net> <allura@localhost>
Edward Hague <bitstest@users.sourceforge.net> <edward@bac-test.com>
Thomas Bracht Laumann Jespersen <t@laumann.xyz> <tj@omnio.net>
-Iinclude -Idemo/object -Iports/linux -castfcnptr -fullinitblock -initallelements -weak +posixlib
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
FROM ubuntu:focal as builder
## Usage:
# docker build -t bacnet --target bacnet .
# docker run --rm --name bacnet -d bacnet <device_id> [<device_name>]
## To run client commands that affect this server from inside the same
## container, use BBMD Foreign Device Registration by first exporting
## the following:
# BACNET_IP_PORT, BACNET_BBMD_PORT, and BACNET_BBMD_ADDRESS
## For example:
# docker run --rm --name bacnet -d bacnet
# docker exec -ti bacnet bash
# export BACNET_IP_PORT=47809
# export BACNET_BBMD_PORT=47808
# export BACNET_BBMD_ADDRESS="$(hostname -I | cut -d' ' -f1)"
# /opt/bacnet/bin/bacwi -1 1234
# /opt/bacnet/bin/bacrp 1234 device 1234 object-name
## etc.
## Check bacnet-stack/bin/readme.txt for more docs related to the
## example utilities and environment variables. Note that this docker
## image does not add the shell scripts in that folder as many of them
## are broken. Even so, reading them may be instructive.
SHELL ["/bin/bash", "-c"]
RUN set -xe; \
apt-get update; apt-get upgrade -y; apt-get --purge autoremove -y; \
apt-get install -y build-essential curl; \
apt-get -y autoclean; apt-get -y clean
RUN set -euxo pipefail; \
mkdir -p /build/bin; \
curl -LSs https://github.com/bacnet-stack/bacnet-stack/archive/refs/tags/bacnet-stack-1.0.0.tar.gz -o bacnet-stack.tar.gz; \
tar -xzf bacnet-stack.tar.gz; \
( cd bacnet-*/; \
make; \
rm -f -- bin/*.{bat,sh,txt}; \
mv -- bin/* /build/bin/; \
); \
rm -rf bacnet-*/
FROM ubuntu:focal AS bacnet
WORKDIR /opt/bacnet
COPY --from=builder /build/bin/* /opt/bacnet/bin/
EXPOSE 47808/udp
ENTRYPOINT ["/opt/bacnet/bin/bacserv"]
CMD ["1234", "test_server"]
Makefile 0 → 100644
# Main Makefile for BACnet-stack applications, tests, and sample ports
# Export the variables defined here to all subprocesses
# (see http://www.gnu.org/software/automake/manual/make/Special-Targets.html)
.EXPORT_ALL_VARIABLES:
# all: demos router-ipv6 ${DEMO_LINUX}
.PHONY: all
all: apps
.PHONY: bsd
bsd:
$(MAKE) BACNET_PORT=bsd -s -C apps all
.PHONY: win32
win32:
$(MAKE) BACNET_PORT=win32 -s -C apps all
.PHONY: mingw32
mingw32:
i686-w64-mingw32-gcc --version
ORIGINAL_CC=$(CC) ; \
ORIGINAL_LD=$(LD) ; \
export CC=i686-w64-mingw32-gcc ; \
export LD=i686-w64-mingw32-ld ; \
$(MAKE) BACNET_PORT=win32 -s -C apps all ; \
export CC=$(ORIGINAL_CC) ; \
export LD=$(ORIGINAL_LD)
.PHONY: mstpwin32
mstpwin32:
$(MAKE) BACDL=mstp BACNET_PORT=win32 -s -C apps all
.PHONY: mstp
mstp:
$(MAKE) BACDL=mstp -s -C apps all
.PHONY: bip6-win32
bip6-win32:
$(MAKE) BACDL=bip6 BACNET_PORT=win32 -s -C apps all
.PHONY: bip6
bip6:
$(MAKE) BACDL=bip6 -s -C apps all
.PHONY: bip
bip:
$(MAKE) BACDL=bip -s -C apps all
.PHONY: bip-client
bip-client:
$(MAKE) BACDL=bip BBMD=client -s -C apps all
.PHONY: ethernet
ethernet:
$(MAKE) BACDL=ethernet -s -C apps all
.PHONY: apps
apps:
$(MAKE) -s -C apps all
.PHONY: lib
lib:
$(MAKE) -s -C apps $@
CMAKE_BUILD_DIR=build
.PHONY: cmake
cmake:
[ -d $(CMAKE_BUILD_DIR) ] || mkdir -p $(CMAKE_BUILD_DIR)
[ -d $(CMAKE_BUILD_DIR) ] && cd $(CMAKE_BUILD_DIR) && cmake .. -DBUILD_SHARED_LIBS=ON && cmake --build . --clean-first
.PHONY: cmake-win32
cmake-win32:
mkdir -p $(CMAKE_BUILD_DIR)
cd $(CMAKE_BUILD_DIR) && cmake ../ -DBACNET_STACK_BUILD_APPS=ON && cmake --build ./ --clean-first
cp $(CMAKE_BUILD_DIR)/Debug/*.exe ./bin/.
.PHONY: abort
abort:
$(MAKE) -s -C apps $@
.PHONY: ack-alarm
ack-alarm:
$(MAKE) -s -C apps $@
.PHONY: add-list-element
add-list-element:
$(MAKE) -s -C apps $@
.PHONY: apdu
apdu:
$(MAKE) -s -C apps $@
.PHONY: blinkt
blinkt:
$(MAKE) -s -C apps $@
.PHONY: create-object
create-object:
$(MAKE) -s -C apps $@
.PHONY: dcc
dcc:
$(MAKE) -s -C apps $@
.PHONY: delete-object
delete-object:
$(MAKE) -s -C apps $@
.PHONY: epics
epics:
$(MAKE) -s -C apps $@
.PHONY: error
error:
$(MAKE) -s -C apps $@
.PHONY: event
event:
$(MAKE) -s -C apps $@
.PHONY: iam
iam:
$(MAKE) -s -C apps $@
.PHONY: getevent
getevent:
$(MAKE) -s -C apps $@
.PHONY: gateway
gateway:
$(MAKE) -s -B -C apps $@
.PHONY: gateway-win32
gateway-win32:
$(MAKE) BACNET_PORT=win32 -s -B -C apps gateway
.PHONY: piface
piface:
$(MAKE) CSTANDARD="-std=gnu11" LEGACY=true -s -C apps $@
.PHONY: readbdt
readbdt:
$(MAKE) -s -C apps $@
.PHONY: readfdt
readfdt:
$(MAKE) -s -C apps $@
.PHONY: readprop
readprop:
$(MAKE) -s -C apps $@
.PHONY: readpropm
readpropm:
$(MAKE) -s -C apps $@
.PHONY: remove-list-element
remove-list-element:
$(MAKE) -s -C apps $@
.PHONY: writebdt
writebdt:
$(MAKE) -s -C apps $@
.PHONY: whatisnetnum
whatisnetnum:
$(MAKE) -s -C apps $@
.PHONY: netnumis
netnumis:
$(MAKE) -s -C apps $@
.PHONY: server
server:
$(MAKE) -s -C apps $@
.PHONY: server-client
server-client:
$(MAKE) LEGACY=true -s -C apps $@
.PHONY: server-discover
server-discover:
$(MAKE) LEGACY=true -s -C apps $@
.PHONY: mstpcap
mstpcap:
$(MAKE) -s -C apps $@
.PHONY: mstpcrc
mstpcrc:
$(MAKE) -s -C apps $@
.PHONY: uevent
uevent:
$(MAKE) -s -C apps $@
.PHONY: whois
whois:
$(MAKE) -s -C apps $@
.PHONY: writepropm
writepropm:
$(MAKE) -s -C apps $@
.PHONY: router
router:
$(MAKE) -s -C apps $@
.PHONY: router-ipv6
router-ipv6:
$(MAKE) -s -B BACDL=bip-bip6 -C apps $@
.PHONY: router-ipv6-win32
router-ipv6-win32:
$(MAKE) BACNET_PORT=win32 -s -B BACDL=bip-bip6 -C apps router-ipv6
.PHONY: router-ipv6-clean
router-ipv6-clean:
$(MAKE) -C apps $@
.PHONY: router-mstp
router-mstp:
$(MAKE) -s -B BACDL=bip-mstp -C apps $@
.PHONY: router-mstp-win32
router-mstp-win32:
$(MAKE) BACNET_PORT=win32 -s -B BACDL=bip-mstp -C apps router-mstp
.PHONY: router-mstp-clean
router-mstp-clean:
$(MAKE) -C apps $@
.PHONY: fuzz-libfuzzer
fuzz-libfuzzer:
$(MAKE) -s -C apps $@
.PHONY: fuzz-afl
fuzz-afl:
$(MAKE) -s -C apps $@
# Add "ports" to the build, if desired
.PHONY: ports
ports: atmega168 bdk-atxx4-mstp at91sam7s stm32f10x stm32f4xx
@echo "Built the ARM7 and AVR ports"
.PHONY: ports-clean
ports-clean: atmega168-clean bdk-atxx4-mstp-clean at91sam7s-clean \
stm32f10x-clean stm32f4xx-clean xplained-clean
.PHONY: atmega168
atmega168: ports/atmega168/Makefile
$(MAKE) -s -C ports/atmega168 clean all
.PHONY: atmega168-clean
atmega168-clean: ports/atmega168/Makefile
$(MAKE) -s -C ports/atmega168 clean
.PHONY: bdk-atxx4-mstp
bdk-atxx4-mstp: ports/bdk-atxx4-mstp/Makefile
$(MAKE) -s -C ports/bdk-atxx4-mstp clean all
.PHONY: bdk-atxx4-mstp-clean
bdk-atxx4-mstp-clean: ports/bdk-atxx4-mstp/Makefile
$(MAKE) -s -C ports/bdk-atxx4-mstp clean
.PHONY: at91sam7s
at91sam7s: ports/at91sam7s/Makefile
$(MAKE) -s -C ports/at91sam7s clean all
.PHONY: at91sam7s-clean
at91sam7s-clean: ports/at91sam7s/Makefile
$(MAKE) -s -C ports/at91sam7s clean
AT91SAM7S_CMAKE_BUILD_DIR=ports/at91sam7s/build
.PHONY: at91sam7s-cmake
at91sam7s-cmake:
[ -d $(AT91SAM7S_CMAKE_BUILD_DIR) ] || mkdir -p $(AT91SAM7S_CMAKE_BUILD_DIR)
[ -d $(AT91SAM7S_CMAKE_BUILD_DIR) ] && cd $(AT91SAM7S_CMAKE_BUILD_DIR) && \
cmake ../ && cmake --build . --clean-first
.PHONY: stm32f10x
stm32f10x: ports/stm32f10x/Makefile
$(MAKE) -s -C ports/stm32f10x clean all
.PHONY: stm32f10x-clean
stm32f10x-clean: ports/stm32f10x/Makefile
$(MAKE) -s -C ports/stm32f10x clean
.PHONY: stm32f4xx
stm32f4xx: ports/stm32f4xx/Makefile
$(MAKE) -s -C ports/stm32f4xx clean all
.PHONY: stm32f4xx-clean
stm32f4xx-clean: ports/stm32f4xx/Makefile
$(MAKE) -s -C ports/stm32f4xx clean
STM32F4XX_CMAKE_BUILD_DIR=ports/stm32f4xx/build
.PHONY: stm32f4xx-cmake
stm32f4xx-cmake:
[ -d $(STM32F4XX_CMAKE_BUILD_DIR) ] || mkdir -p $(STM32F4XX_CMAKE_BUILD_DIR)
[ -d $(STM32F4XX_CMAKE_BUILD_DIR) ] && cd $(STM32F4XX_CMAKE_BUILD_DIR) && \
cmake ../ && cmake --build . --clean-first
.PHONY: xplained
xplained: ports/xplained/Makefile
$(MAKE) -s -C ports/xplained clean all
.PHONY: xplained-clean
xplained-clean: ports/xplained/Makefile
$(MAKE) -s -C ports/xplained clean
.PHONY: mstpsnap
mstpsnap: ports/linux/mstpsnap.mak
$(MAKE) -s -C ports/linux -f mstpsnap.mak clean all
.PHONY: lwip
lwip: ports/lwip/Makefile
$(MAKE) -s -C ports/lwip clean all
.PHONY: pretty
pretty:
find ./src -iname *.h -o -iname *.c -exec \
clang-format -i -style=file -fallback-style=none {} \;
find ./apps -iname *.h -o -iname *.c -exec \
clang-format -i -style=file -fallback-style=none {} \;
.PHONY: pretty-apps
pretty-apps:
find ./apps -iname *.h -o -iname *.c -exec \
clang-format -i -style=file -fallback-style=none {} \;
.PHONY: pretty-ports
pretty-ports:
find ./ports -maxdepth 2 -type f -iname *.h -o -iname *.c -exec \
clang-format -i -style=file -fallback-style=none {} \;
.PHONY: pretty-test
pretty-test:
find ./test/bacnet -type f -iname *.h -o -iname *.c -exec \
clang-format -i -style=file -fallback-style=none {} \;
CLANG_TIDY_OPTIONS = -fix-errors -checks="readability-braces-around-statements"
CLANG_TIDY_OPTIONS += -- -Isrc -Iports/linux
.PHONY: tidy
tidy:
find ./src -iname *.h -o -iname *.c -exec clang-tidy {} $(CLANG_TIDY_OPTIONS) \;
find ./apps -iname *.c -exec clang-tidy {} $(CLANG_TIDY_OPTIONS) \;
.PHONY: scan-build
scan-build:
scan-build --status-bugs -analyze-headers make -j2 LEGACY=true server
SPLINT_OPTIONS := -weak +posixlib +quiet \
-D__signed__=signed -D__gnuc_va_list=va_list \
-Isrc -Iports/linux \
+matchanyintegral +ignoresigns -unrecog -preproc \
+error-stream-stderr +warning-stream-stderr -warnposix \
-bufferoverflowhigh
SPLINT_FIND_OPTIONS := ./src -path ./src/bacnet/basic/ucix -prune -o -name "*.c"
.PHONY: splint
splint:
find $(SPLINT_FIND_OPTIONS) -exec splint $(SPLINT_OPTIONS) {} \;
CPPCHECK_OPTIONS = --enable=warning,portability
CPPCHECK_OPTIONS += --template=gcc
CPPCHECK_OPTIONS += --inline-suppr
CPPCHECK_OPTIONS += --suppress=selfAssignment
CPPCHECK_OPTIONS += --suppress=integerOverflow
CPPCHECK_OPTIONS += -DBACNET_STACK_DEPRECATED
#CPPCHECK_OPTIONS += -I./src
#CPPCHECK_OPTIONS += --enable=information --check-config
CPPCHECK_OPTIONS += --error-exitcode=1
.PHONY: cppcheck
cppcheck:
cppcheck $(CPPCHECK_OPTIONS) --quiet --force ./src/
.PHONY: flawfinder
flawfinder:
flawfinder --minlevel 5 --error-level=5 ./src/
IGNORE_WORDS = ba,statics
CODESPELL_OPTIONS = --write-changes --interactive 3 --enable-colors
CODESPELL_OPTIONS += --ignore-words-list $(IGNORE_WORDS)
.PHONY: codespell
codespell:
codespell $(CODESPELL_OPTIONS) ./src
SPELL_OPTIONS = --enable-colors --ignore-words-list $(IGNORE_WORDS)
.PHONY: spell
spell:
codespell $(SPELL_OPTIONS) ./src
# McCabe's Cyclomatic Complexity Scores
# sudo apt install pmccable
COMPLEXITY_SRC = \
$(wildcard ./src/bacnet/*.c) \
$(wildcard ./src/bacnet/basic/*.c) \
$(wildcard ./src/bacnet/basic/binding/*.c) \
$(wildcard ./src/bacnet/basic/service/*.c) \
$(wildcard ./src/bacnet/basic/sys/*.c) \
./src/bacnet/basic/npdu/h_npdu.c \
./src/bacnet/basic/npdu/s_router.c \
./src/bacnet/basic/tsm/tsm.c
.PHONY: pmccabe
pmccabe:
pmccabe $(COMPLEXITY_SRC) | awk '{print $$2,$$6,$$7}' | sort -nr | head -20
# sudo apt install complexity
# 0-9 Easily maintained code.
# 10-19 Maintained with little trouble.
# 20-29 Maintained with some effort.
# 30-39 Difficult to maintain code.
# 40-49 Hard to maintain code.
# 50-99 Unmaintainable code.
# 100-199 Crazy making difficult code.
# 200+ I only wish I were kidding.
.PHONY: complexity
complexity:
complexity $(COMPLEXITY_SRC)
# sudo apt install sloccount
.PHONY: sloccount
sloccount:
sloccount .
.PHONY: clean
clean: ports-clean
$(MAKE) -s -C src clean
$(MAKE) -s -C apps clean
$(MAKE) -s -C apps/router clean
$(MAKE) -s -C apps/router-ipv6 clean
$(MAKE) -s -C apps/router-mstp clean
$(MAKE) -s -C apps/gateway clean
$(MAKE) -s -C apps/fuzz-afl clean
$(MAKE) -s -C apps/fuzz-libfuzzer clean
$(MAKE) -s -C ports/lwip clean
$(MAKE) -s -C test clean
rm -rf ./build
.PHONY: test
test:
$(MAKE) -s -C test clean
$(MAKE) -s -j -C test all
.PHONY: retest
retest:
$(MAKE) -s -j -C test retest
# Zephyr unit testing with twister
# expects zephyr to be installed in ../zephyr in Workspace
# expects ZEPHYR_BASE to be set. E.g. source ../zephyr/zephyr-env.sh
# see https://docs.zephyrproject.org/latest/getting_started/index.html
TWISTER_RESULTS=../twister-out.unit_testing
.PHONY: twister
twister:
ifndef ZEPHYR_BASE
$(error ZEPHYR_BASE is undefined)
endif
$(ZEPHYR_BASE)/scripts/twister -O $(TWISTER_RESULTS) -p unit_testing -T zephyr/tests
.PHONY: twister-clean
twister-clean:
-rm -rf $(TWISTER_RESULTS)
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment