Skip to content

Commit

Permalink
Add cmake configurations, fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
sashacmc committed Dec 2, 2024
1 parent a928f30 commit 145986d
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 17 deletions.
30 changes: 22 additions & 8 deletions examples/rpi_pico_w/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)

Expand Down Expand Up @@ -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}
Expand Down
2 changes: 0 additions & 2 deletions examples/rpi_pico_w/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
5 changes: 5 additions & 0 deletions extra_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"-<system/emscripten/>",
"-<system/espidf/>",
"-<system/freertos_plus_tcp/>",
"-<system/rpi_pico_w/>",
"-<system/mbed/>",
"-<system/unix/>",
"-<system/flipper/>",
Expand All @@ -42,6 +43,7 @@
"-<system/emscripten/>",
"-<system/espidf>",
"-<system/freertos_plus_tcp/>",
"-<system/rpi_pico_w/>",
"-<system/mbed/>",
"-<system/unix/>",
"-<system/flipper/>",
Expand All @@ -58,6 +60,7 @@
"-<system/emscripten/>",
"-<system/espidf>",
"-<system/freertos_plus_tcp/>",
"-<system/rpi_pico_w/>",
"-<system/mbed/>",
"-<system/unix/>",
"-<system/flipper/>",
Expand All @@ -72,6 +75,7 @@
"-<system/arduino/>",
"-<system/emscripten/>",
"-<system/freertos_plus_tcp/>",
"-<system/rpi_pico_w/>",
"-<system/mbed/>",
"-<system/unix/>",
"-<system/flipper/>",
Expand All @@ -87,6 +91,7 @@
"-<system/emscripten/>",
"-<system/espidf/>",
"-<system/freertos_plus_tcp/>",
"-<system/rpi_pico_w/>",
"-<system/unix/>",
"-<system/flipper/>",
"-<system/windows/>",
Expand Down
6 changes: 3 additions & 3 deletions include/zenoh-pico/system/platform/rpi_pico_w.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
// Contributors:
// ZettaScale Zenoh Team, <[email protected]>

#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"
Expand Down Expand Up @@ -71,4 +71,4 @@ typedef struct {
}
#endif

#endif
#endif // ZENOH_PICO_SYSTEM_RPI_PICO_W_TYPES_H
4 changes: 0 additions & 4 deletions src/system/rpi_pico_w/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 145986d

Please sign in to comment.