From 145986dbc3c3563de2170daadf2df950ba82a3c6 Mon Sep 17 00:00:00 2001 From: Alexander Bushnev Date: Mon, 2 Dec 2024 18:33:36 +0100 Subject: [PATCH] Add cmake configurations, fix bugs --- examples/rpi_pico_w/CMakeLists.txt | 30 ++++++++++++++----- examples/rpi_pico_w/main.c | 2 -- extra_script.py | 5 ++++ .../zenoh-pico/system/platform/rpi_pico_w.h | 6 ++-- src/system/rpi_pico_w/network.c | 4 --- 5 files changed, 30 insertions(+), 17 deletions(-) diff --git a/examples/rpi_pico_w/CMakeLists.txt b/examples/rpi_pico_w/CMakeLists.txt index 5c5517825..fc5995db2 100644 --- a/examples/rpi_pico_w/CMakeLists.txt +++ b/examples/rpi_pico_w/CMakeLists.txt @@ -1,5 +1,24 @@ cmake_minimum_required(VERSION 3.13) +# Set options +set(WIFI_SSID "" CACHE STRING "WiFi SSID") +set(WIFI_PASSWORD "" CACHE STRING "WiFi Password") + +set(ZENOH_CONFIG_MODE "client" CACHE STRING "ZENOH_CONFIG_MODE") +set(ZENOH_CONFIG_CONNECT CACHE STRING "ZENOH_CONFIG_CONNECT") +set(ZENOH_CONFIG_LISTEN CACHE STRING "ZENOH_CONFIG_LISTEN") + +message(STATUS "WIFI_SSID: ${WIFI_SSID}") +if(WIFI_PASSWORD STREQUAL "") + message(STATUS "WIFI_PASSWORD is empty") +else() + message(STATUS "WIFI_PASSWORD is set") +endif() + +message(STATUS "ZENOH_CONFIG_MODE: ${ZENOH_CONFIG_MODE}") +message(STATUS "ZENOH_CONFIG_CONNECT: ${ZENOH_CONFIG_CONNECT}") +message(STATUS "ZENOH_CONFIG_LISTEN: ${ZENOH_CONFIG_LISTEN}") + set(CMAKE_C_STANDARD 11) # Include Raspberry Pico SDK @@ -12,13 +31,6 @@ include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake) # Include FreeRTOS SDK include(FreeRTOS_Kernel_import.cmake) -# Ignore warnings from FreeRTOS code -set_source_files_properties( - ${FREERTOS_KERNEL_PATH}/portable/ThirdParty/GCC/RP2040/include/portmacro.h - PROPERTIES - COMPILE_OPTIONS "-Wno-strict-prototypes" -) - # Configure project project(zenohpico_rpi_pico_w_examples C CXX ASM) @@ -55,7 +67,9 @@ target_include_directories(zenohpico_static PRIVATE target_compile_definitions(zenohpico_rpi_pico_w_examples PRIVATE WIFI_SSID=\"${WIFI_SSID}\" WIFI_PASSWORD=\"${WIFI_PASSWORD}\" - CYW43_TASK_STACK_SIZE=4096 + ZENOH_CONFIG_MODE=\"${ZENOH_CONFIG_MODE}\" + ZENOH_CONFIG_CONNECT=\"${ZENOH_CONFIG_CONNECT}\" + ZENOH_CONFIG_LISTEN=\"${ZENOH_CONFIG_LISTEN}\" ) target_include_directories(zenohpico_rpi_pico_w_examples PRIVATE ${CMAKE_CURRENT_LIST_DIR} diff --git a/examples/rpi_pico_w/main.c b/examples/rpi_pico_w/main.c index 287cbe7cb..7a36ca6b5 100644 --- a/examples/rpi_pico_w/main.c +++ b/examples/rpi_pico_w/main.c @@ -28,13 +28,11 @@ void main_task(__unused void *params) { printf("Connected.\n"); } - // cyw43_arch_lwip_begin(); app_main(); printf("Terminate.\n"); - // cyw43_arch_lwip_end(); cyw43_arch_deinit(); diff --git a/extra_script.py b/extra_script.py index dc4332e65..1e519cb3e 100644 --- a/extra_script.py +++ b/extra_script.py @@ -26,6 +26,7 @@ "-", "-", "-", + "-", "-", "-", "-", @@ -42,6 +43,7 @@ "-", "-", "-", + "-", "-", "-", "-", @@ -58,6 +60,7 @@ "-", "-", "-", + "-", "-", "-", "-", @@ -72,6 +75,7 @@ "-", "-", "-", + "-", "-", "-", "-", @@ -87,6 +91,7 @@ "-", "-", "-", + "-", "-", "-", "-", diff --git a/include/zenoh-pico/system/platform/rpi_pico_w.h b/include/zenoh-pico/system/platform/rpi_pico_w.h index 4a50bd6b6..4a149d74b 100644 --- a/include/zenoh-pico/system/platform/rpi_pico_w.h +++ b/include/zenoh-pico/system/platform/rpi_pico_w.h @@ -11,8 +11,8 @@ // Contributors: // ZettaScale Zenoh Team, -#ifndef ZENOH_PICO_SYSTEM_FREERTOS_PLUS_TCP_TYPES_H -#define ZENOH_PICO_SYSTEM_FREERTOS_PLUS_TCP_TYPES_H +#ifndef ZENOH_PICO_SYSTEM_RPI_PICO_W_TYPES_H +#define ZENOH_PICO_SYSTEM_RPI_PICO_W_TYPES_H #include "FreeRTOS.h" #include "event_groups.h" @@ -71,4 +71,4 @@ typedef struct { } #endif -#endif +#endif // ZENOH_PICO_SYSTEM_RPI_PICO_W_TYPES_H diff --git a/src/system/rpi_pico_w/network.c b/src/system/rpi_pico_w/network.c index 2eccea503..1f45443aa 100644 --- a/src/system/rpi_pico_w/network.c +++ b/src/system/rpi_pico_w/network.c @@ -146,11 +146,7 @@ size_t _z_read_exact_tcp(const _z_sys_net_socket_t sock, uint8_t *ptr, size_t le } size_t _z_send_tcp(const _z_sys_net_socket_t sock, const uint8_t *ptr, size_t len) { -#if defined(ZENOH_LINUX) - return (size_t)send(sock._fd, ptr, len, MSG_NOSIGNAL); -#else return send(sock._fd, ptr, len, 0); -#endif } #endif