2014-07-01 09:22:40 +00:00
|
|
|
# Common Makefile between the Z1 and Z1SP
|
|
|
|
|
2011-05-25 15:21:51 +00:00
|
|
|
ifdef GCC
|
2011-02-23 09:35:26 +00:00
|
|
|
CFLAGS+=-Os -g
|
2011-05-25 15:21:51 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef IAR
|
2012-01-10 23:22:18 +00:00
|
|
|
CFLAGS += -D__MSP430F2617__=1 -e --vla -Ohz --multiplier=16s --core=430X --double=32
|
2012-01-16 12:00:16 +00:00
|
|
|
else
|
|
|
|
LDFLAGS += -Wl,--defsym -Wl,__P1SEL2=0x0041 -Wl,--defsym -Wl,__P5SEL2=0x0045
|
2011-05-25 15:21:51 +00:00
|
|
|
endif
|
|
|
|
|
2011-02-23 09:35:26 +00:00
|
|
|
CLEAN += symbols.c symbols.h
|
|
|
|
|
|
|
|
ARCH=msp430.c leds.c watchdog.c xmem.c \
|
2014-02-09 22:16:48 +00:00
|
|
|
spi.c cc2420.c cc2420-arch.c cc2420-arch-sfd.c\
|
2011-02-23 09:35:26 +00:00
|
|
|
node-id.c sensors.c button-sensor.c cfs-coffee.c \
|
2011-10-06 12:05:57 +00:00
|
|
|
radio-sensor.c uart0.c uart0-putchar.c uip-ipchksum.c \
|
2013-11-26 21:47:11 +00:00
|
|
|
slip.c slip_uart0.c \
|
2011-03-07 20:23:58 +00:00
|
|
|
z1-phidgets.c sht11.c sht11-sensor.c light-sensor.c \
|
2012-07-30 09:27:13 +00:00
|
|
|
battery-sensor.c sky-sensors.c tmp102.c temperature-sensor.c light-ziglet.c \
|
2015-03-10 12:09:31 +00:00
|
|
|
relay-phidget.c tlc59116.c sht25.c
|
2011-02-23 09:35:26 +00:00
|
|
|
|
|
|
|
CONTIKI_TARGET_DIRS = . dev apps net
|
|
|
|
ifndef CONTIKI_TARGET_MAIN
|
|
|
|
CONTIKI_TARGET_MAIN = contiki-z1-main.c
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef nodemac
|
|
|
|
CFLAGS += -DMACID=$(nodemac)
|
|
|
|
endif
|
|
|
|
|
2011-05-25 15:21:51 +00:00
|
|
|
CONTIKI_TARGET_SOURCEFILES += $(ARCH) $(UIPDRIVERS)
|
2013-05-28 22:41:06 +00:00
|
|
|
CONTIKI_TARGET_SOURCEFILES += i2cmaster.c adxl345.c
|
2011-02-23 09:35:26 +00:00
|
|
|
|
2012-04-10 14:05:10 +00:00
|
|
|
MCU=msp430f2617
|
2014-04-14 08:30:39 +00:00
|
|
|
|
|
|
|
# Platform has a MSP430X MCU with 20-bit support
|
|
|
|
CPU_HAS_MSP430X=1
|
|
|
|
|
2011-02-23 09:35:26 +00:00
|
|
|
include $(CONTIKI)/cpu/msp430/Makefile.msp430
|
|
|
|
|
2011-06-04 22:21:47 +00:00
|
|
|
# Add LDFLAGS after IAR_PATH is set
|
|
|
|
ifdef IAR
|
2012-09-19 20:49:19 +00:00
|
|
|
LDFLAGSNO += -xm "$(IAR_PATH)/lib/dlib/dl430xsfn.r43" -f "$(IAR_PATH)/config/lnk430f2617.xcl"
|
2012-03-07 22:03:15 +00:00
|
|
|
LDFLAGS += $(LDFLAGSNO) -Felf -yn
|
2011-06-04 22:21:47 +00:00
|
|
|
endif
|
|
|
|
|
2011-02-23 09:35:26 +00:00
|
|
|
contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o}
|
|
|
|
# $(AR) rcf $@ $^
|
|
|
|
|
|
|
|
|
|
|
|
NUMPAR=20
|
|
|
|
IHEXFILE=tmpimage.ihex
|
|
|
|
|
2013-01-23 21:56:43 +00:00
|
|
|
ifeq ($(HOST_OS),Darwin)
|
|
|
|
ifndef MOTELIST
|
|
|
|
USBDEVPREFIX=
|
|
|
|
SERIALDUMP = $(CONTIKI)/tools/sky/serialdump-linux
|
|
|
|
MOTELIST = $(CONTIKI)/tools/z1/motelist-z1-macos
|
|
|
|
BSL = $(CONTIKI)/tools/z1/z1-bsl-nopic --z1
|
|
|
|
BSL_FILETYPE = -I
|
|
|
|
MOTES = $(shell $(MOTELIST) -c 2>&- | \
|
2014-10-13 09:15:05 +00:00
|
|
|
cut -f 2 -d ,)
|
|
|
|
CMOTES=$(MOTES)
|
|
|
|
REFNUM = $(shell $(MOTELIST) -c 2>&- | \
|
2014-10-21 08:08:19 +00:00
|
|
|
cut -f 1 -d , | tail -c5 | sed 's/^0*//')
|
2014-10-13 09:15:05 +00:00
|
|
|
ifneq (,$(REFNUM))
|
|
|
|
# No device fo-und
|
|
|
|
ifeq (,$(findstring und, $(REFNUM)))
|
2014-10-21 08:08:19 +00:00
|
|
|
CFLAGS += -DSERIALNUM=$(REFNUM:0%=%)
|
2014-10-13 09:15:05 +00:00
|
|
|
endif
|
|
|
|
endif
|
2013-01-23 21:56:43 +00:00
|
|
|
endif
|
|
|
|
else
|
|
|
|
# If we are not running under Mac, we assume Linux
|
|
|
|
ifndef MOTELIST
|
|
|
|
USBDEVPREFIX=
|
|
|
|
SERIALDUMP = $(CONTIKI)/tools/sky/serialdump-linux
|
|
|
|
MOTELIST = $(CONTIKI)/tools/z1/motelist-z1
|
|
|
|
BSL = $(CONTIKI)/tools/z1/z1-bsl-nopic --z1
|
|
|
|
BSL_FILETYPE = -I
|
|
|
|
MOTES = $(shell $(MOTELIST) -c 2>&- | \
|
2014-10-13 09:15:05 +00:00
|
|
|
cut -f 2 -d , | \
|
|
|
|
perl -ne 'print $$1 . " " if(m-(/dev/\w+)-);')
|
2013-01-23 21:56:43 +00:00
|
|
|
CMOTES=$(MOTES)
|
2014-10-13 09:15:05 +00:00
|
|
|
REFNUM = $(shell $(MOTELIST) -c 2>&- | \
|
2014-10-21 08:08:19 +00:00
|
|
|
cut -f 1 -d , | tail -c5 | sed 's/^0*//')
|
2014-10-13 09:15:05 +00:00
|
|
|
ifneq (,$(REFNUM))
|
|
|
|
# No device fo-und
|
|
|
|
ifeq (,$(findstring und, $(REFNUM)))
|
|
|
|
CFLAGS += -DSERIALNUM=$(REFNUM)
|
|
|
|
endif
|
|
|
|
endif
|
2013-01-23 21:56:43 +00:00
|
|
|
endif
|
2011-02-23 09:35:26 +00:00
|
|
|
endif
|
|
|
|
|
2013-01-23 21:56:43 +00:00
|
|
|
|
|
|
|
|
2011-07-29 11:06:00 +00:00
|
|
|
motelist: z1-motelist
|
|
|
|
|
2011-02-23 09:35:26 +00:00
|
|
|
z1-motelist:
|
|
|
|
$(MOTELIST)
|
|
|
|
z1-motes:
|
|
|
|
@echo $(MOTES)
|
|
|
|
|
|
|
|
ifdef MOTE
|
|
|
|
%.upload: %.ihex
|
|
|
|
cp $< $(IHEXFILE)
|
|
|
|
$(MAKE) z1-u.$(subst /,-,$(word $(MOTE), $(MOTES)))
|
|
|
|
else # MOTE
|
|
|
|
%.upload: %.ihex
|
|
|
|
cp $< $(IHEXFILE)
|
|
|
|
@echo $(MOTES)
|
|
|
|
$(MAKE) z1-reset z1-upload
|
|
|
|
endif # MOTE
|
|
|
|
|
|
|
|
z1-upload: z1-reset
|
|
|
|
$(MAKE) -j $(NUMPAR) z1-upload-sequence
|
|
|
|
|
|
|
|
z1-upload-sequence: $(foreach PORT, $(MOTES), z1-u.$(subst /,-,$(PORT)))
|
|
|
|
@echo Done
|
|
|
|
|
|
|
|
z1-reset:
|
|
|
|
$(MAKE) -k -j $(NUMPAR) z1-reset-sequence
|
|
|
|
|
|
|
|
z1-reset-sequence: $(foreach PORT, $(MOTES), z1-r.$(subst /,-,$(PORT)))
|
|
|
|
@echo Done
|
|
|
|
|
|
|
|
z1-u.%:
|
|
|
|
@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
|
|
|
|
|
|
|
|
z1-r.%:
|
|
|
|
$(BSL) -c $(subst -,/,$*) -r
|
|
|
|
|
|
|
|
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
|