swift-embedded-examples
swift-embedded-examples copied to clipboard
`pico-blink-sdk` can't find Pico W headers
When I add #include "pico/cyw43_arch.h" (header used in picow_blink.c in upstream pico-examples) to BridgingHeader.h and reconfigure with cmake -DPICO_BOARD=pico_w -B build -G Ninja . that runs fine, I see this output from CMake:
PICO platform is rp2040.
Build type is Release
Using PICO_BOARD from environment ('pico_w')
Using CMake board configuration from pico-sdk/src/boards/pico_w.cmake
Using board configuration from pico-sdk/src/boards/include/boards/pico_w.h
TinyUSB available at pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040; enabling build support for USB.
BTstack available at pico-sdk/lib/btstack
cyw43-driver available at pico-sdk/lib/cyw43-driver
Pico W Bluetooth build support available.
lwIP available at pico-sdk/lib/lwip
Pico W Wi-Fi build support available.
But when I try to build with cmake --build build it can't find any of the headers specific to Pico W:
BridgingHeader.h:15:10: error: 'pico/cyw43_arch.h' file not found
13 |
14 | #include "pico/stdlib.h"
15 | #include "pico/cyw43_arch.h"
| `- error: 'pico/cyw43_arch.h' file not found
I tried adding include paths manually:
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/_swiftcode.o
COMMAND
${SWIFTC}
-target armv6m-none-none-eabi -Xcc -mfloat-abi=soft -Xcc -fshort-enums
-Xfrontend -function-sections -enable-experimental-feature Embedded -wmo -parse-as-library
$$\( echo '$<TARGET_PROPERTY:swift-blinky,INCLUDE_DIRECTORIES>' | tr '\;' '\\n' | sed -e 's/\\\(.*\\\)/-Xcc -I\\1/g' \)
$$\( echo '${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}' | tr ' ' '\\n' | sed -e 's/\\\(.*\\\)/-Xcc -I\\1/g' \)
-I$ENV{PICO_SDK_PATH}/src/rp2_common/pico_cyw43_arch/include
-I$ENV{PICO_SDK_PATH}/src/rp2_common/pico_cyw43_driver/include
-I$ENV{PICO_SDK_PATH}/src/rp2_common/pico_async_context/include/
-I$ENV{PICO_SDK_PATH}/lib/cyw43-driver/src
-I$ENV{PICO_SDK_PATH}/lib/lwip/src/include
-I$ENV{PICO_SDK_PATH}/lib/lwip/contrib/ports/unix/lib
-I$ENV{PICO_SDK_PATH}/lib/lwip/contrib/ports/unix/port/include
-import-bridging-header ${CMAKE_CURRENT_LIST_DIR}/BridgingHeader.h
${CMAKE_CURRENT_LIST_DIR}/Main.swift
-c -o ${CMAKE_CURRENT_BINARY_DIR}/_swiftcode.o
DEPENDS
${CMAKE_CURRENT_LIST_DIR}/BridgingHeader.h
${CMAKE_CURRENT_LIST_DIR}/Main.swift
)
but this seems wrong, as picow_blink from pico-examples doesn't seem to be doing this and gets its include paths seemingly automatically.
It also doesn't help anyway as in the end I get this error:
pico-sdk/src/rp2_common/pico_cyw43_arch/include/pico/cyw43_arch.h:30:2: error: must specify support pico_cyw43_arch architecture type or set PICO_CYW43_ARCH_HEADER
28 | #include "pico/cyw43_arch/arch_freertos.h"
29 | #else
30 | #error must specify support pico_cyw43_arch architecture type or set PICO_CYW43_ARCH_HEADER
| `- error: must specify support pico_cyw43_arch architecture type or set PICO_CYW43_ARCH_HEADER
31 | #endif
32 | #endif