diff --git a/extra_script.py b/extra_script.py
index c454607cc..391eb8047 100644
--- a/extra_script.py
+++ b/extra_script.py
@@ -28,7 +28,7 @@
"-",
"-",
"-"]
- CPPDEFINES = ["ZENOH_ZEPHYR", "ZENOH_PIO"]
+ CPPDEFINES = ["ZENOH_ZEPHYR"]
elif FRAMEWORK == 'arduino':
PLATFORM = env.get("PIOPLATFORM")
diff --git a/include/zenoh-pico/system/platform/zephyr.h b/include/zenoh-pico/system/platform/zephyr.h
index ca3924e11..4b318c9d9 100644
--- a/include/zenoh-pico/system/platform/zephyr.h
+++ b/include/zenoh-pico/system/platform/zephyr.h
@@ -15,9 +15,14 @@
#ifndef ZENOH_PICO_SYSTEM_ZEPHYR_TYPES_H
#define ZENOH_PICO_SYSTEM_ZEPHYR_TYPES_H
-#if defined(ZENOH_PIO)
+#include
+
+#if KERNEL_VERSION_MAJOR == 2
#include
+#elif KERNEL_VERSION_MAJOR == 3
+#include
#else
+#pragma "This Zephyr version might not be supported."
#include
#endif
diff --git a/src/system/zephyr/network.c b/src/system/zephyr/network.c
index 0f34432d8..e4bb16a5c 100644
--- a/src/system/zephyr/network.c
+++ b/src/system/zephyr/network.c
@@ -12,7 +12,9 @@
// ZettaScale Zenoh Team,
//
-#if defined(ZENOH_PIO)
+#include
+
+#if KERNEL_VERSION_MAJOR == 2
#include
#else
#include
@@ -242,6 +244,10 @@ size_t _z_send_udp_unicast(const _z_sys_net_socket_t sock, const uint8_t *ptr, s
#endif
#if Z_LINK_UDP_MULTICAST == 1
+#if KERNEL_VERSION_MAJOR == 3 && KERNEL_VERSION_MINOR > 3
+#error \
+ "Zenoh UDP Multicast support is not yet supported in this Zephyr version. To continue with this Zephyr version, disable Z_LINK_UDP_MULTICAST"
+#else
int8_t _z_open_udp_multicast(_z_sys_net_socket_t *sock, const _z_sys_net_endpoint_t rep, _z_sys_net_endpoint_t *lep,
uint32_t tout, const char *iface) {
int8_t ret = _Z_RES_OK;
@@ -531,7 +537,8 @@ size_t _z_send_udp_multicast(const _z_sys_net_socket_t sock, const uint8_t *ptr,
_z_sys_net_endpoint_t rep) {
return sendto(sock._fd, ptr, len, 0, rep._iptcp->ai_addr, rep._iptcp->ai_addrlen);
}
-#endif
+#endif // KERNEL_VERSION_MAJOR == 3 && KERNEL_VERSION_MINOR > 3
+#endif // Z_LINK_UDP_MULTICAST == 1
#if Z_LINK_SERIAL == 1
int8_t _z_open_serial_from_pins(_z_sys_net_socket_t *sock, uint32_t txpin, uint32_t rxpin, uint32_t baudrate) {
diff --git a/src/system/zephyr/system.c b/src/system/zephyr/system.c
index 37c2333f1..2670ae9cb 100644
--- a/src/system/zephyr/system.c
+++ b/src/system/zephyr/system.c
@@ -12,11 +12,11 @@
// ZettaScale Zenoh Team,
//
-#if defined(ZENOH_PIO)
-#include
+#include
+
+#if KERNEL_VERSION_MAJOR == 2
#include
#else
-#include
#include
#endif