Skip to content

Commit

Permalink
network: fixed rpl support to socket_zep for Foren and fixed example …
Browse files Browse the repository at this point in the history
…names dag & dodag
  • Loading branch information
CW-75 committed Sep 13, 2022
1 parent 1be9673 commit dd89a1a
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 20 deletions.
7 changes: 0 additions & 7 deletions examples/mesh4all_rpl_dag/Kconfig

This file was deleted.

16 changes: 16 additions & 0 deletions examples/mesh4all_rpl_dag/Makefile → examples/rpl_dag/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,21 @@ USEMODULE += rpl_protocol
USEMODULE += gnrc_icmpv6_echo

# Use UART_DEV(1) for slipdev as a default, baudrate by default is 115200
# Instead of simulating an Ethernet connection, we can also simulate
# an IEEE 802.15.4 radio using ZEP
# set the ZEP port for native
ZEP_PORT_BASE ?= 17754

ifneq (,$(filter native,$(BOARD)))
USE_ZEP ?= 1
ifeq (1,$(USE_ZEP))
TERMFLAGS += -z [::1]:$(ZEP_PORT_BASE)
USEMODULE += socket_zep

ifneq (,$(ZEP_MAC))
TERMFLAGS += --eui64=$(ZEP_MAC)
endif
endif
endif

include $(RIOTBASE)/Makefile.include
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions examples/mesh4all_rpl_dag/main.c → examples/rpl_dag/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <stdlib.h>
#include <string.h>

#include "msg.h"
#include "shell.h"
#include "log.h"

Expand All @@ -32,7 +33,6 @@
#define MAIN_QUEUE_SIZE (8)

msg_t _main_msg_queue[MAIN_QUEUE_SIZE];
shell_command_t shell_extended_commands[] = {{NULL, NULL, NULL}};

int main(void) {
LOG_INFO("~~ Welcome to rpl exam ~~\n");
Expand All @@ -42,7 +42,7 @@ int main(void) {

rpl_setup(DAG);

shell_run(shell_extended_commands, line_buf, SHELL_DEFAULT_BUFSIZE);
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);

return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ menu "RPL settings"
int "Default DODAG instance"
default 1

config DODAG_IPV6_ADDRESS
string "Wireless Address of DODAG"
default "2001:db8::1"

endmenu #RPL
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ APPLICATION = mesh4all-rpl-dodag
# If We need custom actions, routines, etc **SHOULD BE** included in the "core" folder
# and "MUST BE" code hardware independent
# EXTERNAL_MODULE_DIRS += $(CURDIR)/../core

DEVHELP ?= 1

include ../Makefile.common

# Modules
USEMODULE += saul_default
USEMODULE += shell
Expand All @@ -16,7 +16,24 @@ USEMODULE += ps
USEMODULE += rpl_protocol
USEMODULE += radio
USEMODULE += gnrc_icmpv6_echo
USEMODULE += at_client
# Instead of simulating an Ethernet connection, we can also simulate
# an IEEE 802.15.4 radio using ZEP
# set the ZEP port for native
ZEP_PORT_BASE ?= 17754

ifneq (,$(filter native,$(BOARD)))
USE_ZEP ?= 1
ifeq (1,$(USE_ZEP))
TERMFLAGS += -z [::1]:$(ZEP_PORT_BASE)
USEMODULE += socket_zep

ifneq (,$(ZEP_MAC))
TERMFLAGS += --eui64=$(ZEP_MAC)
endif
endif
endif

include $(RIOTBASE)/Makefile.include

# Set a custom channel if needed
include $(RIOTMAKE)/default-radio-settings.inc.mk
File renamed without changes.
19 changes: 14 additions & 5 deletions examples/mesh4all_rpl_dodag/main.c → examples/rpl_dodag/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,32 @@

#include "shell.h"
#include "log.h"

#include "rpl_protocol.h"
#include "net_tools.h"

#define MAIN_QUEUE_SIZE (8)
#ifndef CONFIG_DODAG_IPV6_ADDRESS
#define CONFIG_DODAG_IPV6_ADDRESS "2001:db8::1"
#endif

msg_t _main_msg_queue[MAIN_QUEUE_SIZE];
shell_command_t shell_extended_commands[] = {{NULL, NULL, NULL}};

int main(void) {
LOG_INFO("~~ Welcome to rpl exam ~~\n");
/* Start shell */
char line_buf[SHELL_DEFAULT_BUFSIZE];
msg_init_queue(_main_msg_queue, MAIN_QUEUE_SIZE);

ipv6_addr_t addr;
ipv6_addr_from_str(&addr, CONFIG_DODAG_IPV6_ADDRESS);
#ifdef BOARD_NATIVE
gnrc_netif_t *iface = gnrc_netif_get_by_type(NETDEV_SOCKET_ZEP, NETDEV_INDEX_ANY);
int8_t iface_idx = iface->pid;
#else
int8_t iface_idx = get_ieee802154_iface();
#endif
set_ipv6_global(iface_idx, addr, 64);
rpl_setup(DODAG);

shell_run(shell_extended_commands, line_buf, SHELL_DEFAULT_BUFSIZE);
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);

return 0;
}
4 changes: 0 additions & 4 deletions firmware/network/rpl_protocol/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ USEMODULE += uniqueid
USEMODULE += gnrc_ipv6_router_default
USEMODULE += net_tools

ifeq (,$(filter auto_init_gnrc_rpl,$(USEMODULE)))
USEMODULE += auto_init_gnrc_rpl
endif

ifneq (,$(filter 6lpan_node,$(USEMODULE)))
USEMODULE += gnrc_sixlowpan_router_default
endif
1 change: 1 addition & 0 deletions firmware/network/rpl_protocol/include/rpl_protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#define RPL_PROTOCOL_H

#include "net/ipv6/addr.h"
#include "sched.h"

#ifdef __cplusplus
extern "C" {
Expand Down
4 changes: 4 additions & 0 deletions firmware/network/rpl_protocol/rpl_protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ int8_t rpl_setup(uint8_t mode) {
if (mode > 1) {
printf("Error: Rpl mode not accepted\n");
}
#ifndef BOARD_NATIVE
err = initial_radio_setup();
if (err != 0) {
printf("Error: couldn't init the radio module .\n");
Expand All @@ -81,6 +82,9 @@ int8_t rpl_setup(uint8_t mode) {
printf("Error: could not get the iface.\n");
return -1;
}
#else
kernel_pid_t iface_index = get_wired_iface();
#endif
err = rpl_init(iface_index);
if (err != 0) {
printf("Error: couldn't init the RPL .\n");
Expand Down

0 comments on commit dd89a1a

Please sign in to comment.