2016-01-27 15:47:31 +01:00
|
|
|
.PHONY: iotlab-auth iotlab-exp iotlab-flash iotlab-reset iotlab-term iotlab-check-exp
|
2015-03-18 19:03:26 +01:00
|
|
|
|
2015-09-30 10:57:12 +02:00
|
|
|
IOTLAB_NODES ?= 5
|
|
|
|
IOTLAB_DURATION ?= 30
|
|
|
|
IOTLAB_TYPE ?= m3:at86rf231
|
|
|
|
IOTLAB_AUTH ?= $(HOME)/.iotlabrc
|
|
|
|
IOTLAB_USER ?= $(shell cut -f1 -d: $(IOTLAB_AUTH))
|
|
|
|
IOTLAB_EXP_ID ?= $(shell experiment-cli get -l --state Running | grep -m 1 '"id"' | grep -Eo '[[:digit:]]+')
|
|
|
|
IOTLAB_EXP_NAME ?= RIOT_EXP
|
2015-09-22 11:35:23 +02:00
|
|
|
IOTLAB_DEBUG_PORT ?= 3333
|
2015-11-28 13:31:48 +01:00
|
|
|
IOTLAB_DEBUG_NODE ?= $(shell experiment-cli get -i $(IOTLAB_EXP_ID) --resources | \
|
2016-05-02 18:07:48 +02:00
|
|
|
grep -m 1 "network_address" | sed 's/.*-\([0-9]*\)\..*/\1/')
|
2015-09-30 10:57:12 +02:00
|
|
|
|
2016-01-28 20:34:55 +01:00
|
|
|
IOTLAB_AUTHORITY = "$(IOTLAB_USER)@$(IOTLAB_SITE).iot-lab.info"
|
2015-03-18 19:03:26 +01:00
|
|
|
|
2015-09-02 18:17:32 +02:00
|
|
|
ifneq (,$(findstring m3,$(IOTLAB_TYPE)))
|
|
|
|
BINARY := $(ELFFILE)
|
|
|
|
else
|
|
|
|
BINARY := $(HEXFILE)
|
|
|
|
endif
|
|
|
|
|
2015-10-31 21:25:18 +01:00
|
|
|
ifdef IOTLAB_PHY_NODES
|
2016-01-23 12:24:30 +01:00
|
|
|
NODES_PARAM_BASE = -l$(IOTLAB_SITE),$(firstword $(subst :, ,$(IOTLAB_TYPE))),$(IOTLAB_PHY_NODES)
|
|
|
|
NODES_PARAM = "$(NODES_PARAM_BASE),$(BINARY),$(IOTLAB_PROFILE)"
|
2015-10-31 21:25:18 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef IOTLAB_EXCLUDE_NODES
|
|
|
|
EXCLUDE_PARAM := "-e$(IOTLAB_SITE),$(firstword $(subst :, ,$(IOTLAB_TYPE))),$(IOTLAB_EXCLUDE_NODES)"
|
|
|
|
endif
|
|
|
|
|
2015-03-18 19:03:26 +01:00
|
|
|
$(IOTLAB_AUTH):
|
|
|
|
auth-cli -u $(IOTLAB_USER)
|
|
|
|
|
2015-08-05 19:07:33 +02:00
|
|
|
iotlab-exp: $(IOTLAB_AUTH) all
|
2016-01-28 20:34:55 +01:00
|
|
|
$(eval IOTLAB_SITE ?= grenoble)
|
|
|
|
|
2015-07-28 11:43:52 +02:00
|
|
|
ifneq (RIOT_EXP,$(IOTLAB_EXP_NAME))
|
|
|
|
$(eval IOTLAB_EXP_NAME := RIOT_EXP_$(IOTLAB_EXP_NAME))
|
|
|
|
endif
|
2015-09-07 10:13:26 +02:00
|
|
|
|
2015-10-31 21:25:18 +01:00
|
|
|
ifndef NODES_PARAM
|
|
|
|
$(eval NODES_PARAM := "-l$(IOTLAB_NODES),archi=$(IOTLAB_TYPE)+site=$(IOTLAB_SITE),$(BINARY),$(IOTLAB_PROFILE)")
|
2015-09-07 10:13:26 +02:00
|
|
|
endif
|
|
|
|
|
2016-12-17 01:16:59 +01:00
|
|
|
ifeq (,$(Q))
|
2015-10-31 21:25:18 +01:00
|
|
|
@echo "experiment-cli submit -d $(IOTLAB_DURATION) $(NODES_PARAM) -n $(IOTLAB_EXP_NAME)"
|
2015-06-02 16:41:13 +02:00
|
|
|
endif
|
2015-10-31 21:25:18 +01:00
|
|
|
$(eval NEW_ID := $(shell experiment-cli submit -d $(IOTLAB_DURATION) $(NODES_PARAM) -n $(IOTLAB_EXP_NAME) | grep -Eo '[[:digit:]]+'))
|
2016-12-17 01:16:59 +01:00
|
|
|
$(Q)experiment-cli wait -i $(NEW_ID)
|
2015-03-18 19:03:26 +01:00
|
|
|
|
2016-05-24 11:56:15 +02:00
|
|
|
ifdef IOTLAB_LOGGING
|
2016-12-17 01:16:59 +01:00
|
|
|
$(Q)ssh -t $(IOTLAB_AUTHORITY) "tmux new -d -s riot-$(NEW_ID)\
|
2016-04-19 18:13:30 +02:00
|
|
|
'script -fac "'"'"serial_aggregator -i $(NEW_ID)"'"'"\
|
|
|
|
RIOT_LOG-$(IOTLAB_EXP_NAME)-$(NEW_ID)'"
|
|
|
|
endif
|
|
|
|
|
2016-01-27 15:47:31 +01:00
|
|
|
iotlab-flash: $(IOTLAB_AUTH) iotlab-check-exp all
|
2016-12-17 01:16:59 +01:00
|
|
|
$(Q)node-cli --update $(BINARY) -i $(IOTLAB_EXP_ID) $(NODES_PARAM_BASE) $(EXCLUDE_PARAM)
|
2015-03-18 19:03:26 +01:00
|
|
|
|
2016-01-27 15:47:31 +01:00
|
|
|
iotlab-reset: $(IOTLAB_AUTH) iotlab-check-exp
|
2016-12-17 01:16:59 +01:00
|
|
|
$(Q)node-cli --reset -i $(IOTLAB_EXP_ID) $(NODES_PARAM_BASE) $(EXCLUDE_PARAM)
|
2015-03-18 19:03:26 +01:00
|
|
|
|
2016-01-27 15:47:31 +01:00
|
|
|
iotlab-debug-server: $(IOTLAB_AUTH) iotlab-check-exp
|
2016-05-02 18:07:48 +02:00
|
|
|
$(eval DEBUG_TYPE := $(shell echo $(IOTLAB_TYPE) | cut -d: -f1))
|
|
|
|
$(eval DEBUG_NODE := $(shell echo $(IOTLAB_DEBUG_NODE) | sed 's/$(DEBUG_TYPE)-\([0-9]*\)/\1/'))
|
|
|
|
|
2016-12-17 01:16:59 +01:00
|
|
|
$(Q)node-cli --debug-start -i $(IOTLAB_EXP_ID) -l $(IOTLAB_SITE),$(DEBUG_TYPE),$(DEBUG_NODE)
|
2015-09-22 11:35:23 +02:00
|
|
|
@echo "Debug on node $(IOTLAB_DEBUG_NODE)"
|
2016-12-17 01:16:59 +01:00
|
|
|
$(Q)ssh -N -L $(IOTLAB_DEBUG_PORT):$(IOTLAB_DEBUG_NODE):3333 $(IOTLAB_AUTHORITY)
|
2015-09-22 11:35:23 +02:00
|
|
|
|
2016-01-27 19:54:16 +01:00
|
|
|
iotlab-stop: $(IOTLAB_AUTH) iotlab-check-exp
|
2016-12-17 01:16:59 +01:00
|
|
|
$(Q)experiment-cli stop -i $(IOTLAB_EXP_ID)
|
2016-01-27 19:54:16 +01:00
|
|
|
|
2016-01-27 15:47:31 +01:00
|
|
|
iotlab-term: iotlab-check-exp
|
2016-12-17 01:16:59 +01:00
|
|
|
$(Q)ssh -t $(IOTLAB_AUTHORITY) "test -f ~/.iotlabrc || auth-cli -u $(IOTLAB_USER)"
|
2016-01-23 12:24:30 +01:00
|
|
|
|
2016-12-17 01:16:59 +01:00
|
|
|
$(Q)ssh -t $(IOTLAB_AUTHORITY) \
|
2016-04-19 09:53:46 +02:00
|
|
|
"tmux attach -t riot-$(IOTLAB_EXP_ID) || tmux new -s riot-$(IOTLAB_EXP_ID) \
|
|
|
|
'$(if $(IOTLAB_LOGGING), \
|
|
|
|
script -fac "'"'"serial_aggregator -i $(IOTLAB_EXP_ID) $(NODES_PARAM_BASE)"'"'" \
|
|
|
|
RIOT_LOG-$(IOTLAB_EXP_NAME)-$(IOTLAB_EXP_ID), \
|
|
|
|
serial_aggregator -i $(IOTLAB_EXP_ID) $(NODES_PARAM_BASE))'"
|
2016-01-23 12:24:30 +01:00
|
|
|
|
2016-01-27 15:47:31 +01:00
|
|
|
iotlab-check-exp:
|
2016-01-23 12:24:30 +01:00
|
|
|
ifndef IOTLAB_SITE
|
2016-01-28 20:34:55 +01:00
|
|
|
$(eval IOTLAB_SITE := $(shell experiment-cli get -ri -i $(IOTLAB_EXP_ID) | sed -n 4p | cut -d\" -f2))
|
2016-01-23 12:24:30 +01:00
|
|
|
endif
|