Skip to content

Commit

Permalink
Fixed device object compile errors and added IPv6 recipes for blinkt …
Browse files Browse the repository at this point in the history
…and piface (bacnet-stack#841)
  • Loading branch information
skarg authored Oct 31, 2024
1 parent 7b6a092 commit 6d9cff2
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 35 deletions.
99 changes: 81 additions & 18 deletions .github/workflows/raspi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ on:
description: 'Environment to run tests against'
type: environment
required: true

jobs:
log-the-inputs:
runs-on: raspios/base:latest
runs-on: ubuntu-latest
steps:
- run: |
echo "Log level: $LEVEL"
Expand All @@ -32,44 +32,107 @@ jobs:
env:
LEVEL: ${{ inputs.logLevel }}
TAGS: ${{ inputs.tags }}
ENVIRONMENT: ${{ inputs.environment }}
ENVIRONMENT: ${{ inputs.environment }}
raspi-bip-apps:
runs-on: raspios/base:latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout
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 gcc-arm-linux-gnueabihf
- name: Build Demo Apps
run: |
gcc --version
export CC=arm-linux-gnueabihf-gcc
export LD=arm-linux-gnueabihf-ld
arm-linux-gnueabihf-gcc --version
make clean
make all
make LEGACY=true all
piface:
runs-on: raspios/base:latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4

- name: Checkout libmcp23s17 repo
uses: actions/checkout@v4
with:
repository: piface/libmcp23s17
path: ./apps/piface/libmcp23s17

- name: Checkout libpifacedigital repo
uses: actions/checkout@v4
with:
repository: piface/libpifacedigital
path: ./apps/piface/libpifacedigital

- name: Create Build Environment
run: |
sudo apt-get update -qq
- name: Build Demo Apps
sudo apt-get install -qq gcc-arm-linux-gnueabihf
- name: Build libmcp23s17 library
run: |
arm-linux-gnueabihf-gcc --version
cd apps/piface/libmcp23s17
make CC=arm-linux-gnueabihf-gcc
arm-linux-gnueabihf-ar rcs libmcp23s17.a src/mcp23s17.o
cd ../../../
- name: Build pifacedigital library
run: |
arm-linux-gnueabihf-gcc --version
cd apps/piface/libpifacedigital
make CC=arm-linux-gnueabihf-gcc
: # Use the arm-linux-gnueabihf-ar command to create a static library
arm-linux-gnueabihf-ar rcs libpifacedigital.a src/pifacedigital.o
cd ../../../
- name: Build Piface demo
run: |
gcc --version
cd apps/piface && ./configure && cd ../../
arm-linux-gnueabihf-gcc --version
: # BACnet library uses environment CC and LD variables
CC=arm-linux-gnueabihf-gcc
LD=arm-linux-gnueabihf-ld
CROSS_PREFIX=arm-linux-gnueabihf-
make piface
blinkt:
runs-on: raspios/base:latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4

- name: Checkout pigpio repo
uses: actions/checkout@v4
with:
repository: joan2937/pigpio
path: ./apps/blinkt/pigpio

- 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
sudo apt-get install -qq gcc-arm-linux-gnueabihf
- name: Build Blinkt! pigpio library
run: |
arm-linux-gnueabihf-gcc --version
CROSS_PREFIX=arm-linux-gnueabihf-
DESTDIR="${HOME}/.local/bin"
cd apps/binkt/pigpio
make CROSS_PREFIX="${CROSS_PREFIX}" DESTDIR="${DESTDIR}" all install
cd ../../../
- name: Build Blinkt! demo
run: |
gcc --version
arm-linux-gnueabihf-gcc --version
: # BACnet library uses environment CC and LD variables
export CC=arm-linux-gnueabihf-gcc
export LD=arm-linux-gnueabihf-ld
export CROSS_PREFIX=arm-linux-gnueabihf-
make blinkt
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ apdu:

.PHONY: blinkt
blinkt:
$(MAKE) -s -C apps $@
$(MAKE) LEGACY=true -C apps $@

.PHONY: blinkt6
blinkt6:
$(MAKE) LEGACY=true BACDL=bip6 -C apps blinkt

.PHONY: create-object
create-object:
Expand Down Expand Up @@ -140,6 +144,10 @@ gateway-win32:
piface:
$(MAKE) CSTANDARD="-std=gnu11" LEGACY=true -s -C apps $@

.PHONY: piface6
piface6:
$(MAKE) CSTANDARD="-std=gnu11" BACDL=bip6 LEGACY=true -s -C apps piface

.PHONY: readbdt
readbdt:
$(MAKE) -s -C apps $@
Expand Down
2 changes: 1 addition & 1 deletion apps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ apdu: $(BACNET_LIB_TARGET)

.PHONY: blinkt
blinkt:
$(MAKE) -C $@
$(MAKE) -B -C $@

.PHONY: create-object
create-object: $(BACNET_LIB_TARGET)
Expand Down
14 changes: 12 additions & 2 deletions apps/blinkt/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

## General Flags
TARGET = bacblinkt

# BACnet objects that are used with this app
BACNET_OBJECT_DIR = $(BACNET_SRC_DIR)/bacnet/basic/object
SRC = main.c \
Expand All @@ -22,8 +23,17 @@ CFLAGS += -DMAX_TSM_TRANSACTIONS=1
# TARGET_EXT is defined in apps/Makefile as .exe or nothing
TARGET_BIN = ${TARGET}$(TARGET_EXT)

#
# Set CROSS_PREFIX to prepend to all compiler tools at once for easier
# cross-compilation.
CROSS_PREFIX ?=
CC = $(CROSS_PREFIX)gcc
AR = $(CROSS_PREFIX)ar
RANLIB = $(CROSS_PREFIX)ranlib
SIZE = $(CROSS_PREFIX)size

# note: link to pigpio daemon so that our app can run without root
# start pigio daemon with the command 'sudo pigpiod'
# start pigpio daemon with the command 'sudo pigpiod'
LD_PIGPIO = -Wl,-pthread,-lpigpiod_if2
LFLAGS += $(LD_PIGPIO)

Expand All @@ -33,7 +43,7 @@ all: ${BACNET_LIB_TARGET} Makefile ${TARGET_BIN}

${TARGET_BIN}: ${OBJS} Makefile ${BACNET_LIB_TARGET}
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
size $@
$(SIZE) $@
cp $@ ../../bin

${BACNET_LIB_TARGET}:
Expand Down
6 changes: 1 addition & 5 deletions apps/blinkt/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
#include "bacnet/basic/object/color_temperature.h"
#endif

/* local forward (semi-private) and external prototypes */
int Device_Read_Property_Local(BACNET_READ_PROPERTY_DATA *rpdata);
bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data);

