From 7f5c85ebbefe5e449ceb07704d90b2f6cfb88067 Mon Sep 17 00:00:00 2001 From: Scott Wagner Date: Wed, 19 Aug 2020 10:15:33 -0400 Subject: [PATCH 1/2] Allow #define configuration of SPI parameters Enclose preprocessor define of SPI_SPEED and SPI_DEV_PATH in #ifndef so that these values can optinally be passed by compiler / makefile defines at build time for a specific platform or architecture. Allow CFLAGS to be passed in to Makefile (e.g. to allow preprocessor defines to be set) --- libloragw/Makefile | 2 +- libloragw/src/loragw_spi.native.c | 4 ++++ util_lbt_test/Makefile | 2 +- util_pkt_logger/Makefile | 2 +- util_spectral_scan/Makefile | 2 +- util_spi_stress/Makefile | 2 +- util_tx_continuous/Makefile | 2 +- util_tx_test/Makefile | 2 +- 8 files changed, 11 insertions(+), 7 deletions(-) diff --git a/libloragw/Makefile b/libloragw/Makefile index 53c33d90..34007bc1 100644 --- a/libloragw/Makefile +++ b/libloragw/Makefile @@ -10,7 +10,7 @@ CROSS_COMPILE ?= CC := $(CROSS_COMPILE)gcc AR := $(CROSS_COMPILE)ar -CFLAGS := -O2 -Wall -Wextra -std=c99 -Iinc -I. +override CFLAGS += -O2 -Wall -Wextra -std=c99 -Iinc -I. OBJDIR = obj INCLUDES = $(wildcard inc/*.h) diff --git a/libloragw/src/loragw_spi.native.c b/libloragw/src/loragw_spi.native.c index c01ed1c1..45423fdd 100644 --- a/libloragw/src/loragw_spi.native.c +++ b/libloragw/src/loragw_spi.native.c @@ -53,8 +53,12 @@ Maintainer: Sylvain Miermont #define READ_ACCESS 0x00 #define WRITE_ACCESS 0x80 +#ifndef SPI_SPEED #define SPI_SPEED 8000000 +#endif +#ifndef SPI_DEV_PATH #define SPI_DEV_PATH "/dev/spidev0.0" +#endif //#define SPI_DEV_PATH "/dev/spidev32766.0" /* -------------------------------------------------------------------------- */ diff --git a/util_lbt_test/Makefile b/util_lbt_test/Makefile index de937e40..5fb4b652 100644 --- a/util_lbt_test/Makefile +++ b/util_lbt_test/Makefile @@ -17,7 +17,7 @@ include $(LGW_PATH)/library.cfg CC := $(CROSS_COMPILE)gcc AR := $(CROSS_COMPILE)ar -CFLAGS=-O2 -Wall -Wextra -std=c99 -Iinc -I. +override CFLAGS += -O2 -Wall -Wextra -std=c99 -Iinc -I. OBJDIR = obj diff --git a/util_pkt_logger/Makefile b/util_pkt_logger/Makefile index 264ccc19..c32fed9a 100644 --- a/util_pkt_logger/Makefile +++ b/util_pkt_logger/Makefile @@ -17,7 +17,7 @@ include $(LGW_PATH)/library.cfg CC := $(CROSS_COMPILE)gcc AR := $(CROSS_COMPILE)ar -CFLAGS=-O2 -Wall -Wextra -std=c99 -Iinc -I. +override CFLAGS += -O2 -Wall -Wextra -std=c99 -Iinc -I. OBJDIR = obj diff --git a/util_spectral_scan/Makefile b/util_spectral_scan/Makefile index 35d625fb..5baf6b62 100644 --- a/util_spectral_scan/Makefile +++ b/util_spectral_scan/Makefile @@ -12,7 +12,7 @@ include $(LGW_PATH)/library.cfg CC = $(CROSS_COMPILE)gcc AR = $(CROSS_COMPILE)ar -CFLAGS = -O2 -Wall -Wextra -std=c99 -I inc +override CFLAGS += -O2 -Wall -Wextra -std=c99 -I inc OBJDIR = obj INCLUDES = $(wildcard inc/*.h) diff --git a/util_spi_stress/Makefile b/util_spi_stress/Makefile index 23e3c88d..c2dd3a57 100644 --- a/util_spi_stress/Makefile +++ b/util_spi_stress/Makefile @@ -18,7 +18,7 @@ include $(LGW_PATH)/library.cfg CC := $(CROSS_COMPILE)gcc AR := $(CROSS_COMPILE)ar -CFLAGS=-O2 -Wall -Wextra -std=c99 -Iinc -I. +override CFLAGS += -O2 -Wall -Wextra -std=c99 -Iinc -I. OBJDIR = obj diff --git a/util_tx_continuous/Makefile b/util_tx_continuous/Makefile index b07419be..5ddd7e98 100644 --- a/util_tx_continuous/Makefile +++ b/util_tx_continuous/Makefile @@ -18,7 +18,7 @@ include $(LGW_PATH)/library.cfg CC := $(CROSS_COMPILE)gcc AR := $(CROSS_COMPILE)ar -CFLAGS=-O2 -Wall -Wextra -std=c99 -Iinc -I. +override CFLAGS += -O2 -Wall -Wextra -std=c99 -Iinc -I. OBJDIR = obj diff --git a/util_tx_test/Makefile b/util_tx_test/Makefile index 8c35229f..5707ad4b 100644 --- a/util_tx_test/Makefile +++ b/util_tx_test/Makefile @@ -18,7 +18,7 @@ include $(LGW_PATH)/library.cfg CC := $(CROSS_COMPILE)gcc AR := $(CROSS_COMPILE)ar -CFLAGS=-O2 -Wall -Wextra -std=c99 -Iinc -I. +override CFLAGS += CFLAGS=-O2 -Wall -Wextra -std=c99 -Iinc -I. OBJDIR = obj From f11e24e6b167980198a761305de29a14f288ac83 Mon Sep 17 00:00:00 2001 From: Scott Wagner Date: Wed, 19 Aug 2020 15:35:41 -0400 Subject: [PATCH 2/2] Fix CFLAGS error in util_tx_test/Makefile --- util_tx_test/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util_tx_test/Makefile b/util_tx_test/Makefile index 5707ad4b..5e92a59c 100644 --- a/util_tx_test/Makefile +++ b/util_tx_test/Makefile @@ -18,7 +18,7 @@ include $(LGW_PATH)/library.cfg CC := $(CROSS_COMPILE)gcc AR := $(CROSS_COMPILE)ar -override CFLAGS += CFLAGS=-O2 -Wall -Wextra -std=c99 -Iinc -I. +override CFLAGS += -O2 -Wall -Wextra -std=c99 -Iinc -I. OBJDIR = obj