146 lines
3.9 KiB
Makefile
146 lines
3.9 KiB
Makefile
|
|
#
|
|
# Currently enabling SMALL breaks the build on this platform.
|
|
# No large effect is expected anyway: unused sections are discarded even if SMALL is not set.
|
|
#
|
|
SMALL=0
|
|
|
|
ARCH = leds.c xmem.c i2cmaster.c \
|
|
spi-legacy.c cc2420.c cc2420-arch.c cc2420-arch-sfd.c\
|
|
node-id-z1.c sensors.c button-sensor.c cfs-coffee.c \
|
|
uart0.c uart0-putchar.c uip-ipchksum.c \
|
|
slip.c slip_uart0.c z1-sensors.c adxl345.c temperature-sensor.c \
|
|
z1-phidgets.c light-sensor.c battery-sensor.c sky-sensors.c tmp102.c \
|
|
platform.c
|
|
|
|
CONTIKI_TARGET_DIRS = . dev apps
|
|
ifndef CONTIKI_TARGET_MAIN
|
|
CONTIKI_TARGET_MAIN = contiki-main.c
|
|
endif
|
|
|
|
CONTIKI_TARGET_SOURCEFILES += $(ARCH)
|
|
|
|
MCU=msp430f2617
|
|
CPU_HAS_MSP430X=1
|
|
|
|
LDFLAGS += -Wl,--defsym -Wl,__P1SEL2=0x0041 -Wl,--defsym -Wl,__P5SEL2=0x0045
|
|
|
|
ifdef nodemac
|
|
CFLAGS += -DMACID=$(nodemac)
|
|
endif
|
|
|
|
CFLAGS += -g
|
|
|
|
include $(ARCH_PATH)/cpu/msp430/Makefile.msp430
|
|
|
|
|
|
NUMPAR=20
|
|
IHEXFILE=tmpimage.ihex
|
|
|
|
ifeq ($(HOST_OS),Darwin)
|
|
ifndef MOTELIST
|
|
USBDEVPREFIX=
|
|
SERIALDUMP = $(CONTIKI)/tools/sky/serialdump-linux
|
|
MOTELIST = $(CONTIKI)/tools/zolertia/motelist-zolertia-macos
|
|
BSL = $(CONTIKI)/tools/zolertia/z1-bsl-nopic --z1
|
|
BSL_FILETYPE = -I
|
|
MOTES = $(shell $(MOTELIST) -b z1 -c 2>&- | \
|
|
cut -f 2 -d ,)
|
|
REFNUM = $(shell $(MOTELIST) -c 2>&- | \
|
|
cut -f 1 -d , | tail -c5 | sed 's/^0*//')
|
|
ifneq (,$(REFNUM))
|
|
# No device fo-und
|
|
ifeq (,$(findstring und, $(REFNUM)))
|
|
CFLAGS += -DSERIALNUM=$(REFNUM:0%=%)
|
|
endif
|
|
endif
|
|
endif
|
|
else
|
|
# If we are not running under Mac, we assume Linux
|
|
ifndef MOTELIST
|
|
USBDEVPREFIX=
|
|
SERIALDUMP = $(CONTIKI)/tools/sky/serialdump-linux
|
|
MOTELIST = $(CONTIKI)/tools/zolertia/motelist-zolertia
|
|
BSL = $(CONTIKI)/tools/zolertia/z1-bsl-nopic --z1
|
|
BSL_FILETYPE = -I
|
|
MOTES = $(shell $(MOTELIST) -b z1 -c 2>&- | \
|
|
cut -f 2 -d , | \
|
|
perl -ne 'print $$1 . " " if(m-(/dev/\w+)-);')
|
|
CMOTES=$(MOTES)
|
|
REFNUM = $(shell $(MOTELIST) -c 2>&- | \
|
|
cut -f 1 -d , | tail -c5 | sed 's/^0*//')
|
|
ifneq (,$(REFNUM))
|
|
# No device fo-und
|
|
ifeq (,$(findstring und, $(REFNUM)))
|
|
CFLAGS += -DSERIALNUM=$(REFNUM)
|
|
endif
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
motelist:
|
|
$(MOTELIST)
|
|
z1-motelist:
|
|
$(MOTELIST) -b z1
|
|
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
|
|
PORT = $(USBDEVPREFIX)$(word $(MOTE), $(CMOTES))
|
|
else
|
|
PORT = $(USBDEVPREFIX)$(firstword $(CMOTES))
|
|
endif
|