-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
examples/gnrc_networking_rpl: add rpl test application
- Loading branch information
Showing
6 changed files
with
722 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# name of your application | ||
APPLICATION = gnrc_rpl_demo | ||
|
||
# If no BOARD is found in the environment, use this default: | ||
BOARD ?= native | ||
|
||
# This has to be the absolute path to the RIOT base directory: | ||
RIOTBASE ?= $(CURDIR)/../.. | ||
|
||
# we need to define the interface on which RPL will run | ||
ifeq (native,$(BOARD)) | ||
CFLAGS += -DCONFIG_GNRC_RPL_DEFAULT_NETIF=7 | ||
else | ||
CFLAGS += -DCONFIG_GNRC_RPL_DEFAULT_NETIF=6 | ||
endif | ||
|
||
# foren6 sniffer listens on channel 11 | ||
CFLAGS += -DCONFIG_IEEE802154_DEFAULT_CHANNEL=11 | ||
|
||
# enable test with a medium sized mesh of 50 nodes | ||
CFLAGS += -DCONFIG_GNRC_IPV6_NIB_OFFL_NUMOF=50 | ||
CFLAGS += -DCONFIG_GNRC_IPV6_NIB_NUMOF=50 | ||
CFLAGS += -DNETSTATS_NB_SIZE=32 | ||
|
||
# Include packages that pull up and auto-init the link layer. | ||
# NOTE: 6LoWPAN will be included if IEEE802.15.4 devices are present | ||
USEMODULE += gnrc_netdev_default | ||
USEMODULE += auto_init_gnrc_netif | ||
# Activate ICMPv6 error messages | ||
USEMODULE += gnrc_icmpv6_error | ||
# Specify the mandatory networking modules for IPv6 and UDP | ||
USEMODULE += gnrc_ipv6_router_default | ||
USEMODULE += gnrc_udp | ||
# Add a routing protocol | ||
USEMODULE += gnrc_rpl | ||
USEMODULE += gnrc_rpl_mrhof | ||
# optional alternative metric, hardware must support it | ||
# USEMODULE += gnrc_rpl_mrhof_lqi | ||
USEMODULE += auto_init_gnrc_rpl | ||
# This application dumps received packets to STDIO using the pktdump module | ||
USEMODULE += gnrc_pktdump | ||
# Additional networking modules that can be dropped if not needed | ||
USEMODULE += gnrc_icmpv6_echo | ||
# Add also the shell, some shell commands | ||
USEMODULE += shell | ||
USEMODULE += shell_commands | ||
USEMODULE += ps | ||
USEMODULE += netstats_l2 | ||
USEMODULE += netstats_ipv6 | ||
USEMODULE += netstats_rpl | ||
|
||
# For the demo, include all statistics modules | ||
USEMODULE += netstats_neighbor_etx | ||
USEMODULE += netstats_neighbor_count | ||
USEMODULE += netstats_neighbor_rssi | ||
USEMODULE += netstats_neighbor_lqi | ||
USEMODULE += netstats_neighbor_tx_time | ||
|
||
# Optionally include DNS support. This includes resolution of names at an | ||
# upstream DNS server and the handling of RDNSS options in Router Advertisements | ||
# to auto-configure that upstream DNS server. | ||
# USEMODULE += sock_dns # include DNS client | ||
# USEMODULE += gnrc_ipv6_nib_dns # include RDNSS option handling | ||
|
||
# Comment this out to disable code in RIOT that does safety checking | ||
# which is not needed in a production environment but helps in the | ||
# development process: | ||
DEVELHELP ?= 1 | ||
|
||
# set the ZEP port for native | ||
ZEP_PORT_BASE ?= 17754 | ||
ifeq (native,$(BOARD)) | ||
TERMFLAGS += -z [::1]:$(ZEP_PORT_BASE) | ||
USEMODULE += socket_zep | ||
endif | ||
|
||
# Uncomment the following 2 lines to specify static link lokal IPv6 address | ||
# this might be useful for testing, in cases where you cannot or do not want to | ||
# run a shell with ifconfig to get the real link lokal address. | ||
#IPV6_STATIC_LLADDR ?= '"fe80::cafe:cafe:cafe:1"' | ||
#CFLAGS += -DGNRC_IPV6_STATIC_LLADDR=$(IPV6_STATIC_LLADDR) | ||
|
||
# Uncomment this to join RPL DODAGs even if DIOs do not contain | ||
# DODAG Configuration Options (see the doc for more info) | ||
# CFLAGS += -DCONFIG_GNRC_RPL_DODAG_CONF_OPTIONAL_ON_JOIN | ||
|
||
# Change this to 0 show compiler invocation lines by default: | ||
QUIET ?= 1 | ||
|
||
include $(RIOTBASE)/Makefile.include | ||
|
||
# Set a custom channel if needed | ||
include $(RIOTMAKE)/default-radio-settings.inc.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
BOARD_INSUFFICIENT_MEMORY := \ | ||
arduino-duemilanove \ | ||
arduino-leonardo \ | ||
arduino-mega2560 \ | ||
arduino-nano \ | ||
arduino-uno \ | ||
atmega1284p \ | ||
atmega328p \ | ||
blackpill \ | ||
bluepill \ | ||
calliope-mini \ | ||
derfmega128 \ | ||
hifive1 \ | ||
hifive1b \ | ||
i-nucleo-lrwan1 \ | ||
im880b \ | ||
mega-xplained \ | ||
microbit \ | ||
microduino-corerf \ | ||
msb-430 \ | ||
msb-430h \ | ||
nucleo-f030r8 \ | ||
nucleo-f031k6 \ | ||
nucleo-f042k6 \ | ||
nucleo-f070rb \ | ||
nucleo-f072rb \ | ||
nucleo-f103rb \ | ||
nucleo-f302r8 \ | ||
nucleo-f303k8 \ | ||
nucleo-f334r8 \ | ||
nucleo-l031k6 \ | ||
nucleo-l053r8 \ | ||
saml10-xpro \ | ||
saml11-xpro \ | ||
spark-core \ | ||
stm32f030f4-demo \ | ||
stm32f0discovery \ | ||
stm32l0538-disco \ | ||
telosb \ | ||
waspmote-pro \ | ||
z1 \ | ||
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# gnrc_networking_rpl Demo | ||
|
||
This example demonstrates the use of RPL with link metrics. | ||
|
||
To showcase the difference between different objective functions and | ||
link metrics, each node in the mesh periodically sends a message to | ||
the root node. | ||
|
||
The root node counts all received messages and stores the number of | ||
hops as well as link quality information for the last hop of the last | ||
packet from each node. | ||
|
||
This allows for direct comparison between routing strategies, the more | ||
packets the root receives from all mesh nodes, the better the mesh. | ||
|
||
## Setup on mesh nodes | ||
|
||
Mesh nodes don't need any additional setup. | ||
As soon as they have a RPL root, they will periodically (each second) | ||
send a hello packet to the root. | ||
|
||
## Setup on root node | ||
|
||
On the root node run | ||
|
||
``` | ||
test start | ||
``` | ||
|
||
to begin the experiment. | ||
|
||
To query the current results, run | ||
|
||
``` | ||
test info | ||
``` | ||
|
||
The summary provides the number of detected nodes as well as the number of packets | ||
received per second. | ||
|
||
In an ideal mesh, those numbers should be equal, that is every periodic packet of | ||
every node is received. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright (C) 2020 Beuth Hochschule für Technik Berlin | ||
* | ||
* This file is subject to the terms and conditions of the GNU Lesser | ||
* General Public License v2.1. See the file LICENSE in the top level | ||
* directory for more details. | ||
*/ | ||
|
||
/** | ||
* @ingroup examples | ||
* @{ | ||
* | ||
* @file | ||
* @brief Example application for demonstrating RPL with link metrics | ||
* | ||
* @author Benjamin Valentin <[email protected]> | ||
* | ||
* @} | ||
*/ | ||
|
||
#include <stdio.h> | ||
|
||
#include "shell.h" | ||
#include "msg.h" | ||
|
||
#define MAIN_QUEUE_SIZE (8) | ||
static msg_t _main_msg_queue[MAIN_QUEUE_SIZE]; | ||
|
||
extern int udp_cmd(int argc, char **argv); | ||
extern int stats_cmd(int argc, char **argv); | ||
|
||
extern void start_sender(void); | ||
|
||
static const shell_command_t shell_commands[] = { | ||
{ "udp", "send data over UDP and listen on UDP ports", udp_cmd }, | ||
{ "test", "RPL experiment stats", stats_cmd }, | ||
{ NULL, NULL, NULL } | ||
}; | ||
|
||
int main(void) | ||
{ | ||
/* we need a message queue for the thread running the shell in order to | ||
* receive potentially fast incoming networking packets */ | ||
msg_init_queue(_main_msg_queue, MAIN_QUEUE_SIZE); | ||
puts("RIOT network stack example application"); | ||
|
||
start_sender(); | ||
|
||
/* start shell */ | ||
puts("All up, running the shell now"); | ||
char line_buf[SHELL_DEFAULT_BUFSIZE]; | ||
shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE); | ||
|
||
/* should be never reached */ | ||
return 0; | ||
} |
Oops, something went wrong.