Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg/openwsn: add sock_udp [upstream implementation] #15310

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions pkg/openwsn/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PKG_NAME=openwsn
PKG_URL=https://github.com/openwsn-berkeley/openwsn-fw.git
PKG_VERSION=a49f5a34304daa8c013772ca1705f3d7da1e1514
PKG_VERSION=e2958a031ad50a6f3eeca3a98ad1ae85aa773a48
PKG_LICENSE=BSD-3-Clause

include $(RIOTBASE)/pkg/pkg.mk
Expand All @@ -13,9 +13,9 @@ IGNORE_MODULES := openwsn_leds \
openwsn_iee802154e_security \
openwsn_radio \
openwsn_riotos \
openwsn_sock_udp \
openwsn_sock \
openwsn_sock_async \
openwsn_sock_udp \
openwsn_serial \
openwsn_sctimer \
openwsn_sctimer_rtt \
Expand Down Expand Up @@ -45,14 +45,13 @@ OPENWSN_PATH_openapps = openapps
OPENWSN_PATH_openweb = openweb
OPENWSN_PATH_drivers = drivers/common
OPENWSN_PATH_crypto = drivers/common/crypto
OPENWSN_PATH_openos = kernel/openos
OPENWSN_PATH_cjoin = openapps/cjoin
OPENWSN_PATH_opencoap = openweb/opencoap
OPENWSN_PATH_coap = openweb/opencoap
OPENWSN_PATH_mac_low = openstack/02a-MAClow
OPENWSN_PATH_mac_high = openstack/02b-MAChigh
OPENWSN_PATH_iphc = openstack/03a-IPHC
OPENWSN_PATH_ipv6 = openstack/03b-IPv6
OPENWSN_PATH_transport = openstack/04-TRAN
OPENWSN_PATH_udp = openstack/04-TRAN
OPENWSN_PATH_crosslayers = openstack/cross-layers

all: $(OPENWSN_MODULES)
Expand Down
17 changes: 6 additions & 11 deletions pkg/openwsn/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ ifneq (,$(filter openwsn_openstack,$(USEMODULE)))
USEMODULE += openwsn_ipv6
USEMODULE += openwsn_mac_low
USEMODULE += openwsn_mac_high
USEMODULE += openwsn_transport
USEMODULE += openwsn_crosslayers

USEMODULE += openwsn_drivers
USEMODULE += openwsn_sctimer
USEMODULE += openwsn_radio
Expand All @@ -18,13 +16,7 @@ ifneq (,$(filter openwsn_openstack,$(USEMODULE)))
endif

ifneq (,$(filter openwsn_scheduler,$(USEMODULE)))
ifeq (,$(filter openwsn_openos,$(USEMODULE)))
USEMODULE += openwsn_riotos
endif
endif

ifneq (,$(filter openwsn_openos,$(USEMODULE)))
USEMODULE += core_thread_flags
USEMODULE += openwsn_riotos
endif

ifneq (,$(filter openwsn_riotos,$(USEMODULE)))
Expand All @@ -38,11 +30,13 @@ ifneq (,$(filter openwsn_ipv6,$(USEMODULE)))
endif

ifneq (,$(filter openwsn_cjoin,$(USEMODULE)))
USEMODULE += openwsn_opencoap
USEMODULE += sock_async
# The implementation of sock_udp used by openwsn_coap is asynchronous
USEMODULE += openwsn_coap
USEMODULE += openwsn_crypto
endif

ifneq (,$(filter openwsn_opencoap,$(USEMODULE)))
ifneq (,$(filter openwsn_coap,$(USEMODULE)))
USEMODULE += openwsn_sock_async
endif

Expand Down Expand Up @@ -103,6 +97,7 @@ ifneq (,$(filter openwsn_debugpins,$(USEMODULE)))
endif

ifneq (,$(filter sock_udp,$(USEMODULE)))
USEMODULE += openwsn_udp
USEMODULE += openwsn_sock_udp
endif

Expand Down
32 changes: 1 addition & 31 deletions pkg/openwsn/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -35,44 +35,14 @@ INCLUDES += -I$(PKGDIRBASE)/openwsn \
-I$(PKGDIRBASE)/openwsn/openweb/opencoap \
-I$(RIOTBASE)/pkg/openwsn/include \

