2007-10-25 15:26:38 +02:00
|
|
|
NUMPAR=20
|
|
|
|
IHEXFILE=tmpimage.ihex
|
|
|
|
|
|
|
|
# Check if we are running under Windows
|
|
|
|
ifdef OS
|
|
|
|
ifneq (,$(findstring Windows,$(OS)))
|
2007-11-13 21:21:02 +01:00
|
|
|
SERIALDUMP = $(CONTIKI)/tools/sky/serialdump-windows
|
2007-10-25 15:26:38 +02:00
|
|
|
MOTELIST = $(CONTIKI)/tools/sky/motelist-windows
|
|
|
|
BSL = $(CONTIKI)/tools/sky/msp430-bsl-windows
|
|
|
|
MOTES = $(shell $(MOTELIST) | grep COM | \
|
|
|
|
cut -f 4 -d \ | \
|
|
|
|
perl -ne 'print $$1 - 1 . " " if(/COM(\d+)/);')
|
2007-11-06 20:56:27 +01:00
|
|
|
CMOTES = $(shell $(MOTELIST) | grep COM | \
|
|
|
|
cut -f 4 -d \ | \
|
|
|
|
perl -ne 'print $$1 . " " if(/COM(\d+)/);')
|
2007-10-25 15:26:38 +02:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
# If we are not running under Windows, we assume Linux
|
|
|
|
ifndef MOTELIST
|
2007-11-13 21:21:02 +01:00
|
|
|
SERIALDUMP = $(CONTIKI)/tools/sky/serialdump-linux
|
2007-10-25 15:26:38 +02:00
|
|
|
MOTELIST = $(CONTIKI)/tools/sky/motelist-linux
|
|
|
|
BSL = $(CONTIKI)/tools/sky/msp430-bsl-linux
|
2007-11-27 00:21:41 +01:00
|
|
|
MOTES = $(shell $(MOTELIST) 2>&- | grep USB | \
|
2007-10-25 15:26:38 +02:00
|
|
|
cut -f 4 -d \ | \
|
|
|
|
perl -ne 'print $$1 . " " if(m-(/dev/\w+)-);')
|
2007-11-06 20:56:27 +01:00
|
|
|
CMOTES=$(MOTES)
|
2007-10-25 15:26:38 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
sky-motelist:
|
|
|
|
$(MOTELIST)
|
|
|
|
sky-motes:
|
|
|
|
echo $(MOTES)
|
|
|
|
|
2007-11-13 21:21:02 +01:00
|
|
|
%.upload: %.ihex sky-reset
|
2007-10-25 15:26:38 +02:00
|
|
|
cp $< $(IHEXFILE)
|
2007-10-25 16:48:23 +02:00
|
|
|
$(MAKE) sky-upload
|
2007-10-25 15:26:38 +02:00
|
|
|
|
2007-11-27 00:21:41 +01:00
|
|
|
sky-upload: sky-reset
|
2007-10-25 15:26:38 +02:00
|
|
|
$(MAKE) -j $(NUMPAR) sky-upload-sequence
|
|
|
|
|
|
|
|
sky-upload-sequence: $(foreach PORT, $(MOTES), $(PORT).sky-u)
|
|
|
|
@echo Done
|
|
|
|
|
|
|
|
sky-reset:
|
|
|
|
$(MAKE) -k -j $(NUMPAR) sky-reset-sequence
|
|
|
|
|
|
|
|
sky-reset-sequence: $(foreach PORT, $(MOTES), $(PORT).sky-r)
|
|
|
|
@echo Done
|
|
|
|
|
|
|
|
%.sky-u:
|
|
|
|
@echo +++++ Erasing $(basename $@) ; \
|
|
|
|
$(BSL) --telosb -c $(basename $@) -e && sleep 2 ; \
|
|
|
|
echo +++++ Programming $(basename $@) ; \
|
|
|
|
$(BSL) --telosb -c $(basename $@) -I -p $(IHEXFILE) && sleep 2 ; \
|
|
|
|
echo +++++ Resetting $(basename $@) ; \
|
|
|
|
$(BSL) --telosb -c $(basename $@) -r
|
|
|
|
|
|
|
|
%.sky-r:
|
|
|
|
$(BSL) --telosb -c $(basename $@) -r
|