diff --git a/examples/lora/README.md b/examples/lora/README.md index f77d6f0c0..327181733 100644 --- a/examples/lora/README.md +++ b/examples/lora/README.md @@ -23,3 +23,21 @@ RadioLib. Note that the Makefiles will do this automatically when you run `make` in a subdirectory, but if you want to do it manually you can run the `build-RadioLib.sh` script. + +### Building + +To bulid any example just enter the directory and type + +```shell +make +``` + +This will build RadioLib and then the example application for +both ARM and RISC-V architectures. + +If you wish to use the RadioLib build infrastructure to build +RadioLib (instead of the libtock-c system) you can also use + +```shell +CMAKE=1 make +``` diff --git a/examples/lora/sensor-receive/Makefile b/examples/lora/sensor-receive/Makefile index 9c2b4c573..c858844bb 100644 --- a/examples/lora/sensor-receive/Makefile +++ b/examples/lora/sensor-receive/Makefile @@ -15,6 +15,8 @@ override CPPFLAGS += -isystem ../RadioLib/examples/NonArduino/Tock # Include the base of libtock-c to fix the libtock/ includes from RadioLib override CPPFLAGS += -I$(TOCK_USERLAND_BASE_DIR)/ +ifeq ($(CMAKE),1) +# Use the RadioLib cmake build infrastructure LIBS_cortex-m += ../RadioLib/examples/NonArduino/Tock/build-arm/RadioLib/libRadioLib.a LIBS_cortex-m0 += ../RadioLib/examples/NonArduino/Tock/build-arm/RadioLib/libRadioLib.a LIBS_cortex-m3 += ../RadioLib/examples/NonArduino/Tock/build-arm/RadioLib/libRadioLib.a @@ -42,3 +44,26 @@ include $(TOCK_USERLAND_BASE_DIR)/AppMakefile.mk mkdir -p build-riscv && cd build-riscv && \ LIBTOCK_C_DIRECTORY="$(TOCK_USERLAND_BASE_DIR)/../../../" cmake -G "CodeBlocks - Unix Makefiles" -DRISCV_BUILD=1 .. && \ $(MAKE) -j4 2> /dev/null || true +else +# Use the libtock-c Make system +LIBS_cortex-m0 += $(TOCK_USERLAND_BASE_DIR)/examples/lora/RadioLib/build/cortex-m0/RadioLib.a +LIBS_cortex-m3 += $(TOCK_USERLAND_BASE_DIR)/examples/lora/RadioLib/build/cortex-m3/RadioLib.a +LIBS_cortex-m4 += $(TOCK_USERLAND_BASE_DIR)/examples/lora/RadioLib/build/cortex-m4/RadioLib.a +LIBS_cortex-m7 += $(TOCK_USERLAND_BASE_DIR)/examples/lora/RadioLib/build/cortex-m7/RadioLib.a + +LIBS_rv32imc += $(TOCK_USERLAND_BASE_DIR)/examples/lora/RadioLib/build/rv32imc/RadioLib.a +LIBS_rv32imac += $(TOCK_USERLAND_BASE_DIR)/examples/lora/RadioLib/build/rv32imac/RadioLib.a + +include $(TOCK_USERLAND_BASE_DIR)/AppMakefile.mk + +LIBNAME := RadioLib + +$(LIBNAME)_DIR := $(TOCK_USERLAND_BASE_DIR)/examples/lora/$(LIBNAME) + +$(LIBNAME)_SRCS := \ + $(wildcard $($(LIBNAME)_DIR)/src/*.cpp) \ + $(wildcard $($(LIBNAME)_DIR)/src/*/*.cpp) \ + $(wildcard $($(LIBNAME)_DIR)/src/*/*/*.cpp) + +include $(TOCK_USERLAND_BASE_DIR)/TockLibrary.mk +endif diff --git a/examples/lora/sensor-transmit/Makefile b/examples/lora/sensor-transmit/Makefile index 9c2b4c573..c858844bb 100644 --- a/examples/lora/sensor-transmit/Makefile +++ b/examples/lora/sensor-transmit/Makefile @@ -15,6 +15,8 @@ override CPPFLAGS += -isystem ../RadioLib/examples/NonArduino/Tock # Include the base of libtock-c to fix the libtock/ includes from RadioLib override CPPFLAGS += -I$(TOCK_USERLAND_BASE_DIR)/ +ifeq ($(CMAKE),1) +# Use the RadioLib cmake build infrastructure LIBS_cortex-m += ../RadioLib/examples/NonArduino/Tock/build-arm/RadioLib/libRadioLib.a LIBS_cortex-m0 += ../RadioLib/examples/NonArduino/Tock/build-arm/RadioLib/libRadioLib.a LIBS_cortex-m3 += ../RadioLib/examples/NonArduino/Tock/build-arm/RadioLib/libRadioLib.a @@ -42,3 +44,26 @@ include $(TOCK_USERLAND_BASE_DIR)/AppMakefile.mk mkdir -p build-riscv && cd build-riscv && \ LIBTOCK_C_DIRECTORY="$(TOCK_USERLAND_BASE_DIR)/../../../" cmake -G "CodeBlocks - Unix Makefiles" -DRISCV_BUILD=1 .. && \ $(MAKE) -j4 2> /dev/null || true +else +# Use the libtock-c Make system +LIBS_cortex-m0 += $(TOCK_USERLAND_BASE_DIR)/examples/lora/RadioLib/build/cortex-m0/RadioLib.a +LIBS_cortex-m3 += $(TOCK_USERLAND_BASE_DIR)/examples/lora/RadioLib/build/cortex-m3/RadioLib.a +LIBS_cortex-m4 += $(TOCK_USERLAND_BASE_DIR)/examples/lora/RadioLib/build/cortex-m4/RadioLib.a +LIBS_cortex-m7 += $(TOCK_USERLAND_BASE_DIR)/examples/lora/RadioLib/build/cortex-m7/RadioLib.a + +LIBS_rv32imc += $(TOCK_USERLAND_BASE_DIR)/examples/lora/RadioLib/build/rv32imc/RadioLib.a +LIBS_rv32imac += $(TOCK_USERLAND_BASE_DIR)/examples/lora/RadioLib/build/rv32imac/RadioLib.a + +include $(TOCK_USERLAND_BASE_DIR)/AppMakefile.mk + +LIBNAME := RadioLib + +$(LIBNAME)_DIR := $(TOCK_USERLAND_BASE_DIR)/examples/lora/$(LIBNAME) + +$(LIBNAME)_SRCS := \ + $(wildcard $($(LIBNAME)_DIR)/src/*.cpp) \ + $(wildcard $($(LIBNAME)_DIR)/src/*/*.cpp) \ + $(wildcard $($(LIBNAME)_DIR)/src/*/*/*.cpp) + +include $(TOCK_USERLAND_BASE_DIR)/TockLibrary.mk +endif