ifneq (,$(filter openwsn_openos,$(USEMODULE)))
INCLUDES += -I$(PKGDIRBASE)/openwsn/kernel/openos
endif

ifneq (,$(filter openwsn_riotos,$(USEMODULE)))
INCLUDES += -I$(RIOTBASE)/pkg/openwsn/scheduler
DIRS += $(RIOTBASE)/pkg/openwsn/scheduler
endif

# 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
CFLAGS += -DBOARD_CRYPTOENGINE_ENABLED=1
endif

ifneq (,$(filter openwsn_sock%,$(USEMODULE)))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From c8a38150ba7c8e1c4f04b65b50d8bf6f6d6881ff Mon Sep 17 00:00:00 2001
From 2d29cff11033b519d7cbf8ee1cc18bef4f2ba0e2 Mon Sep 17 00:00:00 2001
From: PeterKietzmann <peter.kietzmann@haw-hamburg.de>
Date: Thu, 8 Feb 2018 10:23:00 +0100
Subject: [PATCH 1/9] bsp-kernel: include RIOT-OpenWSN board definitions
Subject: [PATCH 01/11] bsp-kernel: include RIOT-OpenWSN board definitions

---
bsp/boards/radio.h | 2 +-
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
From 744194e510063e665ffaaf829a20e45494d0ebe8 Mon Sep 17 00:00:00 2001
From efb9d31bbbfcb64876278077faf5d53892c29d2f Mon Sep 17 00:00:00 2001
From: Francisco Molina <femolina@uc.cl>
Date: Mon, 10 Feb 2020 15:05:07 +0100
Subject: [PATCH 2/9] drivers/common/openserial: rename include for
Subject: [PATCH 02/11] drivers/common/openserial: rename include for
RIOT-OpenWSN uart

---
drivers/common/openserial.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/common/openserial.c b/drivers/common/openserial.c
index ac3b8f5c..f0dcb19e 100644
index 53205fbf..8a082722 100644
--- a/drivers/common/openserial.c
+++ b/drivers/common/openserial.c
@@ -20,7 +20,7 @@
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
From 0a1426c01092118bc875fdc46d2dae296188b163 Mon Sep 17 00:00:00 2001
From fa749c96d40ea17a6cdf9bb7200f15624f81449f Mon Sep 17 00:00:00 2001
From: Francisco Molina <femolina@uc.cl>
Date: Fri, 27 Mar 2020 10:15:43 +0100
Subject: [PATCH 3/9] openstack/02b-MAChigh/neighbors.c: expose neighbors_vars
Subject: [PATCH 03/11] openstack/02b-MAChigh/neighbors.c: expose
neighbors_vars

---
openstack/02b-MAChigh/neighbors.c | 2 +-
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 219e01c2b9fb779e3682a24d361a8a9b672b551a Mon Sep 17 00:00:00 2001
From cce174546a58a0d0dc170bc641f89ab86f38547c Mon Sep 17 00:00:00 2001
From: Francisco Molina <femolina@uc.cl>
Date: Sun, 29 Mar 2020 12:11:53 +0200
Subject: [PATCH 4/9] kernel/openos/scheduler: use thread flags, restore
Subject: [PATCH 04/11] kernel/openos/scheduler: use thread flags, restore
irq_state

Use thread_flags_wait_any to pause the scheduler. Set flag in
Expand All @@ -10,8 +10,8 @@ scheduler_push_task to trigger new task handling.
squash! kernel/openos/scheduler: use thread flags
---
kernel/openos/scheduler.c | 13 ++++++++++++-
kernel/scheduler.h | 2 +-
2 files changed, 13 insertions(+), 2 deletions(-)
kernel/scheduler.h | 4 ++--
2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/kernel/openos/scheduler.c b/kernel/openos/scheduler.c
index f52f35d4..41be092f 100644
Expand Down Expand Up @@ -60,7 +60,7 @@ index f52f35d4..41be092f 100644


