Browse Source

examples: provide example application for a 6LoWPAN border router

dev/timer
Martine Lenders 7 years ago
parent
commit
f6be1cee25
  1. 54
      examples/gnrc_border_router/Makefile
  2. 36
      examples/gnrc_border_router/main.c
  3. 39
      examples/gnrc_border_router/slip_params.h

54
examples/gnrc_border_router/Makefile

@ -0,0 +1,54 @@
# name of your application
APPLICATION = gnrc_border_router
# If no BOARD is found in the environment, use this default:
BOARD ?= samr21-xpro
# This has to be the absolute path to the RIOT base directory:
RIOTBASE ?= $(CURDIR)/../..
BOARD_INSUFFICIENT_MEMORY := airfy-beacon nrf51dongle nrf6310 pca10000 pca10005 nucleo-f334 \
spark-core stm32f0discovery yunjia-nrf51822
BOARD_BLACKLIST := arduino-mega2560 # panic_arch not defined
ifeq (,$(SLIP_UART))
# set default (last available UART)
SLIP_UART="(UART_NUMOF-1)"
endif
ifeq (,$(SLIP_BAUDRATE))
# set default
SLIP_BAUDRATE=115200
endif
GNRC_NETIF_NUMOF := 2
INCLUDES += -I$(CURDIR)
CFLAGS += -DSLIP_UART=$(SLIP_UART)
CFLAGS += -DSLIP_BAUDRATE=$(SLIP_BAUDRATE)
# 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_netif_default
USEMODULE += auto_init_gnrc_netif
# Include SLIP package for IP over Serial communication
USEMODULE += gnrc_slip
# Specify the mandatory networking modules for 6LoWPAN border router
USEMODULE += gnrc_sixlowpan_border_router_default
# Add forwarding table
USEMODULE += fib
# 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
# 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:
CFLAGS += -DDEVELHELP
# Change this to 0 show compiler invocation lines by default:
QUIET ?= 1
include $(RIOTBASE)/Makefile.include

36
examples/gnrc_border_router/main.c

@ -0,0 +1,36 @@
/*
* Copyright (C) 2015 Freie Universität 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 the RIOT network stack
*
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*
* @}
*/
#include <stdio.h>
#include "shell.h"
int main(void)
{
puts("RIOT border router example application");
/* start shell */
puts("All up, running the shell now");
char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);
/* should be never reached */
return 0;
}

39
examples/gnrc_border_router/slip_params.h

@ -0,0 +1,39 @@
/*
* Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
*
* 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 tests
* @{
*
* @file
* @brief slip parameters example, used by auto_init_gnrc_netif
*
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
*/
#ifndef SLIP_PARAMS_H
#define SLIP_PARAMS_H
#include "net/gnrc/slip.h"
#ifdef __cplusplus
extern "C" {
#endif
static gnrc_slip_params_t gnrc_slip_params[] = {
{
.uart = SLIP_UART,
.baudrate = SLIP_BAUDRATE,
},
};
#ifdef __cplusplus
}
#endif
#endif /* SLIP_PARAMS_H */
/** @} */
Loading…
Cancel
Save