/* may be overridden by outside table */
static object_functions_t *Object_Table;

Expand Down Expand Up @@ -924,7 +920,7 @@ int Device_Object_List_Element_Encode(
* @return True on success or else False if not found.
*/
bool Device_Valid_Object_Name(
BACNET_CHARACTER_STRING *object_name1,
const BACNET_CHARACTER_STRING *object_name1,
BACNET_OBJECT_TYPE *object_type,
uint32_t *object_instance)
{
Expand Down
16 changes: 14 additions & 2 deletions apps/piface/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,25 @@ SRC = main.c \
$(BACNET_OBJECT_DIR)/blo.c \
$(BACNET_OBJECT_DIR)/bo.c

# Set CROSS_PREFIX to prepend to all compiler tools at once for easier
# cross-compilation.
CROSS_PREFIX ?=
CC = $(CROSS_PREFIX)gcc
AR = $(CROSS_PREFIX)ar
RANLIB = $(CROSS_PREFIX)ranlib
SIZE = $(CROSS_PREFIX)size
STRIP = $(CROSS_PREFIX)strip

CFLAGS += -DMAX_TSM_TRANSACTIONS=1
CFLAGS += -DMAX_BINARY_INPUTS=4
CFLAGS += -DMAX_BINARY_OUTPUTS=8

# TARGET_EXT is defined in apps/Makefile as .exe or nothing
TARGET_BIN = ${TARGET}$(TARGET_EXT)

# relies on the BACnet library
BACNET_LIB_DIR = $(realpath ../lib)

# Source locations
PIFACE_INCLUDE = libpifacedigital/src
PIFACE_LIB = libpifacedigital
Expand All @@ -35,8 +47,8 @@ OBJS += ${SRC:.c=.o}
all: ${BACNET_LIB_TARGET} Makefile ${TARGET_BIN}

${TARGET_BIN}: ${OBJS} Makefile ${BACNET_LIB_TARGET}
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
size $@
$(CC) ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
$(SIZE) $@
cp $@ ../../bin

${BACNET_LIB_TARGET}:
Expand Down
4 changes: 2 additions & 2 deletions apps/piface/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

if [ ! -d "libmcp23s17" ]
then
git clone git@github.com:piface/libmcp23s17.git
git clone https://github.com/piface/libmcp23s17.git
fi

if [ ! -d "libpifacedigital" ]
then
git clone git@github.com:piface/libpifacedigital.git
git clone https://github.com:piface/libpifacedigital.git
fi

# Build the library
Expand Down
4 changes: 0 additions & 4 deletions apps/piface/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@
#include "bacnet/basic/object/netport.h"
#endif

/* local forward (semi-private) and external prototypes */
int Device_Read_Property_Local(BACNET_READ_PROPERTY_DATA *rpdata);
bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data);

/* may be overridden by outside table */
static object_functions_t *Object_Table;

Expand Down

0 comments on commit 6d9cff2

Please sign in to comment.