From bdea0fb00ba13df3d7e88aa313a8a536a5fc0d89 Mon Sep 17 00:00:00 2001 From: Marvin Arnold Date: Mon, 18 Oct 2021 09:55:58 -0500 Subject: [PATCH] fix(build): set SPI_DEV_DIR and SPI_SPEED macros Also improved logging. --- Dockerfile | 4 +++- compile_libloragw.sh | 4 ++-- libloragw/Makefile | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2425703e..4abac147 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,9 +2,11 @@ # $OUTPUT_DIR/$SPI_BUS respectively. Also copies reset_lgw.sh # to $OUTPUT_DIR. -FROM balenalib/raspberry-pi-debian:buster-build as sx1301-builder +FROM balenalib/raspberry-pi-debian:buster-build as lora-gateway-sx1301-builder ENV ROOT_DIR=/opt + +# Output built files to this location ENV OUTPUT_DIR="$ROOT_DIR/output" # Overwirtes value in loragw_spi.native.c diff --git a/compile_libloragw.sh b/compile_libloragw.sh index d6436a3f..ed89c22a 100755 --- a/compile_libloragw.sh +++ b/compile_libloragw.sh @@ -12,11 +12,11 @@ compile_libloragw_for_spi_bus() { cd "$ROOT_DIR" cp -r "$ROOT_DIR/libloragw/" "$OUTPUT_DIR/$spi_bus" - echo "Finished building libloragw for sx1301 on $spi_bus in $ROOT_DIR" + echo "Finished building libloragw for sx1301 on $spi_bus in $OUTPUT_DIR" } compile_libloragw() { - echo "Compiling libloragw for sx1301 concentrator on all the necessary SPI buses in $ROOT_DIR" + echo "Compiling libloragw for sx1301 concentrator on all the necessary SPI buses in $OUTPUT_DIR" # Built outputs will be copied to this directory mkdir -p "$OUTPUT_DIR" diff --git a/libloragw/Makefile b/libloragw/Makefile index 53c33d90..0e28d5e1 100644 --- a/libloragw/Makefile +++ b/libloragw/Makefile @@ -10,7 +10,8 @@ CROSS_COMPILE ?= CC := $(CROSS_COMPILE)gcc AR := $(CROSS_COMPILE)ar -CFLAGS := -O2 -Wall -Wextra -std=c99 -Iinc -I. +# Modified to include SPI_DEV_PATH and SPI_SPEED macros +CFLAGS := -O2 -Wall -Wextra -std=c99 -Iinc -I. -D'SPI_DEV_PATH="${SPI_DEV_DIR}"' -D'SPI_SPEED=${SPI_SPEED}' OBJDIR = obj INCLUDES = $(wildcard inc/*.h)