diff --git a/dist/tools/openvisualizer/makefile.openvisualizer.inc.mk b/dist/tools/openvisualizer/makefile.openvisualizer.inc.mk index 43dd8cf062..3f1623ecf5 100644 --- a/dist/tools/openvisualizer/makefile.openvisualizer.inc.mk +++ b/dist/tools/openvisualizer/makefile.openvisualizer.inc.mk @@ -10,7 +10,7 @@ # 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 +# More info at https://github.com/fjmolinas/openvisualizer/blob/develop-RIOT/README.md # # Supported: # * openv-term @@ -24,7 +24,7 @@ # ------------- # # * Install openvisualizer: -# * git clone -b develop_SW-318-RIOT https://github.com/fjmolinas/openvisualizer.git +# * git clone -b develop-RIOT https://github.com/fjmolinas/openvisualizer.git # * cd openvisualizer # * pip2 install . # diff --git a/pkg/openwsn/Makefile b/pkg/openwsn/Makefile index 944bf419bd..540e90555f 100644 --- a/pkg/openwsn/Makefile +++ b/pkg/openwsn/Makefile @@ -1,6 +1,6 @@ PKG_NAME=openwsn PKG_URL=https://github.com/openwsn-berkeley/openwsn-fw.git -PKG_VERSION=cbcf622bd9369fcfc8455a5fb9349de2ed3c3a46 +PKG_VERSION=4e58c93dc76d8c5c5c4b8dfebdd955feaf605e74 PKG_LICENSE=BSD-3-Clause include $(RIOTBASE)/pkg/pkg.mk @@ -8,10 +8,14 @@ include $(RIOTBASE)/pkg/pkg.mk # openwsn_% RIOT Modules or PSEUDOMODULES that don't have custom rules IGNORE_MODULES := openwsn_leds \ openwsn_debugpins \ + openwsn_6lo_frag \ + openwsn_icmpv6_echo \ + openwsn_iee802154e_security \ openwsn_radio \ openwsn_serial \ - openwsn_sctimer% \ - openwsn_cryptoengine \ + openwsn_sctimer \ + openwsn_sctimer_rtt \ + openwsn_sctimer_ztimer \ # OPENWSN_MODULES := $(filter-out $(IGNORE_MODULES),$(filter openwsn_%,$(USEMODULE))) @@ -34,10 +38,12 @@ CFLAGS += -DLOG_LEVEL=$(OPENWSN_LOG_LEVEL) OPENWSN_PATH_openstack = openstack OPENWSN_PATH_openapps = openapps +OPENWSN_PATH_openweb = openweb OPENWSN_PATH_drivers = drivers/common +OPENWSN_PATH_crypto = drivers/common/crypto OPENWSN_PATH_scheduler = kernel/openos OPENWSN_PATH_cjoin = openapps/cjoin -OPENWSN_PATH_opencoap = openapps/opencoap +OPENWSN_PATH_opencoap = openweb/opencoap OPENWSN_PATH_mac_low = openstack/02a-MAClow OPENWSN_PATH_mac_high = openstack/02b-MAChigh OPENWSN_PATH_iphc = openstack/03a-IPHC diff --git a/pkg/openwsn/Makefile.dep b/pkg/openwsn/Makefile.dep index 9511b68e16..69685b4d16 100644 --- a/pkg/openwsn/Makefile.dep +++ b/pkg/openwsn/Makefile.dep @@ -1,5 +1,4 @@ ifneq (,$(filter openwsn_openstack,$(USEMODULE))) - USEMODULE += openwsn_cjoin USEMODULE += openwsn_iphc USEMODULE += openwsn_ipv6 USEMODULE += openwsn_mac_low @@ -11,24 +10,29 @@ ifneq (,$(filter openwsn_openstack,$(USEMODULE))) USEMODULE += openwsn_sctimer USEMODULE += openwsn_radio + USEMODULE += openwsn_openweb + USEMODULE += openwsn_openapps + DEFAULT_MODULE += auto_init_openwsn USEMODULE += luid USEMODULE += netdev_default endif +ifneq (,$(filter openwsn_ipv6,$(USEMODULE))) + DEFAULT_MODULE += openwsn_icmpv6_echo +endif + ifneq (,$(filter openwsn_scheduler,$(USEMODULE))) USEMODULE += core_thread_flags endif ifneq (,$(filter openwsn_cjoin,$(USEMODULE))) - USEMODULE += openwsn_openapps USEMODULE += openwsn_opencoap - - USEMODULE += openwsn_cryptoengine + USEMODULE += openwsn_crypto endif -ifneq (,$(filter openwsn_cryptoengine,$(USEMODULE))) +ifneq (,$(filter openwsn_crypto,$(USEMODULE))) USEMODULE += crypto_3des USEMODULE += cipher_modes endif diff --git a/pkg/openwsn/Makefile.include b/pkg/openwsn/Makefile.include index b3b66406f9..63fcc756b4 100644 --- a/pkg/openwsn/Makefile.include +++ b/pkg/openwsn/Makefile.include @@ -2,6 +2,7 @@ INCLUDES += -I$(PKGDIRBASE)/openwsn \ -I$(PKGDIRBASE)/openwsn/kernel \ -I$(PKGDIRBASE)/openwsn/inc \ -I$(PKGDIRBASE)/openwsn/drivers/common \ + -I$(PKGDIRBASE)/openwsn/drivers/common/crypto \ -I$(PKGDIRBASE)/openwsn/bsp/boards/ \ -I$(PKGDIRBASE)/openwsn/openstack/ \ -I$(PKGDIRBASE)/openwsn/openstack/02a-MAClow \ @@ -12,17 +13,54 @@ INCLUDES += -I$(PKGDIRBASE)/openwsn \ -I$(PKGDIRBASE)/openwsn/openstack/cross-layers \ -I$(PKGDIRBASE)/openwsn/openapps \ -I$(PKGDIRBASE)/openwsn/openapps/cjoin \ - -I$(PKGDIRBASE)/openwsn/openapps/opencoap \ + -I$(PKGDIRBASE)/openwsn/openweb \ + -I$(PKGDIRBASE)/openwsn/openweb/opencoap \ -I$(RIOTBASE)/pkg/openwsn/include \ DIRS += $(RIOTBASE)/pkg/openwsn/contrib -PSEUDOMODULES += openwsn_serial -PSEUDOMODULES += openwsn_debugpins -PSEUDOMODULES += openwsn_leds -PSEUDOMODULES += openwsn_sctimer% -PSEUDOMODULES += openwsn_cryptoengine -PSEUDOMODULES += openwsn_radio +PSEUDOMODULES += openwsn_serial \ + openwsn_debugpins \ + openwsn_6lo_frag \ + openwsn_icmpv6_echo \ + openwsn_iee802154e_security \ + openwsn_leds \ + openwsn_sctimer \ + openwsn_sctimer_rtt \ + openwsn_sctimer_ztimer \ + openwsn_radio \ + # + +# Set OpenWSN configurations flags, see $(PKG_SOURCE_DIR)/openwsn-fw/inc/config.h + +ifneq (,$(filter openwsn_cjoin,$(USEMODULE))) + CFLAGS += -DOPENWSN_CJOIN_C + CFLAGS += -DBOARD_CRYPTOENGINE_ENABLED +endif + +ifneq (,$(filter openwsn_transport,$(USEMODULE))) + CFLAGS += -DOPENWSN_UDP_C +endif + +ifneq (,$(filter openwsn_opencoap,$(USEMODULE))) + CFLAGS += -DOPENWSN_COAP_C +endif + +ifneq (,$(filter openwsn_6lo_frag,$(USEMODULE))) + CFLAGS += -DOPENWSN_6LO_FRAGMENTATION_C +endif + +ifneq (,$(filter openwsn_icmpv6_echo,$(USEMODULE))) + CFLAGS += -DOPENWSN_ICMPV6ECHO_C +endif + +ifneq (,$(filter openwsn_iee802154e_security,$(USEMODULE))) + CFLAGS += -DOPENWSN_IEEE802154E_SECURITY_C +endif + +ifneq (,$(filter openwsn_adaptive_msf,$(USEMODULE))) + CFLAGS += -DOPENWSN_ADAPTIVE_MSF +endif # In OpenWSN the ISR stack is shared with the network stack. OpenWSN stack is # 2Kb, this means that the ISR stack in OpenWSN might have up to 2Kb available. @@ -36,5 +74,5 @@ ifneq (,$(filter at86rf2xx,$(USEMODULE))) CFLAGS += -DAT86RF2XX_BASIC_MODE endif -# LLVM ARM shows issues with missing definitions fot stdatomic +# LLVM ARM shows issues with missing definitions for stdatomic TOOLCHAINS_BLACKLIST += llvm diff --git a/pkg/openwsn/doc.txt b/pkg/openwsn/doc.txt index 94d97326cb..5c43457222 100644 --- a/pkg/openwsn/doc.txt +++ b/pkg/openwsn/doc.txt @@ -37,7 +37,8 @@ [constrained join protocol](https://datatracker.ietf.org/doc/draft-ietf-6tisch-minimal-security/) an the stack itself only handles Join Requests. The JRC (join registrar/coordinator, a central entity) is not running on the root node, but alongside it, in the - `OpenVisualizer` external tool. + `OpenVisualizer` external tool. This functionality is now optional but can be + included through the `openwsn_cjoin` module. Once joined the device has the required keys to start listening to DIS (DODAG Information Solicitation) messages and to send DIO (DODAG Information Object) @@ -246,6 +247,9 @@ and `SLOTFRAME_LENGTH` are not configurable by default so need to be overridden with `CFLAGS`. + See [Tune parameters in OpenWSN](https://openwsn.atlassian.net/wiki/spaces/OW/pages/132055073/Tune+parameters+in+OpenWSN) + for more details. + ### Timing Timing is essential for OpenWSN to work properly. For optimal results most @@ -278,6 +282,17 @@ The default configuration maps to OpenWSN reference hardware `openmote-b`. + ## Optional Modules and Features + + The following modules are optional and can be disabled if not needed, or to + lower the stack footprint. + + - `openwsn_cjoin`: this enabled the use of Constrained Join Protocol (CoJP) + - `openwsn_6lo_frag`: this enable 6LoWPAN fragmentation + - `openwsn_iee802154e_security`: enable link layer security + - `openwsn_adaptive_msf`: allow the MSF algorithm to dynamically remove and + allocate slots + ## Testing and debugging List of some items which are helpful to explore the functionality of OpenWSN: @@ -405,13 +420,9 @@ critical sections. This can cause bytes sent over stdio to be missed. ## Future Steps - The OpenWSN community is working on refactoring their code base. As - one of the outputs of this modules like `cjoin`, `udp`, `coap` will become - optional. Once this is upstream the support for this pkg should be adapted. + It would be desirable to achieve an extraction of the MAC layer. - With above mentioned re-works the extraction of the MAC layer might be favored. - - As more immediate future steps: + Immediate future steps: - Follow up PR to add OpenWSN sock - Complete support of OpenWSN default HW (`openmote-b`) diff --git a/pkg/openwsn/include/openwsn_log.h b/pkg/openwsn/include/openwsn_log.h new file mode 100644 index 0000000000..5e0078fc14 --- /dev/null +++ b/pkg/openwsn/include/openwsn_log.h @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2015 Kaspar Schleiser + * + * 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 pkg_openwsn + * @{ + * + * @file + * @brief System logging header OpenWSN definitions + * + * This header implements the same functionality as log.h but avoiding + * macro redefinitions with OpenWSN LOG_% functions. + * + * @author Kaspar Schleiser + */ + +#ifndef OPENWSN_LOG_H +#define OPENWSN_LOG_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief defined log levels + * + * These are the logging levels a user can choose. + * The idea is to set LOG_LEVEL to one of these values in the application's Makefile. + * That will restrict output of log statements to those with equal or lower log level. + * + * The default log level is LOG_INFO, which will print every message. + * + * The log function calls of filtered messages will be optimized out at compile + * time, so a lower log level might result in smaller code size. + */ +enum { + LOG_NONE, /**< Lowest log level, will output nothing */ + LOG_ERROR, /**< Error log level, will print only critical, + non-recoverable errors like hardware initialization + failures */ + LOG_WARNING, /**< Warning log level, will print warning messages for + temporary errors */ + LOG_INFO, /**< Informational log level, will print purely + informational messages like successful system bootup, + network link state, ...*/ + LOG_DEBUG, /**< Debug log level, printing developer stuff considered + too verbose for production use */ + LOG_ALL /**< print everything */ +}; + +#ifndef LOG_LEVEL +/** + * @brief Default log level define + */ +#define LOG_LEVEL LOG_INFO +#endif + +/** + * @brief Log message if level <= LOG_LEVEL + */ +#ifdef __clang__ /* following pragmas required for clang 3.8.0 */ +#define LOG(level, ...) do { \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wtautological-compare\"") \ + if ((level) <= LOG_LEVEL) log_write((level), __VA_ARGS__); } while (0U) \ + _Pragma("clang diagnostic pop") +#else +#define LOG(level, ...) do { \ + if ((level) <= LOG_LEVEL) log_write((level), __VA_ARGS__); } while (0U) +#endif /* __clang__ */ + +/** + * @name Logging convenience defines + * @{ + */ +#define LOG_RIOT_ERROR(...) LOG(LOG_ERROR, __VA_ARGS__) +#define LOG_RIOT_WARNING(...) LOG(LOG_WARNING, __VA_ARGS__) +#define LOG_RIOT_INFO(...) LOG(LOG_INFO, __VA_ARGS__) +#define LOG_RIOT_DEBUG(...) LOG(LOG_DEBUG, __VA_ARGS__) +/** @} */ + +/** + * @brief Default log_write function, just maps to printf + */ +#define log_write(level, ...) printf(__VA_ARGS__) + +#ifdef __cplusplus +} +#endif + +#endif /* OPENWSN_LOG_H */ +/** @} */ diff --git a/pkg/openwsn/patches/0001-bsp-kernel-include-RIOT-OpenWSN-board-definitions.patch b/pkg/openwsn/patches/0001-bsp-kernel-include-RIOT-OpenWSN-board-definitions.patch index 023c6522f6..fc8b9ba516 100644 --- a/pkg/openwsn/patches/0001-bsp-kernel-include-RIOT-OpenWSN-board-definitions.patch +++ b/pkg/openwsn/patches/0001-bsp-kernel-include-RIOT-OpenWSN-board-definitions.patch @@ -1,7 +1,7 @@ -From 6f845cd8b8ea316307fd9ef6ab58127a26772f72 Mon Sep 17 00:00:00 2001 +From f519ad22f9564aee46e860c50875a0d66adbb193 Mon Sep 17 00:00:00 2001 From: PeterKietzmann Date: Thu, 8 Feb 2018 10:23:00 +0100 -Subject: [PATCH 01/11] bsp-kernel: include RIOT-OpenWSN board definitions +Subject: [PATCH 01/10] bsp-kernel: include RIOT-OpenWSN board definitions --- bsp/boards/radio.h | 2 +- diff --git a/pkg/openwsn/patches/0002-drivers-common-openserial-rename-include-for-RIOT-Op.patch b/pkg/openwsn/patches/0002-drivers-common-openserial-rename-include-for-RIOT-Op.patch index 007c29dec5..1390dfd2b5 100644 --- a/pkg/openwsn/patches/0002-drivers-common-openserial-rename-include-for-RIOT-Op.patch +++ b/pkg/openwsn/patches/0002-drivers-common-openserial-rename-include-for-RIOT-Op.patch @@ -1,7 +1,7 @@ -From 6fff6e0e31dbed9a603e4e1eab434c45e8b43861 Mon Sep 17 00:00:00 2001 +From 4522c2b7cc03b96b23278953292a9b3c9bb0ee60 Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Mon, 10 Feb 2020 15:05:07 +0100 -Subject: [PATCH 02/11] drivers/common/openserial: rename include for +Subject: [PATCH 02/10] drivers/common/openserial: rename include for RIOT-OpenWSN uart --- @@ -9,7 +9,7 @@ Subject: [PATCH 02/11] drivers/common/openserial: rename include for 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/common/openserial.c b/drivers/common/openserial.c -index d39634c1..5c3c0003 100644 +index 27a30d24..2e417071 100644 --- a/drivers/common/openserial.c +++ b/drivers/common/openserial.c @@ -20,7 +20,7 @@ diff --git a/pkg/openwsn/patches/0003-openapps-comment-out-unused-COAP-UDP-applications-in.patch b/pkg/openwsn/patches/0003-openapps-comment-out-unused-COAP-UDP-applications-in.patch deleted file mode 100644 index 74336c6285..0000000000 --- a/pkg/openwsn/patches/0003-openapps-comment-out-unused-COAP-UDP-applications-in.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 1b9c54459e882a2beb4cedbdbafbb299b95be9e8 Mon Sep 17 00:00:00 2001 -From: Francisco Molina -Date: Fri, 27 Mar 2020 09:59:24 +0100 -Subject: [PATCH 03/11] openapps: comment out unused COAP&UDP applications - includes - ---- - openapps/openapps.c | 26 +++++++++++++------------- - 1 file changed, 13 insertions(+), 13 deletions(-) - -diff --git a/openapps/openapps.c b/openapps/openapps.c -index 3124d0c6..e30dcaec 100644 ---- a/openapps/openapps.c -+++ b/openapps/openapps.c -@@ -8,18 +8,18 @@ - - // CoAP - #include "opencoap.h" --#include "c6t.h" --#include "cinfo.h" --#include "cleds.h" -+// #include "c6t.h" -+// #include "cinfo.h" -+// #include "cleds.h" - #include "cjoin.h" --#include "cwellknown.h" --#include "rrt.h" -+// #include "cwellknown.h" -+// #include "rrt.h" - // UDP --#include "uecho.h" --#include "uinject.h" --#include "userialbridge.h" --#include "uexpiration.h" --#include "uexpiration_monitor.h" -+// #include "uecho.h" -+// #include "uinject.h" -+// #include "userialbridge.h" -+// #include "uexpiration.h" -+// #include "uexpiration_monitor.h" - - //=========================== variables ======================================= - -@@ -35,10 +35,10 @@ void openapps_init(void) { - - // CoAP - //c6t_init(); -- cinfo_init(); -- cleds__init(); -+ // cinfo_init(); -+ // cleds__init(); - cjoin_init(); -- cwellknown_init(); -+ // cwellknown_init(); - //rrt_init(); - - // UDP --- -2.27.0 - diff --git a/pkg/openwsn/patches/0004-openstack-02b-MAChigh-neighbors.c-expose-neighbors_v.patch b/pkg/openwsn/patches/0003-openstack-02b-MAChigh-neighbors.c-expose-neighbors_v.patch similarity index 79% rename from pkg/openwsn/patches/0004-openstack-02b-MAChigh-neighbors.c-expose-neighbors_v.patch rename to pkg/openwsn/patches/0003-openstack-02b-MAChigh-neighbors.c-expose-neighbors_v.patch index 34b3e2c18e..64e866c3a3 100644 --- a/pkg/openwsn/patches/0004-openstack-02b-MAChigh-neighbors.c-expose-neighbors_v.patch +++ b/pkg/openwsn/patches/0003-openstack-02b-MAChigh-neighbors.c-expose-neighbors_v.patch @@ -1,7 +1,7 @@ -From a4a7bdb3504fe3e0f332170433e1e31f417f64fd Mon Sep 17 00:00:00 2001 +From 462865cd89f6e970c7dbdd62cb66cee538be8f6c Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Fri, 27 Mar 2020 10:15:43 +0100 -Subject: [PATCH 04/11] openstack/02b-MAChigh/neighbors.c: expose +Subject: [PATCH 03/10] openstack/02b-MAChigh/neighbors.c: expose neighbors_vars --- @@ -9,7 +9,7 @@ Subject: [PATCH 04/11] openstack/02b-MAChigh/neighbors.c: expose 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openstack/02b-MAChigh/neighbors.c b/openstack/02b-MAChigh/neighbors.c -index a7de3394..4cfcf146 100644 +index c947ab9e..eff3bb34 100644 --- a/openstack/02b-MAChigh/neighbors.c +++ b/openstack/02b-MAChigh/neighbors.c @@ -10,7 +10,7 @@ diff --git a/pkg/openwsn/patches/0005-kernel-openos-scheduler-use-thread-flags-restore-irq.patch b/pkg/openwsn/patches/0004-kernel-openos-scheduler-use-thread-flags-restore-irq.patch similarity index 92% rename from pkg/openwsn/patches/0005-kernel-openos-scheduler-use-thread-flags-restore-irq.patch rename to pkg/openwsn/patches/0004-kernel-openos-scheduler-use-thread-flags-restore-irq.patch index 3a1d337536..4f87397aaf 100644 --- a/pkg/openwsn/patches/0005-kernel-openos-scheduler-use-thread-flags-restore-irq.patch +++ b/pkg/openwsn/patches/0004-kernel-openos-scheduler-use-thread-flags-restore-irq.patch @@ -1,7 +1,7 @@ -From 626dbbed27b4a66bcf02fe061d5af1bff2d1accd Mon Sep 17 00:00:00 2001 +From 9854468048be9f3119ff76ec4545ba7bfb99f107 Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Sun, 29 Mar 2020 12:11:53 +0200 -Subject: [PATCH 05/11] kernel/openos/scheduler: use thread flags, restore +Subject: [PATCH 04/10] kernel/openos/scheduler: use thread flags, restore irq_state Use thread_flags_wait_any to pause the scheduler. Set flag in diff --git a/pkg/openwsn/patches/0006-bsp-boards-toolchain_defs.h-comment-out-conflict-ISR.patch b/pkg/openwsn/patches/0005-bsp-boards-toolchain_defs.h-comment-out-conflict-ISR.patch similarity index 89% rename from pkg/openwsn/patches/0006-bsp-boards-toolchain_defs.h-comment-out-conflict-ISR.patch rename to pkg/openwsn/patches/0005-bsp-boards-toolchain_defs.h-comment-out-conflict-ISR.patch index 842fb9a55e..39bc69b3d3 100644 --- a/pkg/openwsn/patches/0006-bsp-boards-toolchain_defs.h-comment-out-conflict-ISR.patch +++ b/pkg/openwsn/patches/0005-bsp-boards-toolchain_defs.h-comment-out-conflict-ISR.patch @@ -1,7 +1,7 @@ -From 251802a8050d6b619d2e70c33c6ada5b6e57d549 Mon Sep 17 00:00:00 2001 +From e801ea1e88ea60d848c0ca9c1a2e7dab1a8a7d98 Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Thu, 2 Apr 2020 16:04:29 +0200 -Subject: [PATCH 06/11] bsp/boards/toolchain_defs.h: comment out conflict ISR +Subject: [PATCH 05/10] bsp/boards/toolchain_defs.h: comment out conflict ISR definitions The ISR definition conflicts with AVR ISR definitions. diff --git a/pkg/openwsn/patches/0006-openstack-openstack-dont-init-idmanager.patch b/pkg/openwsn/patches/0006-openstack-openstack-dont-init-idmanager.patch new file mode 100644 index 0000000000..1dd4f984b9 --- /dev/null +++ b/pkg/openwsn/patches/0006-openstack-openstack-dont-init-idmanager.patch @@ -0,0 +1,27 @@ +From e8b844e1af690c1734602911c498ac15e0e1f9ed Mon Sep 17 00:00:00 2001 +From: Francisco Molina +Date: Fri, 15 May 2020 13:45:02 +0200 +Subject: [PATCH 06/10] openstack/openstack: dont init idmanager + +Dont initiate idmanager in OpenWSN but in RIOT to allow overriding +default short address. +--- + openstack/openstack.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/openstack/openstack.c b/openstack/openstack.c +index 8c074d30..a7972024 100644 +--- a/openstack/openstack.c ++++ b/openstack/openstack.c +@@ -59,7 +59,7 @@ void openstack_init(void) { + + //===== stack + //-- cross-layer +- idmanager_init(); // call first since initializes EUI64 and isDAGroot ++ // idmanager_init(); // call first since initializes EUI64 and isDAGroot + openqueue_init(); + openrandom_init(); + +-- +2.27.0 + diff --git a/pkg/openwsn/patches/0007-openstack-openapps-add-debugging.patch b/pkg/openwsn/patches/0007-openstack-openapps-add-debugging.patch new file mode 100644 index 0000000000..2d82d61dbf --- /dev/null +++ b/pkg/openwsn/patches/0007-openstack-openapps-add-debugging.patch @@ -0,0 +1,178 @@ +From c24730d5265dd487ae0f61612f67753ff89b3246 Mon Sep 17 00:00:00 2001 +From: Francisco Molina +Date: Fri, 27 Mar 2020 10:18:16 +0100 +Subject: [PATCH 07/10] openstack/openapps: add debugging + +Debugging info that can be also be obtained through ifconfig in +tests/openwsn. +--- + kernel/openos/scheduler.c | 4 +++- + openapps/cjoin/cjoin.c | 10 +++++++++- + openstack/02a-MAClow/IEEE802154E.c | 4 ++++ + openstack/02b-MAChigh/neighbors.c | 5 ++++- + openstack/03b-IPv6/icmpv6rpl.c | 4 ++++ + 5 files changed, 24 insertions(+), 3 deletions(-) + +diff --git a/kernel/openos/scheduler.c b/kernel/openos/scheduler.c +index 28bfe5c2..b7c74814 100644 +--- a/kernel/openos/scheduler.c ++++ b/kernel/openos/scheduler.c +@@ -13,6 +13,8 @@ + #include "openwsn.h" + #include "thread.h" + ++#include "openwsn_log.h" ++ + #define OPENWSN_SCHEDULER_FLAG (1u << 8) + + //=========================== variables ======================================= +@@ -87,7 +89,7 @@ void scheduler_push_task(task_cbt cb, task_prio_t prio) { + } + if (taskContainer>&scheduler_vars.taskBuf[TASK_LIST_DEPTH-1]) { + // task list has overflown. This should never happpen! +- ++ LOG_RIOT_ERROR("[openos/scheduler]: critical, task list overflow\n"); + // we can not print from within the kernel. Instead: + // blink the error LED + leds_error_blink(); +diff --git a/openapps/cjoin/cjoin.c b/openapps/cjoin/cjoin.c +index e155717b..6527c5ee 100644 +--- a/openapps/cjoin/cjoin.c ++++ b/openapps/cjoin/cjoin.c +@@ -22,6 +22,8 @@ + #include "eui64.h" + #include "neighbors.h" + ++#include "openwsn_log.h" ++ + //=========================== defines ========================================= + + /// inter-packet period (in ms) +@@ -142,15 +144,19 @@ owerror_t cjoin_receive(OpenQueueEntry_t *msg, + owerror_t ret; + + if (coap_header->Code != COAP_CODE_RESP_CHANGED) { ++ LOG_RIOT_DEBUG("[cjoin]:fail, replay protection\n"); + return E_FAIL; + } + + ret = cojp_cbor_decode_configuration_object(msg->payload, msg->length, &configuration); +- if (ret == E_FAIL) { return E_FAIL; } ++ if (ret == E_FAIL) { ++ LOG_RIOT_DEBUG("[cjoin]: decode fail\n"); ++ return E_FAIL; } + + if (configuration.keyset.num_keys == 1 && + configuration.keyset.key[0].key_usage == COJP_KEY_USAGE_6TiSCH_K1K2_ENC_MIC32) { + // set the L2 keys as per the parsed value ++ LOG_RIOT_DEBUG("[cjoin]: success\n"); + IEEE802154_security_setBeaconKey(configuration.keyset.key[0].key_index, configuration.keyset.key[0].key_value); + IEEE802154_security_setDataKey(configuration.keyset.key[0].key_index, configuration.keyset.key[0].key_value); + cjoin_setIsJoined(TRUE); // declare join is over +@@ -160,6 +166,7 @@ owerror_t cjoin_receive(OpenQueueEntry_t *msg, + // TODO not supported for now + } + ++ LOG_RIOT_DEBUG("[cjoin]: failed\n"); + return E_FAIL; + } + +@@ -307,6 +314,7 @@ owerror_t cjoin_sendJoinRequest(open_addr_t *joinProxy) { + // send + + LOG_INFO(COMPONENT_CJOIN, ERR_JOIN_REQUEST, (errorparameter_t) 0, (errorparameter_t) 0); ++ LOG_RIOT_DEBUG("[cjoin]: send join request\n"); + + outcome = coap_send( + pkt, +diff --git a/openstack/02a-MAClow/IEEE802154E.c b/openstack/02a-MAClow/IEEE802154E.c +index 70017ab7..09e0851d 100644 +--- a/openstack/02a-MAClow/IEEE802154E.c ++++ b/openstack/02a-MAClow/IEEE802154E.c +@@ -19,6 +19,8 @@ + #include "openrandom.h" + #include "msf.h" + ++#include "openwsn_log.h" ++ + //=========================== definition ====================================== + + //=========================== variables ======================================= +@@ -843,6 +845,7 @@ port_INLINE void activity_synchronize_endOfFrame(PORT_TIMER_WIDTH capturedTime) + synchronizePacket(ieee154e_vars.syncCapturedTime); + + // declare synchronized ++ LOG_RIOT_DEBUG("[IEE20154E]: synchronized\n"); + changeIsSync(TRUE); + // log the info + LOG_SUCCESS(COMPONENT_IEEE802154E, ERR_SYNCHRONIZED, +@@ -924,6 +927,7 @@ port_INLINE void activity_ti1ORri1(void) { + ieee154e_vars.numOfSleepSlots = 1; + + // declare myself desynchronized ++ LOG_RIOT_DEBUG("[IEE20154E]: desynchronized\n"); + changeIsSync(FALSE); + + // log the error +diff --git a/openstack/02b-MAChigh/neighbors.c b/openstack/02b-MAChigh/neighbors.c +index eff3bb34..c379538d 100644 +--- a/openstack/02b-MAChigh/neighbors.c ++++ b/openstack/02b-MAChigh/neighbors.c +@@ -8,6 +8,8 @@ + #include "openrandom.h" + #include "msf.h" + ++#include "openwsn_log.h" ++ + //=========================== variables ======================================= + + neighbors_vars_t neighbors_vars; +@@ -678,6 +680,7 @@ void registerNewNeighbor(open_addr_t *address, + i = 0; + while (i < MAXNUMNEIGHBORS) { + if (neighbors_vars.neighbors[i].used == FALSE) { ++ LOG_RIOT_DEBUG("[neighbors]: new neighbor rssi: %d\n", rssi); + if (rssi < GOODNEIGHBORMINRSSI) { + break; + } +@@ -728,7 +731,7 @@ bool isNeighbor(open_addr_t *neighbor) { + } + + void removeNeighbor(uint8_t neighborIndex) { +- ++ LOG_RIOT_DEBUG("[neighbors]: remove beighbour %d\n", neighborIndex); + neighbors_vars.neighbors[neighborIndex].used = FALSE; + neighbors_vars.neighbors[neighborIndex].parentPreference = 0; + neighbors_vars.neighbors[neighborIndex].stableNeighbor = FALSE; +diff --git a/openstack/03b-IPv6/icmpv6rpl.c b/openstack/03b-IPv6/icmpv6rpl.c +index 21bc54ac..e7e911ba 100644 +--- a/openstack/03b-IPv6/icmpv6rpl.c ++++ b/openstack/03b-IPv6/icmpv6rpl.c +@@ -14,6 +14,8 @@ + #include "schedule.h" + #include "msf.h" + ++#include "openwsn_log.h" ++ + //=========================== definition ====================================== + + #define DIO_PORTION 10 +@@ -453,6 +455,7 @@ void icmpv6rpl_updateMyDAGrankAndParentSelection(void) { + } + + if (foundBetterParent) { ++ LOG_RIOT_DEBUG("[icmpv6rpl]: found better parent\n"); + icmpv6rpl_vars.haveParent = TRUE; + if (!prevHadParent) { + // in case preParent is killed before calling this function, clear the preferredParent flag +@@ -628,6 +631,7 @@ void icmpv6rpl_indicateRxDIO(OpenQueueEntry_t *msg) { + } + + void icmpv6rpl_killPreferredParent(void) { ++ LOG_RIOT_DEBUG("[icmpv6rpl]: kill preferred parent\n"); + icmpv6rpl_vars.haveParent = FALSE; + if (idmanager_getIsDAGroot() == TRUE) { + icmpv6rpl_vars.myDAGrank = MINHOPRANKINCREASE; +-- +2.27.0 + diff --git a/pkg/openwsn/patches/0007-openstack-openstack-dont-init-idmanager.patch b/pkg/openwsn/patches/0007-openstack-openstack-dont-init-idmanager.patch deleted file mode 100644 index cde7805227..0000000000 --- a/pkg/openwsn/patches/0007-openstack-openstack-dont-init-idmanager.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 6cf200f4f5fd73c065ac801328497bcfd073b382 Mon Sep 17 00:00:00 2001 -From: Francisco Molina -Date: Fri, 15 May 2020 13:45:02 +0200 -Subject: [PATCH 07/11] openstack/openstack: dont init idmanager - -Dont initiate idmanager in OpenWSN but in RIOT to allow overriding -default short address. ---- - openstack/openstack.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/openstack/openstack.c b/openstack/openstack.c -index 3b10eddb..886e853f 100644 ---- a/openstack/openstack.c -+++ b/openstack/openstack.c -@@ -57,7 +57,7 @@ void openstack_init(void) { - - //===== stack - //-- cross-layer -- idmanager_init(); // call first since initializes EUI64 and isDAGroot -+ // idmanager_init(); // call first since initializes EUI64 and isDAGroot - openqueue_init(); - openrandom_init(); - --- -2.27.0 - diff --git a/pkg/openwsn/patches/0009-drivers-common-openserial-add-flag-to-echo-badcrc-fr.patch b/pkg/openwsn/patches/0008-drivers-common-openserial-add-flag-to-echo-badcrc-fr.patch similarity index 64% rename from pkg/openwsn/patches/0009-drivers-common-openserial-add-flag-to-echo-badcrc-fr.patch rename to pkg/openwsn/patches/0008-drivers-common-openserial-add-flag-to-echo-badcrc-fr.patch index 9f57f13aee..ebb77899cf 100644 --- a/pkg/openwsn/patches/0009-drivers-common-openserial-add-flag-to-echo-badcrc-fr.patch +++ b/pkg/openwsn/patches/0008-drivers-common-openserial-add-flag-to-echo-badcrc-fr.patch @@ -1,7 +1,7 @@ -From 04eae39ebd20de1fef5982f66f57cc8fb0fc44d4 Mon Sep 17 00:00:00 2001 +From 555aa9d9b00ecfa8a0c3982de5520d8eb1b23076 Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Thu, 4 Jun 2020 15:39:07 +0200 -Subject: [PATCH 09/11] drivers/common/openserial: add flag to echo badcrc +Subject: [PATCH 08/10] drivers/common/openserial: add flag to echo badcrc frames --- @@ -9,11 +9,11 @@ Subject: [PATCH 09/11] drivers/common/openserial: add flag to echo badcrc 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/common/openserial.c b/drivers/common/openserial.c -index 5c3c0003..c6cdddf0 100644 +index 2e417071..4f13baf3 100644 --- a/drivers/common/openserial.c +++ b/drivers/common/openserial.c -@@ -981,9 +981,13 @@ port_INLINE void inputHdlcClose(void) { - openserial_vars.inputBufFillLevel -= 2; +@@ -733,9 +733,13 @@ port_INLINE void inputHdlcClose(void) { + openserial_vars.inputBufFillLevel -= 2; } else { // the CRC is incorrect - @@ -22,7 +22,7 @@ index 5c3c0003..c6cdddf0 100644 + openserial_vars.inputBuf[0] = SERFRAME_PC2MOTE_TRIGGERSERIALECHO; +#else // drop the incoming frame - openserial_vars.inputBufFillLevel = 0; + openserial_vars.inputBufFillLevel = 0; +#endif } } diff --git a/pkg/openwsn/patches/0008-openstack-openapps-add-debugging.patch b/pkg/openwsn/patches/0008-openstack-openapps-add-debugging.patch deleted file mode 100644 index 6a56d7a1da..0000000000 --- a/pkg/openwsn/patches/0008-openstack-openapps-add-debugging.patch +++ /dev/null @@ -1,175 +0,0 @@ -From ae6271246adb6fb97a8d23f4b09f78223dbb04f6 Mon Sep 17 00:00:00 2001 -From: Francisco Molina -Date: Fri, 27 Mar 2020 10:18:16 +0100 -Subject: [PATCH 08/11] openstack/openapps: add debugging - -Debugging info that can be also be obtained through ifconfig in -tests/openwsn. ---- - kernel/openos/scheduler.c | 3 ++- - openapps/cjoin/cjoin.c | 10 +++++++++- - openstack/02a-MAClow/IEEE802154E.c | 4 ++++ - openstack/02b-MAChigh/neighbors.c | 4 ++++ - openstack/03b-IPv6/icmpv6rpl.c | 4 ++++ - 5 files changed, 23 insertions(+), 2 deletions(-) - -diff --git a/kernel/openos/scheduler.c b/kernel/openos/scheduler.c -index 28bfe5c2..175d6309 100644 ---- a/kernel/openos/scheduler.c -+++ b/kernel/openos/scheduler.c -@@ -12,6 +12,7 @@ - - #include "openwsn.h" - #include "thread.h" -+#include "log.h" - - #define OPENWSN_SCHEDULER_FLAG (1u << 8) - -@@ -87,7 +88,7 @@ void scheduler_push_task(task_cbt cb, task_prio_t prio) { - } - if (taskContainer>&scheduler_vars.taskBuf[TASK_LIST_DEPTH-1]) { - // task list has overflown. This should never happpen! -- -+ LOG_ERROR("[openos/scheduler]: critical, task list overflow\n"); - // we can not print from within the kernel. Instead: - // blink the error LED - leds_error_blink(); -diff --git a/openapps/cjoin/cjoin.c b/openapps/cjoin/cjoin.c -index 2d87372f..74eca7b3 100644 ---- a/openapps/cjoin/cjoin.c -+++ b/openapps/cjoin/cjoin.c -@@ -18,6 +18,8 @@ - #include "eui64.h" - #include "neighbors.h" - -+#include "log.h" -+ - //=========================== defines ========================================= - - /// inter-packet period (in ms) -@@ -134,14 +136,18 @@ owerror_t cjoin_receive(OpenQueueEntry_t* msg, - owerror_t ret; - - if (coap_header->Code != COAP_CODE_RESP_CHANGED) { -+ LOG_DEBUG("[cjoin]:fail, replay protection\n"); - return E_FAIL; - } - - ret = cojp_cbor_decode_configuration_object(msg->payload, msg->length, &configuration); -- if (ret == E_FAIL) { return E_FAIL; } -+ if (ret == E_FAIL) { -+ LOG_DEBUG("[cjoin]: decode fail\n"); -+ return E_FAIL; } - - if (configuration.keyset.num_keys == 1 && - configuration.keyset.key[0].key_usage == COJP_KEY_USAGE_6TiSCH_K1K2_ENC_MIC32) { -+ LOG_DEBUG("[cjoin]: success\n"); - // set the L2 keys as per the parsed value - IEEE802154_security_setBeaconKey(configuration.keyset.key[0].key_index, configuration.keyset.key[0].key_value); - IEEE802154_security_setDataKey(configuration.keyset.key[0].key_index, configuration.keyset.key[0].key_value); -@@ -152,6 +158,7 @@ owerror_t cjoin_receive(OpenQueueEntry_t* msg, - // TODO not supported for now - } - -+ LOG_DEBUG("[cjoin]: failed\n"); - return E_FAIL; - } - -@@ -300,6 +307,7 @@ owerror_t cjoin_sendJoinRequest(open_addr_t* joinProxy) { - packetfunctions_reserveHeaderSize(pkt, payload_len); - memcpy(pkt->payload, tmp, payload_len); - // send -+ LOG_DEBUG("[cjoin]: send join request\n"); - outcome = opencoap_send( - pkt, - COAP_TYPE_NON, -diff --git a/openstack/02a-MAClow/IEEE802154E.c b/openstack/02a-MAClow/IEEE802154E.c -index 07921ae3..c1b532af 100644 ---- a/openstack/02a-MAClow/IEEE802154E.c -+++ b/openstack/02a-MAClow/IEEE802154E.c -@@ -18,6 +18,8 @@ - #include "openrandom.h" - #include "msf.h" - -+#include "log.h" -+ - //=========================== definition ====================================== - - //=========================== variables ======================================= -@@ -806,6 +808,7 @@ port_INLINE void activity_synchronize_endOfFrame(PORT_TIMER_WIDTH capturedTime) - synchronizePacket(ieee154e_vars.syncCapturedTime); - - // declare synchronized -+ LOG_DEBUG("[IEE20154E]: synchronized\n"); - changeIsSync(TRUE); - // log the info - openserial_printInfo(COMPONENT_IEEE802154E,ERR_SYNCHRONIZED, -@@ -890,6 +893,7 @@ port_INLINE void activity_ti1ORri1(void) { - ieee154e_vars.numOfSleepSlots = 1; - - // declare myself desynchronized -+ LOG_DEBUG("[IEE20154E]: desynchronized\n"); - changeIsSync(FALSE); - - // log the error -diff --git a/openstack/02b-MAChigh/neighbors.c b/openstack/02b-MAChigh/neighbors.c -index 4cfcf146..b5f064e9 100644 ---- a/openstack/02b-MAChigh/neighbors.c -+++ b/openstack/02b-MAChigh/neighbors.c -@@ -8,6 +8,8 @@ - #include "openrandom.h" - #include "msf.h" - -+#include "log.h" -+ - //=========================== variables ======================================= - - neighbors_vars_t neighbors_vars; -@@ -687,6 +689,7 @@ void registerNewNeighbor(open_addr_t* address, - i=0; - while(i +Date: Fri, 24 Jul 2020 15:42:05 +0200 +Subject: [PATCH 09/10] inc/check_config: skip checking board, unused in RIOT + +--- + inc/check_config.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/inc/check_config.h b/inc/check_config.h +index 6cbaaf9d..6ab4c78c 100644 +--- a/inc/check_config.h ++++ b/inc/check_config.h +@@ -17,7 +17,7 @@ + !defined(IOTLAB_A8_M3) && \ + !defined(SAMR21_XPRO) && \ + !defined(NRF52840) +-#error 'Board name must be specified to check for configuration errors' ++// #error 'Board name must be specified to check for configuration errors' + #endif + + #if (defined(OPENMOTE_CC2538) || \ +-- +2.27.0 + diff --git a/pkg/openwsn/patches/0010-drivers-common-opentimers-enable-ISR-before-return.patch b/pkg/openwsn/patches/0010-drivers-common-opentimers-enable-ISR-before-return.patch deleted file mode 100644 index fc27caf560..0000000000 --- a/pkg/openwsn/patches/0010-drivers-common-opentimers-enable-ISR-before-return.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 02420eb4baf4229c66df5f99254f867d816b5e58 Mon Sep 17 00:00:00 2001 -From: Francisco Molina -Date: Thu, 25 Jun 2020 15:37:44 +0200 -Subject: [PATCH 10/11] drivers/common/opentimers: enable ISR before return - ---- - drivers/common/opentimers.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/drivers/common/opentimers.c b/drivers/common/opentimers.c -index 718b39a3..0c7c6683 100644 ---- a/drivers/common/opentimers.c -+++ b/drivers/common/opentimers.c -@@ -60,6 +60,7 @@ opentimers_id_t opentimers_create(uint8_t timer_id, uint8_t task_prio){ - opentimers_vars.timersBuf[timer_id].isUsed = TRUE; - // the TSCH timer and inhibit timer won't push a task, - // hence task_prio is not used -+ ENABLE_INTERRUPTS(); - return timer_id; - } - } -@@ -69,6 +70,7 @@ opentimers_id_t opentimers_create(uint8_t timer_id, uint8_t task_prio){ - if (opentimers_vars.timersBuf[id].isUsed == FALSE){ - opentimers_vars.timersBuf[id].isUsed = TRUE; - opentimers_vars.timersBuf[id].timer_task_prio = task_prio; -+ ENABLE_INTERRUPTS(); - return id; - } - } --- -2.27.0 - diff --git a/pkg/openwsn/patches/0010-openwsn-fw-add-ifndef-guards-for-configurable-parame.patch b/pkg/openwsn/patches/0010-openwsn-fw-add-ifndef-guards-for-configurable-parame.patch new file mode 100644 index 0000000000..dd396f2c44 --- /dev/null +++ b/pkg/openwsn/patches/0010-openwsn-fw-add-ifndef-guards-for-configurable-parame.patch @@ -0,0 +1,181 @@ +From 0e2e1e1b3898a77bc0a3474a4edc79c3c54a85d3 Mon Sep 17 00:00:00 2001 +From: Francisco Molina +Date: Fri, 24 Jul 2020 16:48:22 +0200 +Subject: [PATCH 10/10] openwsn-fw: add ifndef guards for configurable + parameters + +--- + inc/config.h | 18 ++++++++++++++---- + openstack/02a-MAClow/IEEE802154E.h | 8 +++++++- + openstack/02b-MAChigh/neighbors.h | 8 ++++++++ + openstack/02b-MAChigh/schedule.h | 12 +++++++++++- + openstack/02b-MAChigh/sixtop.h | 2 ++ + 5 files changed, 42 insertions(+), 6 deletions(-) + +diff --git a/inc/config.h b/inc/config.h +index 974ceb76..4f27b98a 100644 +--- a/inc/config.h ++++ b/inc/config.h +@@ -16,8 +16,9 @@ + * - level 6: critical, error, success, warning, info, and verbose + * + */ +- ++#ifndef OPENWSN_DEBUG_LEVEL + #define OPENWSN_DEBUG_LEVEL 6 ++#endif + + // ========================== Applications ========================== + +@@ -221,11 +222,16 @@ + * - OPENWSN_MAX_NUM_BIGPKTS: defines how many static buffer space will be allocated for processing large packets. + * + */ +- + // #define OPENWSN_6LO_FRAGMENTATION_C +-// #define OPENWSN_MAX_PKTSIZE_SUPPORTED 1320 +-// #define OPENWSN_MAX_NUM_BIGPKTS 2 + ++#ifdef OPENWSN_6LO_FRAGMENTATION_C ++#ifndef OPENWSN_MAX_PKTSIZE_SUPPORTED ++#define OPENWSN_MAX_PKTSIZE_SUPPORTED 1320 ++#endif ++#ifndef OPENWSN_MAX_NUM_BIGPKTS ++#define OPENWSN_MAX_NUM_BIGPKTS 2 ++#endif ++#endif + + /** + * \def OPENWSN_ADAPTIVE_MSF +@@ -279,7 +285,9 @@ + * When the channel is set to 0, frequency hopping is enabled, otherwise a single channel is used. + * + */ ++#ifndef IEEE802154E_SINGLE_CHANNEL + #define IEEE802154E_SINGLE_CHANNEL 11 ++#endif + + /** + * \def PACKETQUEUE_LENGTH +@@ -288,7 +296,9 @@ + * increase RAM usage. + * + */ ++#ifndef PACKETQUEUE_LENGTH + #define PACKETQUEUE_LENGTH 20 ++#endif + + // ======================== Board configuration ======================== + +diff --git a/openstack/02a-MAClow/IEEE802154E.h b/openstack/02a-MAClow/IEEE802154E.h +index f3274979..472e4b85 100644 +--- a/openstack/02a-MAClow/IEEE802154E.h ++++ b/openstack/02a-MAClow/IEEE802154E.h +@@ -42,9 +42,15 @@ static const uint8_t ebIEsBytestream[] = { + #define TXRETRIES 15 // number of MAC retries before declaring failed + #define TX_POWER 31 // 1=-25dBm, 31=0dBm (max value) + #define RESYNCHRONIZATIONGUARD 5 // in 32kHz ticks. min distance to the end of the slot to successfully synchronize +-#define EB_PORTION 10 // set EB on minimal cell for 1/EB_PORTION portion ++#ifndef EB_PORTION ++#define EB_PORTION 10 // set EB on minimal cell for 1/EB_PORTION portion ++#endif ++#ifndef MAXKAPERIOD + #define MAXKAPERIOD 1000 // in slots: 1500@20ms per slot -> ~30 seconds. Max value used by adaptive synchronization. ++#endif ++#ifndef DESYNCTIMEOUT + #define DESYNCTIMEOUT 1750 // in slots: 1750@20ms per slot -> ~35 seconds. A larger DESYNCTIMEOUT is needed if using a larger KATIMEOUT. ++#endif + #define LIMITLARGETIMECORRECTION 5 // threshold number of ticks to declare a timeCorrection "large" + #define LENGTH_IEEE154_MAX 128 // max length of a valid radio packet + #define DUTY_CYCLE_WINDOW_LIMIT (0xFFFFFFFF>>1) // limit of the dutycycle window +diff --git a/openstack/02b-MAChigh/neighbors.h b/openstack/02b-MAChigh/neighbors.h +index 894001e6..3ca55cdc 100644 +--- a/openstack/02b-MAChigh/neighbors.h ++++ b/openstack/02b-MAChigh/neighbors.h +@@ -13,10 +13,18 @@ + //=========================== define ========================================== + + #define MAXPREFERENCE 2 ++#ifndef BADNEIGHBORMAXRSSI + #define BADNEIGHBORMAXRSSI -70 //dBm ++#endif ++#ifndef GOODNEIGHBORMINRSSI + #define GOODNEIGHBORMINRSSI -80 //dBm ++#endif ++#ifndef SWITCHSTABILITYTHRESHOLD + #define SWITCHSTABILITYTHRESHOLD 3 ++#endif ++#ifndef DEFAULTLINKCOST + #define DEFAULTLINKCOST 4 ++#endif + #define MINIMAL_NUM_TX 16 + + #define MAXDAGRANK 0xffff +diff --git a/openstack/02b-MAChigh/schedule.h b/openstack/02b-MAChigh/schedule.h +index 6ba2657a..ae53a9ce 100644 +--- a/openstack/02b-MAChigh/schedule.h ++++ b/openstack/02b-MAChigh/schedule.h +@@ -17,10 +17,15 @@ + + The superframe reappears over time and can be arbitrarily long. + */ ++ ++#ifndef SLOTFRAME_LENGTH + #define SLOTFRAME_LENGTH 101 //should be 101 ++#endif + + //draft-ietf-6tisch-minimal-06 ++#ifndef SCHEDULE_MINIMAL_6TISCH_ACTIVE_CELLS + #define SCHEDULE_MINIMAL_6TISCH_ACTIVE_CELLS 1 ++#endif + #define SCHEDULE_MINIMAL_6TISCH_SLOTOFFSET 0 + #define SCHEDULE_MINIMAL_6TISCH_CHANNELOFFSET 0 + #define SCHEDULE_MINIMAL_6TISCH_DEFAULT_SLOTFRAME_HANDLE 0 //id of slotframe +@@ -37,7 +42,9 @@ The superframe reappears over time and can be arbitrarily long. + for serial port to transmit data to dagroot. + */ + ++#ifndef NUMSLOTSOFF + #define NUMSLOTSOFF 20 ++#endif + + /** + \brief Maximum number of active slots in a superframe. +@@ -49,7 +56,9 @@ in that table; a slot is "active" when it is not of type CELLTYPE_OFF. + Set this number to the exact number of active slots you are planning on having + in your schedule, so not to waste RAM. + */ ++#ifndef MAXACTIVESLOTS + #define MAXACTIVESLOTS SCHEDULE_MINIMAL_6TISCH_ACTIVE_CELLS+NUMSLOTSOFF ++#endif + + /** + \brief Maximum number of alternative slots (more than one cells with same slotOffset) +@@ -59,8 +68,9 @@ Note that for each slot entry, it has a table of alternative slots. All + those slots's next pointer is pointing to the same entries. + + */ +- ++#ifndef MAXBACKUPSLOTS + #define MAXBACKUPSLOTS 2 ++#endif + + /** + \brief Minimum backoff exponent. +diff --git a/openstack/02b-MAChigh/sixtop.h b/openstack/02b-MAChigh/sixtop.h +index 6cd98959..7028ca50 100644 +--- a/openstack/02b-MAChigh/sixtop.h ++++ b/openstack/02b-MAChigh/sixtop.h +@@ -81,7 +81,9 @@ typedef enum { + // >2^4*3*(101/9)*15=8080 (2^MAXEB * maxretries * (slotframe / numberOfsharedCellsFor6p)*slotlength) (ms)) + // on the receiver side of sixtop, it may has mutiple sixtop request in the queue to response (most of them will return with RC BUSY) + // increase the timeout longer than calculated value ++#ifndef SIX2SIX_TIMEOUT_MS + #define SIX2SIX_TIMEOUT_MS 65535 ++#endif + + typedef uint8_t (*sixtop_sf_getsfid_cbt)(void); + +-- +2.27.0 + diff --git a/pkg/openwsn/patches/0011-openstack-allow-to-set-EB_PORTION-SLOTFRAME_LENGTH.patch b/pkg/openwsn/patches/0011-openstack-allow-to-set-EB_PORTION-SLOTFRAME_LENGTH.patch deleted file mode 100644 index 36e3fbda10..0000000000 --- a/pkg/openwsn/patches/0011-openstack-allow-to-set-EB_PORTION-SLOTFRAME_LENGTH.patch +++ /dev/null @@ -1,42 +0,0 @@ -From d20020308e0728987dff1190273a7b7322926b64 Mon Sep 17 00:00:00 2001 -From: Francisco Molina -Date: Thu, 25 Jun 2020 17:50:24 +0200 -Subject: [PATCH 11/11] openstack: allow to set EB_PORTION, SLOTFRAME_LENGTH - ---- - openstack/02a-MAClow/IEEE802154E.h | 2 ++ - openstack/02b-MAChigh/schedule.h | 3 +++ - 2 files changed, 5 insertions(+) - -diff --git a/openstack/02a-MAClow/IEEE802154E.h b/openstack/02a-MAClow/IEEE802154E.h -index 117aa7f3..11d7ec10 100644 ---- a/openstack/02a-MAClow/IEEE802154E.h -+++ b/openstack/02a-MAClow/IEEE802154E.h -@@ -41,7 +41,9 @@ static const uint8_t ebIEsBytestream[] = { - #define TXRETRIES 15 // number of MAC retries before declaring failed - #define TX_POWER 31 // 1=-25dBm, 31=0dBm (max value) - #define RESYNCHRONIZATIONGUARD 5 // in 32kHz ticks. min distance to the end of the slot to successfully synchronize -+#ifndef EB_PORTION - #define EB_PORTION 10 // set EB on minimal cell for 1/EB_PORTION portion -+#endif - #define MAXKAPERIOD 1000 // in slots: 1500@20ms per slot -> ~30 seconds. Max value used by adaptive synchronization. - #define DESYNCTIMEOUT 1750 // in slots: 1750@20ms per slot -> ~35 seconds. A larger DESYNCTIMEOUT is needed if using a larger KATIMEOUT. - #define LIMITLARGETIMECORRECTION 5 // threshold number of ticks to declare a timeCorrection "large" -diff --git a/openstack/02b-MAChigh/schedule.h b/openstack/02b-MAChigh/schedule.h -index dc3b9f50..d64d6cf4 100644 ---- a/openstack/02b-MAChigh/schedule.h -+++ b/openstack/02b-MAChigh/schedule.h -@@ -17,7 +17,10 @@ - - The superframe reappears over time and can be arbitrarily long. - */ -+ -+#ifndef SLOTFRAME_LENGTH - #define SLOTFRAME_LENGTH 101 //should be 101 -+#endif - - //draft-ietf-6tisch-minimal-06 - #define SCHEDULE_MINIMAL_6TISCH_ACTIVE_CELLS 1 --- -2.27.0 - diff --git a/tests/pkg_openwsn/Makefile b/tests/pkg_openwsn/Makefile index a4c05a9b6e..1e733f0d50 100644 --- a/tests/pkg_openwsn/Makefile +++ b/tests/pkg_openwsn/Makefile @@ -12,12 +12,21 @@ BOARD_WHITELIST = \ samr30-xpro \ # -## OpenWSN Modules +# OpenWSN Modules USEPKG += openwsn USEMODULE += openwsn_openstack USEMODULE += openwsn_scheduler +# Optional OpenWSN Modules +## Enable Constrained Join Protocol (CoJP) +USEMODULE += openwsn_cjoin +## Enable 6lowpan fragmentation +USEMODULE += openwsn_6lo_frag +## Enable link layer security +# USEMODULE += openwsn_iee802154e_security +## Enable MSF dynamic slot allocation +# USEMODULE += openwsn_adaptive_msf -# Optional Module required for root nodes +## Optional Module, but required for root nodes # USEMODULE += openwsn_serial # Optional Modules diff --git a/tests/pkg_openwsn/README.md b/tests/pkg_openwsn/README.md index 8ea37d9fa7..08fa8bfa7c 100644 --- a/tests/pkg_openwsn/README.md +++ b/tests/pkg_openwsn/README.md @@ -178,6 +178,8 @@ to see the ipv6 address: NO RPL parent +Note that the '6TiSCH joined' field will only show up if `openwsn_cjoin` +is used. On the root node Openvisualizer is launched and the DAGroot is setup. @@ -194,7 +196,7 @@ On the root node Openvisualizer is launched and the DAGroot is setup. The root node will now start sending beacons and other nodes will synchronize, and join. If channel hopping is enabled this can take quite some time (see [Synchronization](../../pkg/openwsn/doc.txt#Synchronization). Once leaf nodes -have joined the network when issuing `ifconfing` you should see: +have joined the network when issuing `ifconfig` you should see: ifconfig Iface 3 HWaddr: 0F:F4 NID: CA:FE diff --git a/tests/pkg_openwsn/main.c b/tests/pkg_openwsn/main.c index 9f0e425075..d1ff31a7fd 100644 --- a/tests/pkg_openwsn/main.c +++ b/tests/pkg_openwsn/main.c @@ -32,8 +32,10 @@ #include "02a-MAClow/IEEE802154E.h" #include "02b-MAChigh/neighbors.h" #include "03b-IPv6/icmpv6rpl.h" -#include "04-TRAN/openudp.h" +#include "04-TRAN/udp.h" +#ifdef MODULE_OPENWSN_CJOIN #include "cjoin.h" +#endif #include "cross-layers/openqueue.h" #include "cross-layers/idmanager.h" #include "cross-layers/packetfunctions.h" @@ -114,7 +116,9 @@ static int ifconfig_cmd(int argc, char **argv) printf("\t\tIEEE802154E sync: %i\n", ieee154e_isSynch()); +#ifdef MODULE_OPENWSN_CJOIN printf("\t\t6TiSCH joined: %i\n", cjoin_getIsJoined()); +#endif printf("\n"); if (idmanager_vars.isDAGroot) { @@ -193,7 +197,7 @@ static const struct { { "udp", COMPONENT_OPENUDP }, { "coap", COMPONENT_OPENCOAP }, { "cjoin", COMPONENT_CJOIN }, - { "openoscoap", COMPONENT_OPENOSCOAP }, + { "openoscoap", COMPONENT_OSCORE }, { "c6t", COMPONENT_C6T }, { "uinject", COMPONENT_UINJECT }, }; diff --git a/tests/pkg_openwsn/udp.c b/tests/pkg_openwsn/udp.c index 9afbb2211c..c54e40d829 100644 --- a/tests/pkg_openwsn/udp.c +++ b/tests/pkg_openwsn/udp.c @@ -30,7 +30,7 @@ #include "scheduler.h" #include "02a-MAClow/IEEE802154E.h" #include "03b-IPv6/icmpv6rpl.h" -#include "04-TRAN/openudp.h" +#include "04-TRAN/udp.h" #include "cross-layers/openqueue.h" #include "cross-layers/idmanager.h" #include "cross-layers/packetfunctions.h" @@ -105,15 +105,15 @@ static int udp_send(char *addr_str, char *port_str, char *data, pkt->l3_destinationAdd.type = ADDR_128B; memcpy(&pkt->l3_destinationAdd.addr_128b[0], (void *)&addr, 16); /* add payload */ - packetfunctions_reserveHeaderSize(pkt, data_len); + packetfunctions_reserveHeader(&pkt, data_len); memcpy(&pkt->payload[0], data, data_len); - packetfunctions_reserveHeaderSize(pkt, sizeof(uint16_t)); + packetfunctions_reserveHeader(&pkt, sizeof(uint16_t)); pkt->payload[1] = (uint8_t)((counter & 0xff00) >> 8); pkt->payload[0] = (uint8_t)(counter & 0x00ff); counter++; - packetfunctions_reserveHeaderSize(pkt, sizeof(asn_t)); + packetfunctions_reserveHeader(&pkt, sizeof(asn_t)); ieee154e_getAsn(asnArray); pkt->payload[0] = asnArray[0]; pkt->payload[1] = asnArray[1];