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 # //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
22 PLATFORM := arduinomega
23 ARDUINO_PORT := /dev/ttyACM0
25 # override with `make PLATFORM=arduinomega ARDUINOWIFI=1` to enable Arduino WiFi shield
28 ifeq ($(ARDUINOWIFI),0)
29 APP_NAME := ocsocket_test
30 OCSOCKET_CPPOBJ = ocsocket_arduino.o
32 APP_NAME := ocsocket_wifi_test
33 OCSOCKET_CPPOBJ = ocsocket_arduino_wifi.o
40 include $(ROOT_DIR)/local.properties
41 include $(ROOT_DIR)/$(PLATFORM).properties
45 OCSOCK_DIR = $(ROOT_DIR)/ocsocket
46 LOGGER_DIR = $(ROOT_DIR)/logger
47 INC_DIRS = -I$(OCSOCK_DIR)/include/ -I$(LOGGER_DIR)/include
49 VPATH := $(SDIR_ARD_PLATFORM):$(LOGGER_DIR)/src:$(OCSOCK_DIR)/src
51 CFLAGS := -Os -Wall -c -DTB_LOG
53 all: core.a $(APP_NAME).o $(APP_NAME).elf $(APP_NAME).hex
55 core.a: $(PLATFORM_OBJS)
59 #logger needs to be compiled using C++ compiler
61 $(CCPLUS) $(CFLAGS) $(CFLAGS_PLATFORM) $(INC_DIRS) $(INC_DIR_PLATFORM) $< -o $@
64 $(CC) $(CFLAGS) $(CFLAGS_PLATFORM) $(INC_DIRS) $(INC_DIR_PLATFORM) $< -o $@
67 $(CCPLUS) $(CFLAGS) $(CFLAGS_PLATFORM) $(INC_DIRS) $(INC_DIR_PLATFORM) $< -o $@
69 $(APP_NAME).elf: $(APP_NAME).o $(OCSOCKET_CPPOBJ) logger.o core.a
70 $(CC) -Os -Wl,--gc-sections,--relax $(CFLAGS_PLATFORM) $^ -lm -o $@
72 $(APP_NAME).hex: $(APP_NAME).elf
73 $(AVR_OBJCOPY) -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 $< $(APP_NAME).eep
74 $(AVR_OBJCOPY) -O ihex -R .eeprom $< $@
77 $(AVR_PROGRAMMER) -C$(ARDUINO_DIR)/hardware/tools/avrdude.conf -v -v -v -v -patmega2560 -cstk500v2 -P$(ARDUINO_PORT) -b115200 -D -Uflash:w:$(APP_NAME).hex:i
82 @rm -f *.o *.d *.elf *.eep *.a *.hex *.bin *.map *-