#-*-Makefile-*- vim:syntax=make #$Id: bsl.extra,v 1.11 2004/11/08 03:47:37 cssharp Exp $ PROGRAM = bsl MSP_BSL ?= msp430-bsl # BSL is the comm port, can be specified as "bsl,2" when making BSL ?= auto MSP_BSL_FLAGS ?= --telos ifeq ($(BSL),auto) BSLTEST = $(shell motelist -c | perl -e '<> =~ /^[^,]+,(\S+?(\d+))/; print $$1;' ) BSL = $(shell motelist -c | perl -e '<> =~ /^[^,]+,(\S+?(\d+))/; ($$s,$$n)=($$1,$$2); if($$s=~/^com/i) { print $$n-1 } else { print $$s; };' ) BSL_TARGETS += bsltest endif # bsltest is a separate rule so that make doesn't resolve BSL along with # BSLTEST, which saves an invocation of motelist. It also avoids the test # all together if bsl,auto was not specified (whew). bsltest: FORCE @N=$(BSLTEST); [ x$$N = x ] && echo " found no motes (using bsl,auto)" && exit 1 || echo " found mote on $$N (using bsl,auto)" program: $(BSL_TARGETS) $(TELOS_PROGRAM_DEPS) FORCE @echo " installing $(PLATFORM) binary using bsl" $(MSP_BSL) $(MSP_BSL_FLAGS) -c $(BSL) -r -e -I -p $(INSTALL_IHEX) rm -f $(subst .ihex.,.exe.,$(INSTALL_IHEX)) $(INSTALL_IHEX) program_no_e: $(BSL_TARGETS) $(TELOS_PROGRAM_DEPS) FORCE @echo " installing $(PLATFORM) binary using bsl (without mass erase)" $(MSP_BSL) $(MSP_BSL_FLAGS) -c $(BSL) -r -I -p $(INSTALL_IHEX) rm -f $(subst .ihex.,.exe.,$(INSTALL_IHEX)) $(INSTALL_IHEX) program_bl: $(BSL_TARGETS) $(TELOS_PROGRAM_DEPS) FORCE @echo " installing $(PLATFORM) bootloader using bsl" $(MSP_BSL) $(MSP_BSL_FLAGS) -c $(BSL) -r -e -I -p $(BOOTLOADER) program_input: ihex @: