1 # //******************************************************************
3 # // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
5 # //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 # // Licensed under the Apache License, Version 2.0 (the "License");
8 # // you may not use this file except in compliance with the License.
9 # // You may obtain a copy of the License at
11 # // http://www.apache.org/licenses/LICENSE-2.0
13 # // Unless required by applicable law or agreed to in writing, software
14 # // distributed under the License is distributed on an "AS IS" BASIS,
15 # // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # // See the License for the specific language governing permissions and
17 # // limitations under the License.
19 # //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
23 PLATFORM := arduinomega
24 ARDUINO_PORT := /dev/ttyACM0
26 # override with `make PLATFORM=arduinomega ARDUINOWIFI=1` to enable Arduino WiFi shield
31 ROOT_DIR = ../../../../..
32 LOGGER_DIR = $(ROOT_DIR)/logger
33 OC_LOG_DIR = $(ROOT_DIR)/../oc_logger
34 TBSTACK_DIR = $(ROOT_DIR)/stack
35 TBSOCKET_DIR = $(ROOT_DIR)/ocsocket
37 include $(ROOT_DIR)/local.properties
38 include $(ROOT_DIR)/$(PLATFORM).properties
40 VPATH := $(SDIR_ARD_PLATFORM)
43 OCSOCK_DIR = $(ROOT_DIR)/ocsocket
44 LOGGER_DIR = $(ROOT_DIR)/logger
45 STACK_DIR = $(ROOT_DIR)/stack
46 INC_DIRS = -I$(OCSOCK_DIR)/include/ -I$(OC_LOG_DIR)/include -I$(LOGGER_DIR)/include -I$(STACK_DIR)/include
48 CFLAGS := -Os -Wall -c -DTB_LOG
50 ifeq ($(ARDUINOWIFI),1)
51 CFLAGS += -DARDUINOWIFI
52 ARDUINO_SHIELD_TYPE := "/wifi_shield"
54 ARDUINO_SHIELD_TYPE := "/ethernet_shield"
57 OUT_DIR := $(PLATFORM)$(ARDUINO_SHIELD_TYPE)/$(BUILD)
59 OBJ_DIR := $(OUT_DIR)/bin
61 all: prep_dirs core.a $(APP_NAME).o $(APP_NAME).elf $(APP_NAME).hex
63 core.a: $(PLATFORM_OBJS)
64 @cd $(OBJ_DIR) && $(AR) -x ../../../../$(ROOT_DIR)/$(PLATFORM)$(ARDUINO_SHIELD_TYPE)/$(BUILD)/liboctbstack.a
65 $(AR) rcs $(OBJ_DIR)/$@ $(foreach obj, $^, $(OBJ_DIR)/$(obj)) $(OBJ_DIR)/*.o
66 @cd $(OBJ_DIR) && $(RANLIB) $@
70 -mkdir $(PLATFORM)/$(ARDUINO_SHIELD_TYPE)
75 $(CC) $(CFLAGS) $(CFLAGS_PLATFORM) $(INC_DIRS) $(INC_DIR_PLATFORM) $< -o $(OBJ_DIR)/$@
78 $(CXX) $(CFLAGS) $(CFLAGS_PLATFORM) $(INC_DIRS) $(INC_DIR_PLATFORM) $< -o $(OBJ_DIR)/$@
80 $(APP_NAME).elf: $(APP_NAME).o core.a
81 $(CC) -Os -Wl,--gc-sections,--relax $(CFLAGS_PLATFORM) $(foreach obj, $^, $(OBJ_DIR)/$(obj)) -lm -o $(OBJ_DIR)/$@
83 $(APP_NAME).hex: $(APP_NAME).elf
84 $(AVR_OBJCOPY) -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 $(OBJ_DIR)/$< $(OBJ_DIR)/$(APP_NAME).eep
85 $(AVR_OBJCOPY) -O ihex -R .eeprom $(OBJ_DIR)/$< $(OUT_DIR)/$@
88 $(AVR_PROGRAMMER) -C$(ARDUINO_DIR)/hardware/tools/avrdude.conf -v -v -v -v -patmega2560 -cstk500v2 -P$(ARDUINO_PORT) -b115200 -D -Uflash:w:$(OUT_DIR)/$(APP_NAME).hex:i
98 @rm -f *.o *.d *.elf *.eep *.a *.hex *.bin *.map *-