2010-01-14 21:16:52 +01:00
|
|
|
# $Id: Makefile.sky,v 1.33 2010/01/14 20:16:52 adamdunkels Exp $
|
2007-03-15 22:44:28 +01:00
|
|
|
|
|
|
|
|
2010-01-14 16:50:13 +01:00
|
|
|
ARCH=msp430.c leds.c watchdog.c spi.c ds2411.c \
|
2010-01-14 15:00:38 +01:00
|
|
|
xmem.c i2c.c sht11.c light-sensor.c acc-sensor.c battery-sensor.c \
|
2010-01-14 21:16:52 +01:00
|
|
|
cc2420.c cc2420-aes.c cc2420-arch.c cc2420-arch-sfd.c sht11-sensor.c \
|
2008-07-01 23:02:51 +02:00
|
|
|
node-id.c sensors.c button-sensor.c cfs-coffee.c \
|
2008-01-08 09:18:00 +01:00
|
|
|
radio-sensor.c uart1.c uip-ipchksum.c \
|
2009-02-04 18:51:49 +01:00
|
|
|
checkpoint-arch.c #slip.c slip_uart1.c
|
2007-03-15 22:44:28 +01:00
|
|
|
|
2010-01-14 15:00:38 +01:00
|
|
|
#ext-sensor.c irq.c \
|
|
|
|
|
2007-03-25 19:21:33 +02:00
|
|
|
CONTIKI_TARGET_DIRS = . dev apps net
|
2007-03-15 22:44:28 +01:00
|
|
|
ifndef CONTIKI_TARGET_MAIN
|
|
|
|
CONTIKI_TARGET_MAIN = contiki-sky-main.c
|
|
|
|
endif
|
|
|
|
|
2009-06-26 14:00:49 +02:00
|
|
|
ifdef UIP_CONF_IPV6
|
|
|
|
CFLAGS += -DWITH_UIP6=1
|
|
|
|
endif
|
|
|
|
|
2007-03-15 22:44:28 +01:00
|
|
|
CONTIKI_TARGET_SOURCEFILES += $(ARCH) $(UIPDRIVERS) $(CONTIKI_TARGET_MAIN)
|
|
|
|
|
|
|
|
MCU=msp430x1611
|
|
|
|
include $(CONTIKI)/cpu/msp430/Makefile.msp430
|
|
|
|
|
|
|
|
contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o}
|
|
|
|
# $(AR) rcf $@ $^
|
|
|
|
|
2008-05-29 22:15:49 +02:00
|
|
|
|
|
|
|
NUMPAR=20
|
2010-01-14 21:01:18 +01:00
|
|
|
#IHEXFILE=tmpimage.ihex
|
2008-05-29 22:15:49 +02:00
|
|
|
|
|
|
|
# Check if we are running under Windows
|
|
|
|
ifdef OS
|
|
|
|
ifneq (,$(findstring Windows,$(OS)))
|
|
|
|
USBDEVPREFIX=/dev/com
|
|
|
|
SERIALDUMP = $(CONTIKI)/tools/sky/serialdump-windows
|
|
|
|
MOTELIST = $(CONTIKI)/tools/sky/motelist-windows
|
2009-01-15 23:12:46 +01:00
|
|
|
TMOTE_BSL=$(if $(wildcard $(CONTIKI)/tools/sky/tmote-bsl.exe),1,0)
|
|
|
|
ifeq ($(TMOTE_BSL), 1)
|
2009-04-29 13:42:56 +02:00
|
|
|
NUMPAR = 1
|
2009-01-15 23:12:46 +01:00
|
|
|
BSL = $(CONTIKI)/tools/sky/tmote-bsl
|
|
|
|
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 | \
|
|
|
|
cut -f 4 -d \ | \
|
|
|
|
perl -ne 'print $$1 - 1 . " " if(/COM(\d+)/);')
|
|
|
|
endif
|
2008-05-29 22:15:49 +02:00
|
|
|
CMOTES = $(shell $(MOTELIST) | grep COM | \
|
|
|
|
cut -f 4 -d \ | \
|
|
|
|
perl -ne 'print $$1 . " " if(/COM(\d+)/);')
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
# If we are not running under Windows, we assume Linux
|
|
|
|
ifndef MOTELIST
|
|
|
|
USBDEVPREFIX=
|
|
|
|
SERIALDUMP = $(CONTIKI)/tools/sky/serialdump-linux
|
|
|
|
MOTELIST = $(CONTIKI)/tools/sky/motelist-linux
|
2009-04-10 09:43:29 +02:00
|
|
|
TMOTE_BSL=$(if $(wildcard $(CONTIKI)/tools/sky/tmote-bsl-linux),1,0)
|
|
|
|
ifeq ($(TMOTE_BSL), 1)
|
|
|
|
PATH := $(PATH):$(CONTIKI)/tools/sky
|
|
|
|
BSL = $(CONTIKI)/tools/sky/tmote-bsl-linux
|
2009-04-29 13:42:56 +02:00
|
|
|
NUMPAR = 1
|
2009-04-10 09:43:29 +02:00
|
|
|
else
|
|
|
|
BSL = $(CONTIKI)/tools/sky/msp430-bsl-linux --telosb
|
|
|
|
BSL_FILETYPE = -I
|
|
|
|
endif
|
2008-05-29 22:15:49 +02:00
|
|
|
MOTES = $(shell $(MOTELIST) 2>&- | grep USB | \
|
|
|
|
cut -f 4 -d \ | \
|
|
|
|
perl -ne 'print $$1 . " " if(m-(/dev/\w+)-);')
|
|
|
|
CMOTES=$(MOTES)
|
|
|
|
endif
|
|
|
|
|
|
|
|
sky-motelist:
|
|
|
|
$(MOTELIST)
|
|
|
|
sky-motes:
|
|
|
|
@echo $(MOTES)
|
|
|
|
|
2009-10-29 23:10:21 +01:00
|
|
|
ifdef MOTE
|
|
|
|
%.upload: %.ihex
|
|
|
|
cp $< $(IHEXFILE)
|
|
|
|
$(MAKE) sky-u.$(subst /,-,$(word $(MOTE), $(MOTES)))
|
|
|
|
else # MOTE
|
2008-05-29 22:15:49 +02:00
|
|
|
%.upload: %.ihex
|
2010-01-14 21:01:18 +01:00
|
|
|
# cp $< $(IHEXFILE)
|
|
|
|
$(MAKE) sky-reset sky-upload IHEXFILE=$<
|
2009-10-29 23:10:21 +01:00
|
|
|
endif # MOTE
|
2008-05-29 22:15:49 +02:00
|
|
|
|
|
|
|
sky-upload: sky-reset
|
|
|
|
$(MAKE) -j $(NUMPAR) sky-upload-sequence
|
|
|
|
|
2009-04-02 13:15:30 +02:00
|
|
|
sky-upload-sequence: $(foreach PORT, $(MOTES), sky-u.$(subst /,-,$(PORT)))
|
2008-05-29 22:15:49 +02:00
|
|
|
@echo Done
|
|
|
|
|
|
|
|
sky-reset:
|
|
|
|
$(MAKE) -k -j $(NUMPAR) sky-reset-sequence
|
|
|
|
|
2009-04-02 13:15:30 +02:00
|
|
|
sky-reset-sequence: $(foreach PORT, $(MOTES), sky-r.$(subst /,-,$(PORT)))
|
2008-05-29 22:15:49 +02:00
|
|
|
@echo Done
|
|
|
|
|
2009-03-26 14:29:44 +01:00
|
|
|
sky-u.%:
|
2009-04-02 13:15:30 +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
|
2008-05-29 22:15:49 +02:00
|
|
|
|
2009-03-26 14:29:44 +01:00
|
|
|
sky-r.%:
|
2009-04-02 13:15:30 +02:00
|
|
|
$(BSL) -c $(subst -,/,$*) -r
|
2008-05-29 22:15:49 +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
|