mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
5fdbd09187
This adds support for the ATmega128RFA1 based Zigduino. The board is available on the Strasbourg site of the IoT lab for testing.
221 lines
7.9 KiB
Makefile
221 lines
7.9 KiB
Makefile
# Use a single iot-lab node with RIOT
|
|
# ===================================
|
|
#
|
|
# Supported:
|
|
# * flash
|
|
# * reset
|
|
# * term
|
|
#
|
|
# Tested on m3/a8-m3/samr21/arduino-zero nodes
|
|
#
|
|
# It can be run:
|
|
# * From your computer by setting IOTLAB_NODE to the full url like
|
|
# m3-380.grenoble.iot-lab.info or a8-1.grenoble.iot-lab.info
|
|
# * From IoT-LAB frontend by setting IOTLAB_NODE to the short url like
|
|
# m3-380 or a8-1
|
|
#
|
|
# # Usage
|
|
#
|
|
# make BOARD=iotlab-m3 IOTLAB_NODE=m3-380.grenoble.iot-lab.info flash term
|
|
#
|
|
# It is the user responsibility to start an experiment beforehand
|
|
#
|
|
# If the user has multiple running experiments, the one to use must be
|
|
# configured with the `IOTLAB_EXP_ID` setting
|
|
#
|
|
# Prerequisites
|
|
# -------------
|
|
#
|
|
# * Install iotlab-cli-tools: https://github.com/iot-lab/cli-tools
|
|
# * Configure your account with 'iotlab-auth'
|
|
# * Register your computer public key in your ssh keys list on your profile:
|
|
# https://www.iot-lab.info/tutorials/configure-your-ssh-access/
|
|
# * If using an A8 node from a frontend:
|
|
# * Register the frontend public key in your ssh keys list on your profile.
|
|
# https://www.iot-lab.info/tutorials/ssh-cli-client/
|
|
#
|
|
# Additional for A8 nodes
|
|
#
|
|
# * Install iotlab-ssh-cli-tools https://github.com/iot-lab/ssh-cli-tools
|
|
|
|
ifeq (,$(IOTLAB_NODE))
|
|
$(warning IOTLAB_NODE undefined, it should be defined to:)
|
|
$(warning * <type>-<number>.<site>.iot-lab.info when run from your computer)
|
|
$(warning Example: m3-380.grenoble.iot-lab.info or a8-1.grenoble.iot-lab.info)
|
|
$(warning * <type>-<number> when run from iot-lab frontend)
|
|
$(warning Example: m3-380 or a8-1)
|
|
$(warning * 'auto' or 'auto-ssh' to try auto-detecting the node from your experiment
|
|
$(error)
|
|
endif
|
|
|
|
IOTLAB_AUTH ?= $(HOME)/.iotlabrc
|
|
IOTLAB_USER ?= $(shell cut -f1 -d: $(IOTLAB_AUTH))
|
|
|
|
# Optional Experiment id. Required when having multiple experiments
|
|
IOTLAB_EXP_ID ?=
|
|
|
|
# Specify experiment-id option if provided
|
|
_IOTLAB_EXP_ID := $(if $(IOTLAB_EXP_ID),--id $(IOTLAB_EXP_ID))
|
|
|
|
# Number of the node to take from the list in 'auto' and 'auto-ssh' mode
|
|
# Default to 1 so the first one
|
|
IOTLAB_NODE_AUTO_NUM ?= 1
|
|
|
|
# board-archi mapping
|
|
IOTLAB_ARCHI_arduino-zero = arduino-zero:xbee
|
|
IOTLAB_ARCHI_b-l072z-lrwan1 = st-lrwan1:sx1276
|
|
IOTLAB_ARCHI_b-l475e-iot01a = st-iotnode:multi
|
|
IOTLAB_ARCHI_dwm1001 = dwm1001:dw1000
|
|
IOTLAB_ARCHI_firefly = firefly:multi
|
|
IOTLAB_ARCHI_frdm-kw41z = frdm-kw41z:multi
|
|
IOTLAB_ARCHI_iotlab-a8-m3 = a8:at86rf231
|
|
IOTLAB_ARCHI_iotlab-m3 = m3:at86rf231
|
|
IOTLAB_ARCHI_microbit = microbit:ble
|
|
IOTLAB_ARCHI_nrf51dk = nrf51dk:ble
|
|
IOTLAB_ARCHI_nrf52dk = nrf52dk:ble
|
|
IOTLAB_ARCHI_nrf52832-mdk = nrf52832mdk:ble
|
|
IOTLAB_ARCHI_nrf52840dk = nrf52840dk:multi
|
|
IOTLAB_ARCHI_nrf52840-mdk = nrf52840mdk:multi
|
|
IOTLAB_ARCHI_pba-d-01-kw2x = phynode:kw2xrf
|
|
IOTLAB_ARCHI_samr21-xpro = samr21:at86rf233
|
|
IOTLAB_ARCHI_samr30-xpro = samr30:at86rf212b
|
|
IOTLAB_ARCHI_zigduino = zigduino:atmega128rfa1
|
|
IOTLAB_ARCHI := $(IOTLAB_ARCHI_$(BOARD))
|
|
|
|
# There are several deprecated and incompatible features used here that were
|
|
# introduced between versions 2 and 3 of the IoT-LAB cli tools.
|
|
# For backward compatibility, we manage these changes here.
|
|
_CLI_TOOLS_MAJOR_VERSION ?= $(shell iotlab-experiment --version | cut -f1 -d.)
|
|
ifeq (2,$(_CLI_TOOLS_MAJOR_VERSION))
|
|
_NODES_DEPLOYED = $(shell iotlab-experiment --jmespath='deploymentresults."0"' --format='" ".join' get $(_IOTLAB_EXP_ID) --print)
|
|
_NODES_LIST_OPTION = --resources
|
|
_NODES_FLASH_OPTION = --update
|
|
else
|
|
_NODES_DEPLOYED = $(shell iotlab-experiment --jmespath='"0"' --format='" ".join' get $(_IOTLAB_EXP_ID) --deployment)
|
|
_NODES_LIST_OPTION = --nodes
|
|
_NODES_FLASH_OPTION = --flash
|
|
ifeq (,$(filter firefly zigduino,$(BOARD)))
|
|
# All boards in IoT-LAB except firefly can be flashed using $(BINFILE).
|
|
# On IoT-LAB, firefly only accepts $(ELFFILE) and WSN320 boards on accept $(HEXFILE).
|
|
# Using $(BINFILE) speeds up the firmware upload since the file is much
|
|
# smaller than an elffile.
|
|
# This feature is only available in cli-tools version >= 3.
|
|
FLASHFILE = $(BINFILE)
|
|
endif
|
|
endif
|
|
|
|
# Try detecting the node automatically
|
|
# * It takes the first working node that match BOARD
|
|
# * Check correctly deployed nodes with 'deploymentresults == "0"'
|
|
# * Select nodes by architucture using the board-archi mapping
|
|
# * Nodes for current server in 'auto'
|
|
ifneq (,$(filter auto auto-ssh,$(IOTLAB_NODE)))
|
|
ifeq (,$(IOTLAB_ARCHI))
|
|
$(error Could not find 'archi' for $(BOARD), update mapping in $(lastword $(MAKEFILE_LIST)))
|
|
endif
|
|
|
|
ifeq (auto,$(IOTLAB_NODE))
|
|
_NODES_DEPLOYED := $(filter %.$(shell hostname).iot-lab.info, $(_NODES_DEPLOYED))
|
|
endif
|
|
_NODES_FOR_BOARD = $(shell iotlab-experiment --jmespath="items[?archi=='$(IOTLAB_ARCHI)'].network_address" --format='" ".join' get $(_IOTLAB_EXP_ID) $(_NODES_LIST_OPTION))
|
|
|
|
_IOTLAB_NODE := $(word $(IOTLAB_NODE_AUTO_NUM),$(filter $(_NODES_DEPLOYED),$(_NODES_FOR_BOARD)))
|
|
ifeq (auto,$(IOTLAB_NODE))
|
|
override IOTLAB_NODE := $(firstword $(subst ., ,$(_IOTLAB_NODE)))
|
|
else
|
|
override IOTLAB_NODE := $(_IOTLAB_NODE)
|
|
endif
|
|
|
|
ifeq (,$(IOTLAB_NODE))
|
|
$(error Could not automatically find a node for BOARD=$(BOARD))
|
|
endif
|
|
override IOTLAB_NODE := $(patsubst node-%,%,$(IOTLAB_NODE))
|
|
endif
|
|
|
|
|
|
# If the IOTLAB_NODE format is:
|
|
# * 'type-num.iot.lab.info' assume it is run from your computer
|
|
# * 'type-num' assume it is run from iot-lab frontend
|
|
ifneq (,$(filter %.iot-lab.info, $(IOTLAB_NODE)))
|
|
_IOTLAB_ON_FRONTEND =
|
|
else
|
|
_IOTLAB_ON_FRONTEND = 1
|
|
endif
|
|
# Work with node url without 'node-'
|
|
override IOTLAB_NODE := $(patsubst node-%,%,$(IOTLAB_NODE))
|
|
|
|
|
|
# Create node list and optionally frontend url
|
|
ifeq (,$(_IOTLAB_ON_FRONTEND))
|
|
# m3-380.grenoble.iot-lab.info -> grenoble,m3,380
|
|
# a8-1.grenoble.iot-lab.info -> grenoble,a8,1
|
|
_NODELIST_SED := 's/\([^.]*\)-\([^.]*\).\([^.]*\).*/\3,\1,\2/'
|
|
_IOTLAB_NODELIST := --list $(shell echo '$(IOTLAB_NODE)' | sed $(_NODELIST_SED))
|
|
|
|
# Remove the node type-number part
|
|
_IOTLAB_SERVER := $(shell echo '$(IOTLAB_NODE)' | sed 's/[^.]*.//')
|
|
_IOTLAB_AUTHORITY = $(IOTLAB_USER)@$(_IOTLAB_SERVER)
|
|
else
|
|
# m3-380 -> $(hostname),m3,380
|
|
# a8-1 -> $(hostname),a8,1
|
|
_NODELIST_SED := 's/\([^.]*\)-\([^.]*\)/$(shell hostname),\1,\2/'
|
|
_IOTLAB_NODELIST := --list $(shell echo '$(IOTLAB_NODE)' | sed $(_NODELIST_SED))
|
|
endif
|
|
|
|
|
|
# Display value of IOTLAB_NODE, useful to get the value calculated when using
|
|
# IOTLAB_NODE=auto or auto-ssh
|
|
.PHONY: info-iotlab-node
|
|
info-iotlab-node:
|
|
@echo $(IOTLAB_NODE)
|
|
|
|
|
|
# Configure FLASHER, RESET, TERMPROG depending on BOARD and if on frontend
|
|
|
|
# Command to check if 'stdin' is 0. Cannot use 'cmp - <(echo 0)' without bash shell
|
|
_STDIN_EQ_0 = grep 0
|
|
|
|
ifneq (iotlab-a8-m3,$(BOARD))
|
|
|
|
# M3 nodes
|
|
FLASHER = iotlab-node
|
|
RESET = iotlab-node
|
|
_NODE_FMT = --jmespath='keys(@)[0]' --format='int'
|
|
FFLAGS = $(_NODE_FMT) $(_IOTLAB_EXP_ID) $(_IOTLAB_NODELIST) $(_NODES_FLASH_OPTION) $(FLASHFILE) | $(_STDIN_EQ_0)
|
|
RESET_FLAGS = $(_NODE_FMT) $(_IOTLAB_EXP_ID) $(_IOTLAB_NODELIST) --reset | $(_STDIN_EQ_0)
|
|
|
|
ifeq (,$(_IOTLAB_ON_FRONTEND))
|
|
TERMPROG = ssh
|
|
TERMFLAGS = -t $(_IOTLAB_AUTHORITY) 'socat - tcp:$(IOTLAB_NODE):20000'
|
|
else
|
|
TERMPROG = socat
|
|
TERMFLAGS = - tcp:$(IOTLAB_NODE):20000
|
|
endif
|
|
|
|
else
|
|
|
|
# A8-M3 node
|
|
FLASHER = iotlab-ssh
|
|
RESET = iotlab-ssh
|
|
_NODE_FMT = --jmespath='keys(values(@)[0])[0]' --fmt='int'
|
|
FFLAGS = $(_NODE_FMT) $(_IOTLAB_EXP_ID) flash-m3 $(_IOTLAB_NODELIST) $(FLASHFILE) | $(_STDIN_EQ_0)
|
|
RESET_FLAGS = $(_NODE_FMT) $(_IOTLAB_EXP_ID) reset-m3 $(_IOTLAB_NODELIST) | $(_STDIN_EQ_0)
|
|
|
|
TERMPROG = ssh
|
|
ifeq (,$(_IOTLAB_ON_FRONTEND))
|
|
# Proxy ssh through the iot-lab frontend
|
|
TERMFLAGS = -oProxyCommand='ssh $(_IOTLAB_AUTHORITY) -W %h:%p'
|
|
else
|
|
# Empty existing RIOT TERMFLAGS
|
|
TERMFLAGS =
|
|
endif
|
|
TERMFLAGS += -oStrictHostKeyChecking=no -t root@node-$(IOTLAB_NODE) 'socat - open:/dev/ttyA8_M3,b$(BAUD),echo=0,raw'
|
|
|
|
endif
|
|
|
|
# Debugger not supported
|
|
DEBUGGER =
|
|
DEBUGGER_FLAGS =
|
|
DEBUGSERVER =
|
|
DEBUGSERVER_FLAGS =
|