2010-08-24 18:24:11 +02:00
|
|
|
# $Id: Makefile.common,v 1.3 2010/08/24 16:24:11 joxe Exp $
|
2010-05-03 15:51:11 +02:00
|
|
|
|
|
|
|
ARCH=spi.c ds2411.c xmem.c i2c.c node-id.c sensors.c cfs-coffee.c \
|
2014-02-09 23:16:48 +01:00
|
|
|
cc2420.c cc2420-arch.c cc2420-arch-sfd.c \
|
2010-05-03 15:51:11 +02:00
|
|
|
sky-sensors.c uip-ipchksum.c \
|
2013-11-26 22:47:11 +01:00
|
|
|
uart1.c slip_uart1.c uart1-putchar.c
|
2010-05-03 15:51:11 +02:00
|
|
|
|
|
|
|
CONTIKI_TARGET_DIRS = . dev apps net
|
|
|
|
ifndef CONTIKI_TARGET_MAIN
|
|
|
|
CONTIKI_TARGET_MAIN = contiki-sky-main.c
|
|
|
|
endif
|
|
|
|
|
2012-05-17 17:27:50 +02:00
|
|
|
ifeq ($(UIP_CONF_IPV6),1)
|
2010-05-03 15:51:11 +02:00
|
|
|
CFLAGS += -DWITH_UIP6=1
|
|
|
|
endif
|
|
|
|
|
2011-09-11 17:18:02 +02:00
|
|
|
ifdef IAR
|
2011-09-21 16:54:25 +02:00
|
|
|
CFLAGS += -D__MSP430F1611__=1 -e --vla -Ohz --multiplier=16s --core=430 --double=32
|
2011-09-11 17:18:02 +02:00
|
|
|
CFLAGSNO = --dlib_config "$(IAR_PATH)/LIB/DLIB/dl430fn.h" $(CFLAGSWERROR)
|
|
|
|
endif
|
|
|
|
|
2012-03-07 02:36:13 +01:00
|
|
|
CONTIKI_TARGET_SOURCEFILES += $(ARCH) $(UIPDRIVERS)
|
2010-05-03 15:51:11 +02:00
|
|
|
|
2012-04-10 16:05:10 +02:00
|
|
|
MCU=msp430f1611
|
2010-05-03 15:51:11 +02:00
|
|
|
include $(CONTIKI)/cpu/msp430/Makefile.msp430
|
|
|
|
|
|
|
|
contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o}
|
|
|
|
# $(AR) rcf $@ $^
|
|
|
|
|
|
|
|
|
2011-09-11 17:18:02 +02:00
|
|
|
ifdef IAR
|
2012-09-19 22:49:19 +02:00
|
|
|
LDFLAGSNO += -xm "$(IAR_PATH)/lib/dlib/dl430fn.r43" -f "$(IAR_PATH)/config/lnk430f1611.xcl"
|
2012-03-07 23:03:15 +01:00
|
|
|
LDFLAGS += $(LDFLAGSNO) -Felf -yn
|
|
|
|
endif # IAR
|
2011-09-11 17:18:02 +02:00
|
|
|
|
2010-05-03 15:51:11 +02:00
|
|
|
NUMPAR=20
|
|
|
|
|
|
|
|
# Check if we are running under Windows
|
2012-02-24 11:19:50 +01:00
|
|
|
ifeq ($(HOST_OS),Windows)
|
2012-02-22 00:57:22 +01:00
|
|
|
USBDEVPREFIX=/dev/com
|
|
|
|
SERIALDUMP = $(CONTIKI)/tools/sky/serialdump-windows
|
|
|
|
MOTELIST = $(CONTIKI)/tools/sky/motelist-windows
|
|
|
|
TMOTE_BSL_FILE = tmote-bsl
|
|
|
|
TMOTE_BSL=$(if $(wildcard $(CONTIKI)/tools/sky/$(TMOTE_BSL_FILE).exe),1,0)
|
|
|
|
ifeq ($(TMOTE_BSL), 1)
|
|
|
|
NUMPAR = 1
|
|
|
|
BSL = $(CONTIKI)/tools/sky/$(TMOTE_BSL_FILE)
|
|
|
|
MOTES = $(shell $(MOTELIST) | grep COM | \
|
|
|
|
cut -f 4 -d \ )
|
|
|
|
else
|
|
|
|
BSL = $(CONTIKI)/tools/sky/msp430-bsl-windows --telosb
|
|
|
|
BSL_FILETYPE = -I
|
|
|
|
MOTES = $(shell $(MOTELIST) | grep COM | \
|
2010-05-03 15:51:11 +02:00
|
|
|
cut -f 4 -d \ | \
|
2012-02-22 00:57:22 +01:00
|
|
|
perl -ne 'print $$1 - 1 . " " if(/COM(\d+)/);')
|
2010-05-03 15:51:11 +02:00
|
|
|
endif
|
2012-02-22 00:57:22 +01:00
|
|
|
CMOTES = $(shell $(MOTELIST) | grep COM | \
|
|
|
|
cut -f 4 -d \ | \
|
|
|
|
perl -ne 'print $$1 . " " if(/COM(\d+)/);')
|
2012-04-03 14:59:36 +02:00
|
|
|
else
|
|
|
|
ifeq ($(HOST_OS),Darwin)
|
|
|
|
ifndef MOTELIST
|
|
|
|
USBDEVPREFIX=
|
2012-05-07 13:16:27 +02:00
|
|
|
SERIALDUMP = $(CONTIKI)/tools/sky/serialdump-macos
|
2012-04-03 14:59:36 +02:00
|
|
|
MOTELIST = $(CONTIKI)/tools/sky/motelist-macos
|
|
|
|
TMOTE_BSL_FILE = tmote-bsl-linux
|
|
|
|
TMOTE_BSL=$(if $(wildcard $(CONTIKI)/tools/sky/$(TMOTE_BSL_FILE)),1,0)
|
|
|
|
ifeq ($(TMOTE_BSL), 1)
|
|
|
|
PATH := $(PATH):$(CONTIKI)/tools/sky
|
|
|
|
BSL = $(CONTIKI)/tools/sky/$(TMOTE_BSL_FILE)
|
|
|
|
NUMPAR = 1
|
|
|
|
else
|
|
|
|
BSL = $(CONTIKI)/tools/sky/msp430-bsl-linux --telosb
|
|
|
|
BSL_FILETYPE = -I
|
|
|
|
endif
|
|
|
|
MOTES = $(shell $(MOTELIST) 2>&- | grep usbserial | \
|
|
|
|
cut -f 4 -d \ | \
|
|
|
|
perl -ne 'print $$1 . " " if(m-(/dev/[\w+\.\-]+)-);')
|
|
|
|
CMOTES=$(MOTES)
|
2010-05-03 15:51:11 +02:00
|
|
|
endif
|
2012-04-03 14:59:36 +02:00
|
|
|
else
|
|
|
|
# Else we assume Linux
|
|
|
|
ifndef MOTELIST
|
|
|
|
USBDEVPREFIX=
|
|
|
|
SERIALDUMP = $(CONTIKI)/tools/sky/serialdump-linux
|
|
|
|
MOTELIST = $(CONTIKI)/tools/sky/motelist-linux
|
|
|
|
TMOTE_BSL_FILE = tmote-bsl-linux
|
|
|
|
TMOTE_BSL=$(if $(wildcard $(CONTIKI)/tools/sky/$(TMOTE_BSL_FILE)),1,0)
|
|
|
|
ifeq ($(TMOTE_BSL), 1)
|
|
|
|
PATH := $(PATH):$(CONTIKI)/tools/sky
|
|
|
|
BSL = $(CONTIKI)/tools/sky/$(TMOTE_BSL_FILE)
|
|
|
|
NUMPAR = 1
|
|
|
|
else
|
|
|
|
BSL = $(CONTIKI)/tools/sky/msp430-bsl-linux --telosb
|
|
|
|
BSL_FILETYPE = -I
|
|
|
|
endif
|
2012-12-11 12:09:28 +01:00
|
|
|
ifdef MOTEIDS
|
|
|
|
MOTES = $(foreach MOTEID, $(MOTEIDS), $(shell $(MOTELIST) 2>&- | grep $(MOTEID) | \
|
|
|
|
cut -f 4 -d \ | \
|
2013-02-20 19:50:29 +01:00
|
|
|
perl -ne 'print $$1 . " " if(m-(/dev/[\w+\.\-]+)-);'))
|
2012-12-11 12:09:28 +01:00
|
|
|
else
|
|
|
|
MOTES = $(shell $(MOTELIST) 2>&- | grep USB | \
|
|
|
|
cut -f 4 -d \ | \
|
|
|
|
perl -ne 'print $$1 . " " if(m-(/dev/[\w+\.\-]+)-);')
|
|
|
|
endif
|
2012-04-03 14:59:36 +02:00
|
|
|
CMOTES=$(MOTES)
|
|
|
|
endif
|
|
|
|
endif
|
2010-05-03 15:51:11 +02:00
|
|
|
endif
|
|
|
|
|
2011-07-29 13:06:00 +02:00
|
|
|
motelist: sky-motelist
|
|
|
|
|
2010-05-03 15:51:11 +02:00
|
|
|
sky-motelist:
|
|
|
|
$(MOTELIST)
|
|
|
|
sky-motes:
|
|
|
|
@echo $(MOTES)
|
|
|
|
|
|
|
|
ifdef MOTE
|
|
|
|
%.upload: %.ihex
|
2012-12-11 12:09:29 +01:00
|
|
|
$(MAKE) IHEXFILE=$< sky-u.$(subst /,_,$(word $(MOTE), $(MOTES)))
|
2010-05-03 15:51:11 +02:00
|
|
|
else # MOTE
|
|
|
|
%.upload: %.ihex
|
2012-12-11 12:09:29 +01:00
|
|
|
$(MAKE) IHEXFILE=$< sky-reset sky-upload
|
2010-05-03 15:51:11 +02:00
|
|
|
endif # MOTE
|
|
|
|
|
|
|
|
upload-ihex:
|
|
|
|
ifdef FILE
|
|
|
|
@echo Uploading $(FILE)
|
|
|
|
ifdef MOTE
|
2012-12-11 12:09:29 +01:00
|
|
|
$(MAKE) IHEXFILE=$(FILE) sky-u.$(subst /,_,$(word $(MOTE), $(MOTES)))
|
2010-05-03 15:51:11 +02:00
|
|
|
else # MOTE
|
|
|
|
$(MAKE) sky-reset sky-upload
|
|
|
|
endif # MOTE
|
|
|
|
else
|
|
|
|
@echo Example: $(MAKE) upload-ihex FILE=myfile.ihex
|
|
|
|
endif
|
|
|
|
|
|
|
|
sky-upload: sky-reset
|
|
|
|
$(MAKE) -j $(NUMPAR) sky-upload-sequence
|
|
|
|
|
2012-04-03 14:59:36 +02:00
|
|
|
sky-upload-sequence: $(foreach PORT, $(MOTES), sky-u.$(subst /,_,$(PORT)))
|
2010-05-03 15:51:11 +02:00
|
|
|
@echo Done
|
|
|
|
|
|
|
|
sky-reset:
|
|
|
|
$(MAKE) -k -j $(NUMPAR) sky-reset-sequence
|
|
|
|
|
2012-04-03 14:59:36 +02:00
|
|
|
sky-reset-sequence: $(foreach PORT, $(MOTES), sky-r.$(subst /,_,$(PORT)))
|
2010-05-03 15:51:11 +02:00
|
|
|
@echo Done
|
|
|
|
|
|
|
|
sky-u.%:
|
2012-04-03 14:59:36 +02:00
|
|
|
@echo +++++ Erasing $(subst _,/,$*); \
|
|
|
|
$(BSL) -c $(subst _,/,$*) -e && sleep 2 ; \
|
|
|
|
echo +++++ Programming $(subst _,/,$*) ; \
|
|
|
|
$(BSL) -c $(subst _,/,$*) $(BSL_FILETYPE) -p $(IHEXFILE) && sleep 2 ; \
|
|
|
|
echo +++++ Resetting $(subst _,/,$*) ; \
|
|
|
|
$(BSL) -c $(subst _,/,$*) -r
|
2010-05-03 15:51:11 +02:00
|
|
|
|
|
|
|
sky-r.%:
|
2012-04-03 14:59:36 +02:00
|
|
|
$(BSL) -c $(subst _,/,$*) -r
|
2010-05-03 15:51:11 +02:00
|
|
|
|
|
|
|
sizeplot:
|
|
|
|
msp430-size $(OBJECTDIR)/*.o | $(CONTIKI)/tools/sky/check-size > size-data
|
|
|
|
gnuplot $(CONTIKI)/tools/sky/plot-size
|
|
|
|
gv size.pdf
|
|
|
|
|
|
|
|
winslip:
|
|
|
|
ifdef INTERFACE
|
|
|
|
$(CONTIKI)/tools/wpcapslip/wpcapslip -s $(USBDEVPREFIX)$(firstword $(CMOTES)) $(INTERFACE) 172.16.0.0 255.255.0.0
|
|
|
|
else
|
|
|
|
@echo "Usage: \"$(MAKE) $@ INTERFACE=<the IP address of a local network interface>\""
|
|
|
|
@echo "Use the \"ipconfig\" command to find out the IP addresses of the local interfaces"
|
|
|
|
endif
|
|
|
|
|
|
|
|
linslip: $(CONTIKI)/tools/tunslip
|
|
|
|
$(CONTIKI)/tools/tunslip -s $(USBDEVPREFIX)$(firstword $(CMOTES)) 172.16.0.0 255.255.0.0
|
|
|
|
|
|
|
|
$(CONTIKI)/tools/tunslip:
|
|
|
|
(cd $(CONTIKI)/tools; $(MAKE) tunslip)
|
|
|
|
|
|
|
|
ifdef MOTE
|
|
|
|
serialdump:
|
|
|
|
$(SERIALDUMP) -b115200 $(USBDEVPREFIX)$(word $(MOTE), $(CMOTES)) | $(CONTIKI)/tools/timestamp | tee serialdump-`date +%Y%m%d-%H%M`
|
|
|
|
|
|
|
|
serialview:
|
|
|
|
$(SERIALDUMP) -b115200 $(USBDEVPREFIX)$(word $(MOTE), $(CMOTES)) | $(CONTIKI)/tools/timestamp
|
|
|
|
|
|
|
|
login:
|
|
|
|
$(SERIALDUMP) -b115200 $(USBDEVPREFIX)$(word $(MOTE), $(CMOTES))
|
|
|
|
else
|
|
|
|
serialdump:
|
|
|
|
$(SERIALDUMP) -b115200 $(USBDEVPREFIX)$(firstword $(CMOTES)) | $(CONTIKI)/tools/timestamp | tee serialdump-`date +%Y%m%d-%H%M`
|
|
|
|
|
|
|
|
serialview:
|
|
|
|
$(SERIALDUMP) -b115200 $(USBDEVPREFIX)$(firstword $(CMOTES)) | $(CONTIKI)/tools/timestamp
|
|
|
|
|
|
|
|
login:
|
|
|
|
$(SERIALDUMP) -b115200 $(USBDEVPREFIX)$(firstword $(CMOTES))
|
|
|
|
endif
|