diff --git a/kernel/scheduler.h b/kernel/scheduler.h
index dd035a22..51b6d9cb 100644
index e44f7956..51b6d9cb 100644
--- a/kernel/scheduler.h
+++ b/kernel/scheduler.h
@@ -47,7 +47,7 @@ typedef void (*task_cbt)(void);
Expand All @@ -72,6 +72,15 @@ index dd035a22..51b6d9cb 100644
void scheduler_push_task(task_cbt task_cb, task_prio_t prio);

#if SCHEDULER_DEBUG_ENABLE
@@ -55,7 +55,7 @@ uint8_t scheduler_debug_get_TasksCur(void);
uint8_t scheduler_debug_get_TasksMax(void);
#endif

-#include "openos/scheduler_types.h"
+#include "scheduler_types.h"

/**
\}
--
2.28.0

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 611a5841893b6f60b9cfa9389c5a9c99599bc651 Mon Sep 17 00:00:00 2001
From 9a0c7499639d096800d22b31fd81db384c7205c5 Mon Sep 17 00:00:00 2001
From: Francisco Molina <femolina@uc.cl>
Date: Thu, 2 Apr 2020 16:04:29 +0200
Subject: [PATCH 5/9] bsp/boards/toolchain_defs.h: comment out conflict ISR
Subject: [PATCH 05/11] bsp/boards/toolchain_defs.h: comment out conflict ISR
definitions

The ISR definition conflicts with AVR ISR definitions.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 085704291c846d225abe8f24d01c1ba4d855b87a Mon Sep 17 00:00:00 2001
From 0aac1d530e20b0773775e40fa81694f20fcaa443 Mon Sep 17 00:00:00 2001
From: Francisco Molina <femolina@uc.cl>
Date: Fri, 15 May 2020 13:45:02 +0200
Subject: [PATCH 6/9] openstack/openstack: dont init idmanager
Subject: [PATCH 06/11] openstack/openstack: dont init idmanager

Dont initiate idmanager in OpenWSN but in RIOT to allow overriding
default short address.
Expand All @@ -10,7 +10,7 @@ default short address.
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/openstack/openstack.c b/openstack/openstack.c
index 172bc317..dce1496a 100644
index 10920319..c220b8ff 100644
--- a/openstack/openstack.c
+++ b/openstack/openstack.c
@@ -59,7 +59,7 @@ void openstack_init(void) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From ede0403eb8774674e2194d30f573fa31b07b9d8a Mon Sep 17 00:00:00 2001
From cce2ccd31b931d1b739e05e124af709e56359a59 Mon Sep 17 00:00:00 2001
From: Francisco Molina <femolina@uc.cl>
Date: Fri, 27 Mar 2020 10:18:16 +0100
Subject: [PATCH 7/9] openstack/openapps: add debugging
Subject: [PATCH 07/11] openstack/openapps: add debugging

Debugging info that can be also be obtained through ifconfig in
tests/openwsn.
Expand Down Expand Up @@ -86,7 +86,7 @@ index 1e040dee..6431cbf7 100644
outcome = coap_send(
pkt,
diff --git a/openstack/02a-MAClow/IEEE802154E.c b/openstack/02a-MAClow/IEEE802154E.c
index 76e7ee56..83de4296 100644
index 8e51a7e8..e8e3eb90 100644
--- a/openstack/02a-MAClow/IEEE802154E.c
+++ b/openstack/02a-MAClow/IEEE802154E.c
@@ -19,6 +19,8 @@
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
From a66e2713eb76a1c8b555760f73ce7418312b58d6 Mon Sep 17 00:00:00 2001
From 7e947bc6a84bfbeec42f586352107f77cd4d997f Mon Sep 17 00:00:00 2001
From: Francisco Molina <femolina@uc.cl>
Date: Thu, 4 Jun 2020 15:39:07 +0200
Subject: [PATCH 8/9] drivers/common/openserial: add flag to echo badcrc frames
Subject: [PATCH 08/11] drivers/common/openserial: add flag to echo badcrc
frames

---
drivers/common/openserial.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/common/openserial.c b/drivers/common/openserial.c
index f0dcb19e..2fc2c858 100644
index 8a082722..d0b7dfbb 100644
--- a/drivers/common/openserial.c
+++ b/drivers/common/openserial.c
@@ -733,9 +733,13 @@ port_INLINE void inputHdlcClose(void) {
@@ -748,9 +748,13 @@ port_INLINE void inputHdlcClose(void) {
openserial_vars.inputBufFillLevel -= 2;
} else {
// the CRC is incorrect
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
From cee779033fb652a7e39a1cc03ef4b7a80e6b6f86 Mon Sep 17 00:00:00 2001
From 02e03cdd5e136d7907feb317eb8d4ccee9c472a3 Mon Sep 17 00:00:00 2001
From: Francisco Molina <femolina@uc.cl>
Date: Fri, 24 Jul 2020 15:42:05 +0200
Subject: [PATCH 9/9] inc/check_config: skip checking board, unused in RIOT
Subject: [PATCH 09/11] 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 f50b9e7c..68aea646 100644
index d2f4c967..a1c03d03 100644
--- a/inc/check_config.h
+++ b/inc/check_config.h
@@ -17,7 +17,7 @@
Expand Down
88 changes: 88 additions & 0 deletions pkg/openwsn/patches/0010-inc-config.h-use-kerneldefines.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
From f972dcfd8b8b8ec180bde87b12ab362c917e608f Mon Sep 17 00:00:00 2001
From: Francisco Molina <femolina@uc.cl>
Date: Fri, 30 Oct 2020 15:40:17 +0100
Subject: [PATCH 10/11] inc/config.h: use kerneldefines

---
inc/config.h | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/inc/config.h b/inc/config.h
index 8d2f0e74..fd215d28 100644
--- a/inc/config.h
+++ b/inc/config.h
@@ -1,6 +1,8 @@
#ifndef OPENWSN_CONFIG_H
#define OPENWSN_CONFIG_H

+#include "kernel_defines.h"
+
// =========================== Debugging ============================

/**
@@ -197,7 +199,7 @@
*
*/
#ifndef OPENWSN_CJOIN_C
-#define OPENWSN_CJOIN_C (0)
+#define OPENWSN_CJOIN_C IS_USED(MODULE_OPENWSN_CJOIN)
#endif

