From edc4d1df340968e077c3997be7f71d3831a745d2 Mon Sep 17 00:00:00 2001 From: Jose Alamos Date: Thu, 22 Oct 2020 10:32:55 +0200 Subject: [PATCH 1/3] openthread/Makefile: add netdev_default --- examples/openthread/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/openthread/Makefile b/examples/openthread/Makefile index 5c802adaea9f..02bd45ab113a 100644 --- a/examples/openthread/Makefile +++ b/examples/openthread/Makefile @@ -28,6 +28,8 @@ USEMODULE += openthread-$(OPENTHREAD_TYPE) # Comment the following line in order to disable the OpenThread CLI USEMODULE += openthread-cli +USEMODULE += netdev_default + #Define PANID, CHANNEL and UART_BAUDRATE used by default OPENTHREAD_PANID ?= 0xbeef OPENTHREAD_CHANNEL ?= 26 From 48a65d2617962ffa88733abd36af91f38ba8252d Mon Sep 17 00:00:00 2001 From: Jose Alamos Date: Tue, 8 Sep 2020 15:20:12 +0200 Subject: [PATCH 2/3] openthread/cc2538_rf: add support for CC2538 radios --- examples/openthread/Makefile | 17 ++++++++++++++++- pkg/openthread/Makefile.dep | 5 +++++ pkg/openthread/contrib/openthread.c | 12 ++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/examples/openthread/Makefile b/examples/openthread/Makefile index 02bd45ab113a..d22d151936b4 100644 --- a/examples/openthread/Makefile +++ b/examples/openthread/Makefile @@ -4,7 +4,22 @@ APPLICATION = openthread BOARD ?= samr21-xpro # These are the boards that OpenThread stack has been tested on -BOARD_WHITELIST := samr21-xpro iotlab-m3 fox iotlab-a8-m3 frdm-kw41z openlabs-kw41z-mini-256kib openlabs-kw41z-mini phynode-kw41z usb-kw41z +BOARD_WHITELIST := \ + samr21-xpro \ + iotlab-m3 \ + fox \ + iotlab-a8-m3 \ + frdm-kw41z \ + openlabs-kw41z-mini-256kib \ + openlabs-kw41z-mini \ + phynode-kw41z \ + usb-kw41z \ + cc2538dk \ + remote-reva \ + remote-revb \ + omote \ + openmote-cc2538 \ + # # This has to be the absolute path to the RIOT base directory: RIOTBASE ?= $(CURDIR)/../.. diff --git a/pkg/openthread/Makefile.dep b/pkg/openthread/Makefile.dep index 3c8eb79b19a2..874328f6e2d1 100644 --- a/pkg/openthread/Makefile.dep +++ b/pkg/openthread/Makefile.dep @@ -4,4 +4,9 @@ USEMODULE += openthread_contrib_netdev USEMODULE += l2util USEMODULE += xtimer USEMODULE += event + +ifneq (,$(filter cc2538_rf,$(USEMODULE))) + USEMODULE += netdev_ieee802154_submac +endif + FEATURES_REQUIRED += cpp diff --git a/pkg/openthread/contrib/openthread.c b/pkg/openthread/contrib/openthread.c index 3dc83fea790d..c38e2fd767c3 100644 --- a/pkg/openthread/contrib/openthread.c +++ b/pkg/openthread/contrib/openthread.c @@ -34,6 +34,10 @@ #include "kw41zrf.h" #endif +#ifdef MODULE_CC2538_RF +#include "cc2538_rf.h" +#endif + #define ENABLE_DEBUG (0) #include "debug.h" @@ -45,6 +49,10 @@ #define OPENTHREAD_NETIF_NUMOF (1U) #endif +#ifdef MODULE_CC2538_RF +static cc2538_rf_t cc2538_rf_dev; +#endif + #ifdef MODULE_AT86RF2XX static at86rf2xx_t at86rf2xx_dev; #endif @@ -71,6 +79,10 @@ void openthread_bootstrap(void) kw41zrf_setup(&kw41z_dev); netdev_t *netdev = (netdev_t *) &kw41z_dev; #endif +#ifdef MODULE_CC2538_RF + cc2538_setup(&cc2538_rf_dev); + netdev_t *netdev = (netdev_t*) &cc2538_rf_dev; +#endif openthread_radio_init(netdev, tx_buf, rx_buf); openthread_netdev_init(ot_thread_stack, sizeof(ot_thread_stack), THREAD_PRIORITY_MAIN - 5, "openthread", netdev); From 383e1b1aaf9e96a65c0d1da2e613ee3ea393725c Mon Sep 17 00:00:00 2001 From: Jose Alamos Date: Fri, 16 Oct 2020 16:59:24 +0200 Subject: [PATCH 3/3] openthread/nrf802154: add support for NRF802154 radios --- examples/openthread/Makefile | 3 +++ pkg/openthread/Makefile.dep | 2 +- pkg/openthread/contrib/openthread.c | 12 ++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/examples/openthread/Makefile b/examples/openthread/Makefile index d22d151936b4..f735e9462306 100644 --- a/examples/openthread/Makefile +++ b/examples/openthread/Makefile @@ -19,6 +19,9 @@ BOARD_WHITELIST := \ remote-revb \ omote \ openmote-cc2538 \ + nrf52840dk \ + nrf52840-mdk \ + reel \ # # This has to be the absolute path to the RIOT base directory: diff --git a/pkg/openthread/Makefile.dep b/pkg/openthread/Makefile.dep index 874328f6e2d1..bff5bf798cef 100644 --- a/pkg/openthread/Makefile.dep +++ b/pkg/openthread/Makefile.dep @@ -5,7 +5,7 @@ USEMODULE += l2util USEMODULE += xtimer USEMODULE += event -ifneq (,$(filter cc2538_rf,$(USEMODULE))) +ifneq (,$(filter cc2538_rf nrf802154,$(USEMODULE))) USEMODULE += netdev_ieee802154_submac endif diff --git a/pkg/openthread/contrib/openthread.c b/pkg/openthread/contrib/openthread.c index c38e2fd767c3..9c8098a908e3 100644 --- a/pkg/openthread/contrib/openthread.c +++ b/pkg/openthread/contrib/openthread.c @@ -38,6 +38,10 @@ #include "cc2538_rf.h" #endif +#ifdef MODULE_NRF802154 +#include "nrf802154.h" +#endif + #define ENABLE_DEBUG (0) #include "debug.h" @@ -61,6 +65,10 @@ static at86rf2xx_t at86rf2xx_dev; static kw41zrf_t kw41z_dev; #endif +#ifdef MODULE_NRF802154 +static nrf802154_t nrf802154_dev; +#endif + static uint8_t rx_buf[OPENTHREAD_NETDEV_BUFLEN]; static uint8_t tx_buf[OPENTHREAD_NETDEV_BUFLEN]; static char ot_thread_stack[2 * THREAD_STACKSIZE_MAIN]; @@ -83,6 +91,10 @@ void openthread_bootstrap(void) cc2538_setup(&cc2538_rf_dev); netdev_t *netdev = (netdev_t*) &cc2538_rf_dev; #endif +#ifdef MODULE_NRF802154 + nrf802154_setup(&nrf802154_dev); + netdev_t *netdev = (netdev_t*) &nrf802154_dev; +#endif openthread_radio_init(netdev, tx_buf, rx_buf); openthread_netdev_init(ot_thread_stack, sizeof(ot_thread_stack), THREAD_PRIORITY_MAIN - 5, "openthread", netdev);