This is an example of BLE GATT Client, which receives broadcast data from BLE_Server_BME280 ( a GATT server) , then transfers values up to mbed Device Connector (cloud).
Please refer details about BLEClient_mbedDevConn below. https://github.com/soramame21/BLEClient_mbedDevConn
The location of required BLE GATT server, BLE_Server_BME280, is at here. https://developer.mbed.org/users/edamame22/code/BLE_Server_BME280/
mbed-client/test/lwm2mtestapplication/Makefile@0:29983394c6b6, 2017-04-13 (annotated)
- Committer:
- edamame22
- Date:
- Thu Apr 13 04:48:11 2017 +0000
- Revision:
- 0:29983394c6b6
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
edamame22 | 0:29983394c6b6 | 1 | # Makefile for LWM2M Test Application |
edamame22 | 0:29983394c6b6 | 2 | # |
edamame22 | 0:29983394c6b6 | 3 | # Define compiler toolchain with PLATFORM variable |
edamame22 | 0:29983394c6b6 | 4 | # Example |
edamame22 | 0:29983394c6b6 | 5 | # make PLATFORM=arm-linux-gnueabi- |
edamame22 | 0:29983394c6b6 | 6 | # |
edamame22 | 0:29983394c6b6 | 7 | |
edamame22 | 0:29983394c6b6 | 8 | ROOT := ../../../.. |
edamame22 | 0:29983394c6b6 | 9 | LWM2M_ROOT := $(ROOT)/lwm2m |
edamame22 | 0:29983394c6b6 | 10 | ROUTER_ROOT := $(ROOT)/Applications/NanoRouter |
edamame22 | 0:29983394c6b6 | 11 | |
edamame22 | 0:29983394c6b6 | 12 | VERSION := $(shell cd $(ROOT) && git describe --tags --long --dirty --always) |
edamame22 | 0:29983394c6b6 | 13 | |
edamame22 | 0:29983394c6b6 | 14 | # Specify list of sources to build |
edamame22 | 0:29983394c6b6 | 15 | LWM2M_SRC := \ |
edamame22 | 0:29983394c6b6 | 16 | main.cpp \ |
edamame22 | 0:29983394c6b6 | 17 | cmd_commands.cpp \ |
edamame22 | 0:29983394c6b6 | 18 | cmd_lwm2m.cpp \ |
edamame22 | 0:29983394c6b6 | 19 | lwm2mtest.cpp \ |
edamame22 | 0:29983394c6b6 | 20 | |
edamame22 | 0:29983394c6b6 | 21 | CXX_SRCS += $(LWM2M_SRC) |
edamame22 | 0:29983394c6b6 | 22 | |
edamame22 | 0:29983394c6b6 | 23 | HAL_SRCS += \ |
edamame22 | 0:29983394c6b6 | 24 | linux/arm_hal_interrupt.c \ |
edamame22 | 0:29983394c6b6 | 25 | linux/arm_hal_timer.c \ |
edamame22 | 0:29983394c6b6 | 26 | linux/ccm_mutex.c \ |
edamame22 | 0:29983394c6b6 | 27 | |
edamame22 | 0:29983394c6b6 | 28 | SRCS += $(addprefix $(ROOT)/Platforms/,$(HAL_SRCS)) |
edamame22 | 0:29983394c6b6 | 29 | |
edamame22 | 0:29983394c6b6 | 30 | EXE = lwm2mtestapplication |
edamame22 | 0:29983394c6b6 | 31 | |
edamame22 | 0:29983394c6b6 | 32 | override CFLAGS += -DENDPOINT -DUSE_LINUX |
edamame22 | 0:29983394c6b6 | 33 | override CFLAGS += -Wall -Wextra |
edamame22 | 0:29983394c6b6 | 34 | override CFLAGS += -g |
edamame22 | 0:29983394c6b6 | 35 | override CFLAGS += -pthread |
edamame22 | 0:29983394c6b6 | 36 | override CFLAGS += -std=gnu99 |
edamame22 | 0:29983394c6b6 | 37 | override CFLAGS += -D'MEM_ALLOC=malloc' -D'MEM_FREE=free' |
edamame22 | 0:29983394c6b6 | 38 | |
edamame22 | 0:29983394c6b6 | 39 | override CFLAGS += -DVERSION='"$(VERSION)"' |
edamame22 | 0:29983394c6b6 | 40 | |
edamame22 | 0:29983394c6b6 | 41 | override CXXFLAGS += -I$(ROOT) -I$(NSDL_DIR)/nsdl-c -I$(LIBSERVICE_DIR)/libService -I$(ROOT)/nanostack/nanostack -I$(ROOT)/event-loop/nanostack-event-loop |
edamame22 | 0:29983394c6b6 | 42 | override CXXFLAGS += -I$(LWM2M_ROOT) -I$(LWM2M_ROOT)/lwm2m-client |
edamame22 | 0:29983394c6b6 | 43 | override CXXFLAGS += -DTARGET_LIKE_LINUX |
edamame22 | 0:29983394c6b6 | 44 | override CXXFLAGS += -DHAVE_DEBUG |
edamame22 | 0:29983394c6b6 | 45 | override CXXFLAGS += -g |
edamame22 | 0:29983394c6b6 | 46 | # Generate dependency files when building |
edamame22 | 0:29983394c6b6 | 47 | override CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" |
edamame22 | 0:29983394c6b6 | 48 | |
edamame22 | 0:29983394c6b6 | 49 | # Build with coverage |
edamame22 | 0:29983394c6b6 | 50 | ifeq ($(COVERAGE), 1) |
edamame22 | 0:29983394c6b6 | 51 | override CFLAGS += --coverage |
edamame22 | 0:29983394c6b6 | 52 | override CXXFLAGS += --coverage |
edamame22 | 0:29983394c6b6 | 53 | endif |
edamame22 | 0:29983394c6b6 | 54 | |
edamame22 | 0:29983394c6b6 | 55 | # |
edamame22 | 0:29983394c6b6 | 56 | # Libraries |
edamame22 | 0:29983394c6b6 | 57 | # |
edamame22 | 0:29983394c6b6 | 58 | NSDL_DIR := $(ROOT)/nsdl-c |
edamame22 | 0:29983394c6b6 | 59 | LWM2M_DIR := $(ROOT)/lwm2m/lwm2m-client |
edamame22 | 0:29983394c6b6 | 60 | MBEDTLS_DIR := $(ROOT)/mbedtls/library |
edamame22 | 0:29983394c6b6 | 61 | LIBSERVICE_DIR := $(ROOT)/libService |
edamame22 | 0:29983394c6b6 | 62 | override CFLAGS += -I$(ROOT) -I$(NSDL_DIR)/nsdl-c -I$(LIBSERVICE_DIR)/libService -I$(ROOT)/nanostack/nanostack -I$(ROOT)/event-loop/nanostack-event-loop |
edamame22 | 0:29983394c6b6 | 63 | override CFLAGS += -I$(ROOT)/nanostack/Core/include -I$(ROOT)/Platforms/linux/include -I$(ROOT)/nanostack/HAL/common |
edamame22 | 0:29983394c6b6 | 64 | override CFLAGS += -I$(ROUTER_ROOT)/include |
edamame22 | 0:29983394c6b6 | 65 | override CFLAGS += -I$(ROOT)/Platforms/linux/include -I$(ROOT)/Drivers/linux -I$(ROOT)/Boards/linux |
edamame22 | 0:29983394c6b6 | 66 | LDFLAGS += -D_REENTRANT |
edamame22 | 0:29983394c6b6 | 67 | LDFLAGS += -L$(ROOT)/event-loop -leventOS_gcc |
edamame22 | 0:29983394c6b6 | 68 | LDFLAGS += -L$(LWM2M_DIR) -lmbedclient_gcc |
edamame22 | 0:29983394c6b6 | 69 | LDFLAGS += -L$(NSDL_DIR) -lnsdl_gcc |
edamame22 | 0:29983394c6b6 | 70 | LDFLAGS += -L$(LIBSERVICE_DIR) -lCmdline_gcc -lservice_gcc |
edamame22 | 0:29983394c6b6 | 71 | LDFLAGS += -L$(MBEDTLS_DIR) -lmbedtls -lmbedx509 -lmbedcrypto |
edamame22 | 0:29983394c6b6 | 72 | LDFLAGS += -lpthread |
edamame22 | 0:29983394c6b6 | 73 | |
edamame22 | 0:29983394c6b6 | 74 | |
edamame22 | 0:29983394c6b6 | 75 | # Main build goal, specify here before dependecy parsing |
edamame22 | 0:29983394c6b6 | 76 | .DEFAULT_GOAL: all |
edamame22 | 0:29983394c6b6 | 77 | .PHONY: all |
edamame22 | 0:29983394c6b6 | 78 | all: $(EXE) |
edamame22 | 0:29983394c6b6 | 79 | |
edamame22 | 0:29983394c6b6 | 80 | # Create a list of objects and depencies to build |
edamame22 | 0:29983394c6b6 | 81 | OBJS := $(SRCS:.c=.o) |
edamame22 | 0:29983394c6b6 | 82 | CXX_OBJS := $(CXX_SRCS:.cpp=.o) |
edamame22 | 0:29983394c6b6 | 83 | DEPS += $$(SRCS:.c=.d) $$(CXX_SRCS:.cpp=.d) |
edamame22 | 0:29983394c6b6 | 84 | |
edamame22 | 0:29983394c6b6 | 85 | # Include depencies |
edamame22 | 0:29983394c6b6 | 86 | ifneq ($(MAKECMDGOALS),clean) |
edamame22 | 0:29983394c6b6 | 87 | ifneq ($(strip $(DEPS)),) |
edamame22 | 0:29983394c6b6 | 88 | -include $(DEPS) |
edamame22 | 0:29983394c6b6 | 89 | endif |
edamame22 | 0:29983394c6b6 | 90 | endif |
edamame22 | 0:29983394c6b6 | 91 | |
edamame22 | 0:29983394c6b6 | 92 | # Linking |
edamame22 | 0:29983394c6b6 | 93 | $(EXE): $(OBJS) $(CXX_OBJS) |
edamame22 | 0:29983394c6b6 | 94 | @echo 'Building target: $@' |
edamame22 | 0:29983394c6b6 | 95 | g++ $(CXXFLAGS) $(CFLAGS) -o $@ $(OBJS) $(CXX_OBJS) $(LDFLAGS) |
edamame22 | 0:29983394c6b6 | 96 | @echo 'Finished building target: $@' |
edamame22 | 0:29983394c6b6 | 97 | @echo ' ' |
edamame22 | 0:29983394c6b6 | 98 | |
edamame22 | 0:29983394c6b6 | 99 | .PHONY: clean |
edamame22 | 0:29983394c6b6 | 100 | clean: |
edamame22 | 0:29983394c6b6 | 101 | -$(RM) $(OBJS) $(CXX_OBJS) $(DEPS) $(EXE) |