// ======================= OpenWeb configuration =======================
@@ -211,7 +213,7 @@
*
*/
#ifndef OPENWSN_COAP_C
-#define OPENWSN_COAP_C (0)
+#define OPENWSN_COAP_C IS_USED(MODULE_OPENWSN_COAP)
#endif


@@ -224,7 +226,7 @@
*
*/
#ifndef OPENWSN_UDP_C
-#define OPENWSN_UDP_C (0)
+#define OPENWSN_UDP_C IS_USED(MODULE_OPENWSN_UDP)
#endif

/**
@@ -239,7 +241,7 @@
*
*/
#ifndef OPENWSN_6LO_FRAGMENTATION_C
-#define OPENWSN_6LO_FRAGMENTATION_C (0)
+#define OPENWSN_6LO_FRAGMENTATION_C IS_USED(MODULE_OPENWSN_6LO_FRAGMENTATION)
#endif

#if OPENWSN_6LO_FRAGMENTATION_C
@@ -257,7 +259,7 @@
* Enables the icmpv6 echo (ping) functionality
*/
#ifndef OPENWSN_ICMPV6ECHO_C
-#define OPENWSN_ICMPV6ECHO_C (0)
+#define OPENWSN_ICMPV6ECHO_C IS_USED(MODULE_OPENWSN_ICMPV6_ECHO)
#endif


@@ -269,7 +271,7 @@
* Requires: OPENWSN_CJOIN_C, OPENWSN_COAP_C, OPENWSN_UDP_C
*/
#ifndef OPENWSN_IEEE802154E_SECURITY_C
-#define OPENWSN_IEEE802154E_SECURITY_C (0)
+#define OPENWSN_IEEE802154E_SECURITY_C IS_USED(OPENWSN_IEEE802154E_SECURITY)
#endif


@@ -318,7 +320,7 @@
* - MSF_LIM_NUMCELLSUSED_LOW: if cell usage is below this value, trigger 6P to remove a single cell to the selected parent
*/
#ifndef ADAPTIVE_MSF
-#define ADAPTIVE_MSF (0)
+#define ADAPTIVE_MSF IS_USED(MODULE_OPENWSN_ADAPTIVE_MSF)
#endif

#if ADAPTIVE_MSF
--
2.28.0

Loading