From 44eb40099dd44d65bc4ca8c136bd8d4e59d8cd05 Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Thu, 25 Oct 2007 13:26:38 +0000 Subject: [PATCH] Makefile for doing bulk uploading of .ihex files to Tmote Sky boards --- tools/sky/Makefile | 60 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 tools/sky/Makefile diff --git a/tools/sky/Makefile b/tools/sky/Makefile new file mode 100644 index 000000000..a857da834 --- /dev/null +++ b/tools/sky/Makefile @@ -0,0 +1,60 @@ +NUMPAR=20 +IHEXFILE=tmpimage.ihex + +# Check if we are running under Windows +ifdef OS + ifneq (,$(findstring Windows,$(OS))) + 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+)/);') + endif +endif + +# If we are not running under Windows, we assume Linux +ifndef MOTELIST + MOTELIST = $(CONTIKI)/tools/sky/motelist-linux + BSL = $(CONTIKI)/tools/sky/msp430-bsl-linux + MOTES = $(shell $(MOTELIST) | grep USB | \ + cut -f 4 -d \ | \ + perl -ne 'print $$1 . " " if(m-(/dev/\w+)-);') +endif + +sky-motelist: + $(MOTELIST) +sky-motes: + echo $(MOTES) + +%.upload: %.ihex + cp $< $(IHEXFILE) + $(MAKE) sky-run + +sky-run: sky-upload sky-reset-sequence + $(MAKE) -k -j $(NUMPAR) sky-run-sequence + +sky-run-sequence: $(foreach PORT, $(MOTES), $(PORT).run) + @echo $(MOTES) + +sky-upload: + $(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