I decided to have a PICO day today. Well that's 8 hours of my life I wont get back struggling with the appalling lack of documentation for the PICO W and its toolkit, and for a piece of software that Poettering would be proud of in terms of its utterly unnecessary complexity, bugs and lack of documentation.
I refer to *cmake*.
I have got the SDK as far as I can tell up and running with LWIP and the various CY_43_ARCH libraries are concerned, and can compile and install code that runs and access GPIO pins and so on, and prints cheerful messages to teh console, but s far as networking is concerned the moment I try and connect to wifi, I get compile errors deep in the stack.
everything works until I add the last line..
#include "pico/stdlib.h" #include "pico/cyw43_arch.h" #include "hardware/adc.h" #include "lwip/tcp.h" #include "lwip/netif.h" #include "lwip/pbuf.h" ...
int ret; stdio_init_all(); if (cyw43_arch_init_with_country(CYW43_COUNTRY_UK)) { printf("Wi-Fi init failed"); return -1; } cyw43_arch_enable_sta_mode(); // doesn't compile ret = cyw43_arch_wifi_connect_timeout_ms(ssid, password, CYW43_AUTH_WPA2_AES_PSK, 10000); ======================================= When the make process barfs with : /opt/pico-sdk/lib/cyw43-driver/src/cyw43_lwip.c: In function 'cyw43_cb_tcpip_init': /opt/pico-sdk/lib/cyw43-driver/src/cyw43_lwip.c:209:5: warning: implicit declaration of function 'netif_set_hostname'; did you mean 'netif_set_down'? [-Wimplicit-function-declaration] 209 | netif_set_hostname(n, CYW43_HOST_NAME); | ^~~~~~~~~~~~~~~~~~ | netif_set_down /opt/pico-sdk/lib/cyw43-driver/src/cyw43_lwip.c: In function 'cyw43_cb_tcpip_deinit': /opt/pico-sdk/lib/cyw43-driver/src/cyw43_lwip.c:252:32: error: 'netif_list' undeclared (first use in this function); did you mean 'netif_find'? 252 | for (struct netif *netif = netif_list; netif != NULL; netif = netif->next) { | ^~~~~~~~~~ | netif_find /opt/pico-sdk/lib/cyw43-driver/src/cyw43_lwip.c:252:32: note: each undeclared identifier is reported only once for each function it appears in /opt/pico-sdk/lib/cyw43-driver/src/cyw43_lwip.c:252:72: error: 'struct netif' has no member named 'next' 252 | for (struct netif *netif = netif_list; netif != NULL; netif = netif->next)
Blah blah blah.
Clearly its not finding a header file,(netif.h) but it's there and on the path.
Currently the magic spells in the CMakefiles.txt are =================================
cmake_minimum_required(VERSION 3.13)
include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)
project(thermometer C CXX ASM)
set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 17) set(PICO_BOARD pico_w)
pico_sdk_init()
add_executable(${PROJECT_NAME} main.c)
pico_add_extra_outputs(${PROJECT_NAME})
target_link_libraries(${PROJECT_NAME} pico_stdlib hardware_adc pico_lwip pico_cyw43_arch_lwip_poll )
pico_enable_stdio_usb(${PROJECT_NAME} 1) pico_enable_stdio_uart(${PROJECT_NAME} 0)
Anyone have any clue how to fix this? Answers of the category 'why not use python?' will be treated with the contempt they deserve.