Skip to content

Commit

Permalink
support for integration as a west module in zephyr (#395)
Browse files Browse the repository at this point in the history
Integrate zenoh as a west module and enable adding zenoh as a library
using kconfig.

This will allows easier integration with zephyr by including in the west
manifest (west.yml), i.e.:

@@ -2,7 +2,13 @@ manifest:
   remotes:
     - name: upstream
       url-base: https://github.com/zephyrproject-rtos
+    - name: zenoh
+      url-base: https://github.com/eclipse-zenoh
   projects:
+    - name: zenoh-pico
+      revision: main
+      path: external/zenoh-pico
+      remote: zenoh
     - name: canopennode
       revision: dec12fa3f0d790cafa8414a4c2930ea71ab72ffd
       path: modules/lib/canopennode

and then enabling the publication example with:

CONFIG_ZENOH_PICO=y
CONFIG_ZENOH_PICO_LINK_SERIAL=y
CONFIG_ZENOH_PICO_PUBLICATION=y

application can then be built with west:

west build -b reel_board zephyr/samples/publication

Signed-off-by: Anas Nashif <[email protected]>
  • Loading branch information
nashif authored Apr 6, 2024
1 parent 3511b3d commit d0b07f8
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 2 deletions.
46 changes: 46 additions & 0 deletions zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
if(CONFIG_ZENOH_PICO)

zephyr_compile_definitions(ZENOH_ZEPHYR)
zephyr_include_directories(../include)
zephyr_library()

function(configure_zenoh_feature config)
string(REPLACE CONFIG_ZENOH_PICO Z_FEATURE feature ${config})
if(${config})
zephyr_compile_definitions(${feature}=1)
else()
zephyr_compile_definitions(${feature}=0)
endif()
endfunction()


configure_zenoh_feature(CONFIG_ZENOH_PICO_LINK_SERIAL)
configure_zenoh_feature(CONFIG_ZENOH_PICO_MULTI_THREAD)
configure_zenoh_feature(CONFIG_ZENOH_PICO_PUBLICATION)
configure_zenoh_feature(CONFIG_ZENOH_PICO_SUBSCRIPTION)
configure_zenoh_feature(CONFIG_ZENOH_PICO_QUERY)
configure_zenoh_feature(CONFIG_ZENOH_PICO_QUERYABLE)
configure_zenoh_feature(CONFIG_ZENOH_PICO_RAWETH_TRANSPORT)
configure_zenoh_feature(CONFIG_ZENOH_PICO_LINK_TCP)
configure_zenoh_feature(CONFIG_ZENOH_PICO_LINK_UDP_UNICAST)
configure_zenoh_feature(CONFIG_ZENOH_PICO_LINK_UDP_MULTICAST)
configure_zenoh_feature(CONFIG_ZENOH_PICO_SCOUTING_UDP)
configure_zenoh_feature(CONFIG_ZENOH_PICO_LINK_WS)


file(GLOB_RECURSE Sources
"../src/api/*.c"
"../src/collections/*.c"
"../src/deprecated/*.c"
"../src/link/*.c"
"../src/net/*.c"
"../src/protocol/*.c"
"../src/session/*.c"
"../src/transport/*.c"
"../src/utils/*.c"
)

file (GLOB Sources_Zephyr "../src/system/zephyr/*.c")
list(APPEND Sources ${Sources_Zephyr})
zephyr_library_sources(${Sources})
endif()
69 changes: 69 additions & 0 deletions zephyr/Kconfig.zenoh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
config ZENOH_PICO
bool "Zenoh PICO library"
help
Enable Zenoh pico support

if ZENOH_PICO

config ZENOH_PICO_LINK_SERIAL
bool "Serial Link"
help
Use serial link

config ZENOH_PICO_MULTI_THREAD
bool "Multithreading support"
help
Multithreading support

config ZENOH_PICO_PUBLICATION
bool "Publication Support"
help
Publication support

config ZENOH_PICO_SUBSCRIPTION
bool "Subscription Support"
help
Subscription Support

config ZENOH_PICO_QUERY
bool "Query Support"
help
Query Support

config ZENOH_PICO_QUERYABLE
bool "Queryable Support"
help
Queryable Support

config ZENOH_PICO_RAWETH_TRANSPORT
bool "Raw Ethernet Support"
help
Raw Ethernet Support

config ZENOH_PICO_LINK_TCP
bool "TCP Link"
help
TCP Link

config ZENOH_PICO_LINK_UDP_UNICAST
bool "UDP Unicast"
help
UDP Unicast

config ZENOH_PICO_LINK_UDP_MULTICAST
bool "UDP Multicast"
help
UDP Multicast

config ZENOH_PICO_SCOUTING_UDP
bool "Scouting UDP"
help
Scouting UDP

config ZENOH_PICO_LINK_WS
bool "WS Link"
help
WS Link

endif

4 changes: 2 additions & 2 deletions zephyr/module.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: zenoh-pico
build:
cmake-ext: True
kconfig-ext: True
cmake: zephyr/
kconfig: zephyr/Kconfig.zenoh

0 comments on commit d0b07f8

Please sign in to comment.