2015-11-12 15:29:41 +00:00
|
|
|
### Zoul Makefile
|
|
|
|
|
|
|
|
ifndef CONTIKI
|
|
|
|
$(error CONTIKI not defined! You must specify where CONTIKI resides!)
|
|
|
|
endif
|
|
|
|
|
2016-09-01 13:03:00 +00:00
|
|
|
### If no board is specified the default option is the RE-Mote revision B
|
2017-10-10 08:50:27 +00:00
|
|
|
BOARD ?= remote-revb
|
|
|
|
BOARDS = remote-reva remote-revb firefly-reva firefly orion
|
2016-09-01 13:03:00 +00:00
|
|
|
|
|
|
|
### As previously the RE-Mote revision A was plainly defined as remote, keep for
|
|
|
|
### backward compatibility
|
|
|
|
ifeq ($(BOARD), remote)
|
|
|
|
override BOARD = remote-reva
|
2015-11-12 15:29:41 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
PYTHON = python
|
|
|
|
BSL_FLAGS += -e -w -v
|
|
|
|
|
2016-12-20 17:18:28 +00:00
|
|
|
BSL_SPEED ?= 460800
|
|
|
|
|
2016-11-17 17:14:33 +00:00
|
|
|
# Works in Linux and probably on OSX too (RTCC example)
|
|
|
|
CFLAGS += -DDATE="\"`date +"%02u %02d %02m %02y %02H %02M %02S"`\""
|
|
|
|
|
2015-11-12 15:29:41 +00:00
|
|
|
### Configure the build for the board and pull in board-specific sources
|
|
|
|
CONTIKI_TARGET_DIRS += . dev
|
|
|
|
CONTIKI_TARGET_DIRS += . $(BOARD)
|
2018-11-23 09:35:41 +00:00
|
|
|
PLATFORM_ROOT_DIR = $(ARCH_PATH)/platform/$(TARGET)
|
2015-11-12 15:29:41 +00:00
|
|
|
|
|
|
|
### Include the board dir if one exists
|
|
|
|
-include $(PLATFORM_ROOT_DIR)/$(BOARD)/Makefile.$(BOARD)
|
|
|
|
|
|
|
|
### Include
|
2018-02-25 18:57:49 +00:00
|
|
|
CONTIKI_TARGET_SOURCEFILES += platform.c leds-arch.c
|
2016-09-02 12:58:17 +00:00
|
|
|
CONTIKI_TARGET_SOURCEFILES += leds.c cc1200-zoul-arch.c
|
2017-11-05 18:46:46 +00:00
|
|
|
CONTIKI_TARGET_SOURCEFILES += adc-zoul.c board-buttons.c zoul-sensors.c
|
2015-11-12 15:29:41 +00:00
|
|
|
CONTIKI_TARGET_SOURCEFILES += $(BOARD_SOURCEFILES)
|
|
|
|
|
|
|
|
CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
|
|
|
|
|
|
|
|
### Define the CPU directory
|
2018-11-23 09:35:41 +00:00
|
|
|
CONTIKI_CPU=$(ARCH_PATH)/cpu/cc2538
|
2015-11-12 15:29:41 +00:00
|
|
|
include $(CONTIKI_CPU)/Makefile.cc2538
|
|
|
|
|
2018-02-28 02:17:49 +00:00
|
|
|
MODULES += arch/dev/cc1200 arch/dev/rgb-led os/storage/cfs
|
2015-11-12 15:29:41 +00:00
|
|
|
|
|
|
|
BSL = $(CONTIKI)/tools/cc2538-bsl/cc2538-bsl.py
|
|
|
|
|
2018-10-14 16:10:50 +00:00
|
|
|
MOTES := $(shell python $(TOOLS_DIR)/motelist/motelist.py --omit-header \
|
|
|
|
| grep $(MOTELIST_ZOLERTIA) | cut -f1 -d " ")
|
2015-11-12 15:29:41 +00:00
|
|
|
|
2016-06-14 14:10:23 +00:00
|
|
|
### If PORT is defined, override to keep backward compatibility
|
|
|
|
ifdef PORT
|
|
|
|
MOTES := $(PORT)
|
|
|
|
endif
|
|
|
|
|
|
|
|
### Check the BSL script exists
|
2015-11-12 15:29:41 +00:00
|
|
|
ifeq ($(wildcard $(BSL)), )
|
2016-06-14 14:10:23 +00:00
|
|
|
%.upload:
|
2015-11-12 15:29:41 +00:00
|
|
|
@echo "ERROR: Could not find the cc2538-bsl script. Did you run 'git submodule update --init' ?"
|
|
|
|
else
|
2016-06-14 14:10:23 +00:00
|
|
|
### Upload to every MOTE
|
|
|
|
%.upload: $(foreach MOTE,$(MOTES),%.$(MOTE))
|
|
|
|
@# Dummy recipe to prevent "No rule to make *.upload errors"
|
2015-11-12 15:29:41 +00:00
|
|
|
endif
|
|
|
|
|
2016-06-14 14:10:23 +00:00
|
|
|
### Variable that expands into a pattern rule to upload to a given MOTE.
|
|
|
|
### Requires $(MOTE) to be defined
|
2018-10-14 16:10:50 +00:00
|
|
|
### $$$$ Double escapes $s that need to be passed to the shell - once for when
|
|
|
|
### make parses UPLOAD_RULE, and once for when the expanded rule is parsed by make.
|
2016-06-14 14:10:23 +00:00
|
|
|
define UPLOAD_RULE
|
2018-10-13 23:23:43 +00:00
|
|
|
%.$(MOTE): $(OUT_BIN) $(OUT_ELF)
|
2016-06-14 14:10:23 +00:00
|
|
|
@echo "Flashing $(MOTE)"
|
2018-10-13 23:23:43 +00:00
|
|
|
@BSL_ADDRESS=`$(OBJDUMP) -h $(BUILD_DIR_BOARD)/$$*.elf | grep -B1 LOAD | \
|
2016-06-14 14:10:23 +00:00
|
|
|
grep -Ev 'LOAD|\-\-' | awk '{print "0x" $$$$5}' | \
|
|
|
|
sort -g | head -1`; \
|
2016-12-20 17:18:28 +00:00
|
|
|
$(PYTHON) $(BSL) $(BSL_FLAGS) -b $(BSL_SPEED) -a $$$${BSL_ADDRESS} -p $(MOTE) $$<
|
2016-06-14 14:10:23 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
### Create an upload rule for every MOTE connected
|
|
|
|
$(foreach MOTE,$(MOTES),$(eval $(UPLOAD_RULE)))
|
|
|
|
|
2018-10-14 16:10:50 +00:00
|
|
|
.PHONY: zoul-motes
|
|
|
|
|
2015-11-12 15:29:41 +00:00
|
|
|
zoul-motes:
|
|
|
|
@echo $(MOTES)
|
|
|
|
|
2018-05-12 16:35:51 +00:00
|
|
|
### For the login etc targets
|
|
|
|
BAUDRATE = 115200
|
|
|
|
PORT = $(USBDEVPREFIX)$(firstword $(MOTES))
|