Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,10 @@ ifneq (,$(filter iotlab-m3 wsn430-v1_3b wsn430-v1_4,$(BOARD)))
endif
endif

ifneq (,$(filter openv-%,$(MAKECMDGOALS)))
include $(RIOTBASE)/dist/tools/openvisualizer/makefile.openvisualizer.inc.mk
endif

# Include desvirt Makefile
include $(RIOTTOOLS)/desvirt/Makefile.desvirt

Expand Down
17 changes: 17 additions & 0 deletions boards/common/iotlab/include/board_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,23 @@ extern "C" {
#define CONFIG_ZTIMER_USEC_MIN (2)
/** @} */

/**
* @name OpenWSN timing constants
*
* @{
*/
/* Measured 440us + ~10% */
#define PORT_maxTxDataPrepare (500/PORT_US_PER_TICK)
/* Measured 200us + ~10% */
#define PORT_maxRxAckPrepare (300/PORT_US_PER_TICK)
/* Measured 300us + ~10% */
#define PORT_maxRxDataPrepare (350/PORT_US_PER_TICK)
/* Measured 316us + ~10% */
#define PORT_maxTxAckPrepare (350/PORT_US_PER_TICK)
/* Measured 360us with openwsn_sctimer_rtt */
#define PORT_delayTx (360/PORT_US_PER_TICK)
/** @} */

/**
* @name Define the interface to the AT86RF231 radio
*
Expand Down
17 changes: 17 additions & 0 deletions boards/samr21-xpro/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,23 @@ extern "C" {
#define AT86RF2XX_PARAM_SLEEP GPIO_PIN(PA, 20)
#define AT86RF2XX_PARAM_RESET GPIO_PIN(PB, 15)

/**
* @name OpenWSN timing constants
*
* @{
*/
/* Measured 800us + ~10% */
#define PORT_maxTxDataPrepare (900/PORT_US_PER_TICK)
/* Measured 450us + ~10% */
#define PORT_maxRxAckPrepare (500/PORT_US_PER_TICK)
/* Measured 500us + ~10% */
#define PORT_maxRxDataPrepare (550/PORT_US_PER_TICK)
/* Measured 660us + ~10% */
#define PORT_maxTxAckPrepare (750/PORT_US_PER_TICK)
/* Measured 650us with openwsn_sctimer_rtt */
#define PORT_delayTx (650/PORT_US_PER_TICK)
/** @} */

/**
* @name LED pin definitions and handlers
* @{
Expand Down
236 changes: 236 additions & 0 deletions dist/tools/openvisualizer/logging.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
# Note Expects 'logDir' passed in with location for file output.

#============================ formatters ===============================

[formatters]
keys=std, console

[formatter_std]
format=%(asctime)s [%(name)s:%(levelname)s] %(message)s
datefmt=%H:%M:%S

[formatter_console]
class=openvisualizer.main.ColoredFormatter
format=%(asctime)s [%(name)s:%(levelname)s] %(message)s
datefmt=%H:%M:%S

#============================ handlers =================================

[handlers]
keys=std,console

[handler_std]
class=handlers.RotatingFileHandler
# args: filename, open mode, max file size, backup file count
args=('LOG_PATH/openv-server.log', 'a', 2000000, 5)
formatter=std

[handler_console]
class=StreamHandler
args=()
formatter=console

#============================ loggers ==================================

[loggers]
keys=
root,
EventBusMonitor,
EventBusClient,
OpenTun,
OpenTunMacOS,
OpenTunWindows,
OpenTunLinux,
MoteConnector,
MoteProbe,
MoteState,
OpenParser,
ParserData,
ParserPrintf,
ParserIEC,
ParserStatus,
Parser,
OpenHdlc,
OpenLbr,
SixLowPanFrag,
RPL,
SourceRoute,
JRC,
Topology,
OpenVisualizerServer,
Utils,
OVWebServer,
OVtracer,
CoAP

[logger_root]
level=ERROR
handlers=std

[logger_EventBusMonitor]
level=ERROR
handlers=std
propagate=0
qualname=EventBusMonitor

[logger_EventBusClient]
level=ERROR
handlers=std
propagate=0
qualname=EventBusClient

[logger_OpenTun]
level=ERROR
handlers=std
propagate=0
qualname=OpenTun

[logger_OpenTunWindows]
level=INFO
handlers=std, console
propagate=0
qualname=OpenTunWindows

[logger_OpenTunLinux]
level=INFO
handlers=std, console
propagate=0
qualname=OpenTunLinux

[logger_OpenTunMacOS]
level=INFO
handlers=std, console
propagate=0
qualname=OpenTunMacOS

[logger_MoteConnector]
level=ERROR
handlers=std
propagate=0
qualname=MoteConnector

[logger_MoteProbe]
level=INFO
handlers=std, console
propagate=0
qualname=MoteProbe

[logger_MoteState]
level=ERROR
handlers=std
propagate=0
qualname=MoteState

[logger_OpenParser]
level=ERROR
handlers=std
propagate=0
qualname=OpenParser

[logger_Parser]
level=ERROR
handlers=std
propagate=0
qualname=Parser

[logger_ParserIEC]
level=VERBOSE
handlers=std, console
propagate=0
qualname=ParserIEC

[logger_ParserData]
level=ERROR
handlers=std
propagate=0
qualname=ParserData

[logger_ParserPrintf]
level=INFO
handlers=std, console
propagate=0
qualname=ParserPrintf

[logger_ParserPacket]
level=ERROR
handlers=std
propagate=0
qualname=ParserPacket

[logger_ParserStatus]
level=ERROR
handlers=std
propagate=0
qualname=ParserStatus

[logger_OpenHdlc]
level=ERROR
handlers=std
propagate=0
qualname=OpenHdlc

[logger_OpenLbr]
level=ERROR
handlers=std
propagate=0
qualname=OpenLbr

[logger_SixLowPanFrag]
level=INFO
handlers=std
propagate=0
qualname=SixLowPanFrag

[logger_RPL]
level=INFO
handlers=std, console
propagate=0
qualname=RPL

[logger_SourceRoute]
level=ERROR
handlers=std
propagate=0
qualname=SourceRoute

[logger_JRC]
level=VERBOSE
handlers=std, console
propagate=0
qualname=JRC

[logger_Topology]
level=ERROR
handlers=std
propagate=0
qualname=Topology

[logger_OpenVisualizerServer]
level=VERBOSE
handlers=std, console
propagate=0
qualname=OpenVisualizerServer

[logger_Utils]
level=VERBOSE
handlers=std, console
propagate=0
qualname=Utils

[logger_OVWebServer]
level=INFO
handlers=std
propagate=0
qualname=OVWebServer

[logger_OVtracer]
level=INFO
handlers=std, console
propagate=0
qualname=OVtracer

[logger_CoAP]
level=INFO
handlers=std, console
propagate=0
qualname=coap
93 changes: 93 additions & 0 deletions dist/tools/openvisualizer/makefile.openvisualizer.inc.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
.PHONY: openv-clean openv-setroot openv-term openv-termroot

# Use a single board with openv
# ===================================
#
# OpenVisualizer runs on port 9000 by default, if that ports conflicts or
# multiple instances are spawned you will need to specify the port, eg.
# * `OPENV_FLAGS='--port=9001`
#
# Not all logs for openvisualizer are piped to the terminal, more detailed logs
# are stored in $(BINDIR)/openv-server.log
#
# More info at https://github.com/fjmolinas/openvisualizer/blob/develop_SW-318-RIOT/README.md
#
# Supported:
# * openv-term
# * openv-termroot
# * openv-termtun
# * openv-setroot
# * openv-clean
# * openv-serial
#
# Prerequisites
# -------------
#
# * Install openvisualizer:
# * git clone -b develop_SW-318-RIOT https://github.com/fjmolinas/openvisualizer.git
# * cd openvisualizer
# * pip2 install .
#
# * If using iotlab nodes, pre-requisites in makefile.iotlab.single.inc.mk
#
# * For `openv-termtun` it will require root must be able to ssh into iotlab
#

# Use full path in case it needs to be run with sudo
OPENV_SERVER_PATH := $(shell which openv-server)
OPENV_CLIENT_PATH := $(shell which openv-client)
OPENV_SERIAL_PATH := $(shell which openv-serial)

# Openvisualizer requires to know where openwsn-fw is located
OPENV_OPENWSN_FW_PATH ?= --fw-path=$(RIOTBASE)/build/pkg/openwsn
OPENV_DEFAULT_FLAGS += $(OPENV_OPENWSN_FW_PATH)

OPENV_DEFAULT_FLAGS ?=

ifneq (,$(IOTLAB_NODE))
OPENV_MOTE ?= $(IOTLAB_NODE)
OPENV_DEFAULT_FLAGS += --iotlab-motes=$(IOTLAB_NODE)
else
OPENV_MOTE += $(PORT)
OPENV_DEFAULT_FLAGS += --port-mask=$(OPENV_MOTE) --baudrate=$(BAUD)
endif

# Use modified logging configuration
OPENV_LOG_CONFIG = $(BINDIR)/logging.conf
OPENV_LOG_FILE = $(BINDIR)/openv-server.log
OPENV_DEFAULT_FLAGS += --lconf=$(OPENV_LOG_CONFIG)

$(OPENV_LOG_CONFIG): $(LAST_MAKEFILEDIR)/logging.conf
$(Q)cp $^ $@.tmp
$(Q)sed -i 's#LOG_PATH#'"$(BINDIR)"'#g' $@.tmp
$(Q)mv $@.tmp $@

# Start tun interface
ifneq (,$(filter openv-termtun,$(MAKECMDGOALS)))
OPENV_DEFAULT_FLAGS += --opentun
endif

# Optional flags to pass through command line
OPENV_FLAGS ?=

openv-term: $(OPENV_LOG_CONFIG)
openv-term: $(TERMDEPS)
$(Q)$(OPENV_SERVER_PATH) $(OPENV_DEFAULT_FLAGS) $(OPENV_FLAGS)

openv-termroot: $(OPENV_LOG_CONFIG)
openv-termroot: $(TERMDEPS)
$(Q)$(OPENV_SERVER_PATH) $(OPENV_DEFAULT_FLAGS) $(OPENV_FLAGS) --root=$(OPENV_MOTE)

openv-termtun: $(OPENV_LOG_CONFIG)
openv-termtun: $(TERMDEPS)
sudo $(OPENV_SERVER_PATH) $(OPENV_DEFAULT_FLAGS) $(OPENV_FLAGS) --root=$(OPENV_MOTE)

openv-setroot:
$(Q)$(OPENV_CLIENT_PATH) $(OPENV_OPENWSN_FW_PATH) $(OPENV_FLAGS) root=$(OPENV_MOTE)

openv-clean:
$(Q)rm -rf $(OPENV_LOG_CONFIG)
$(Q)rm -rf $(OPENV_LOG_FILE)

openv-serial:
$(Q)$(OPENV_SERIAL_PATH) --port=$(PORT) --baudrate=$(BAUD)
Loading