apple / swift-embedded-examples

A collection of example projects using Embedded Swift
Apache License 2.0
732 stars 49 forks source link

cannot use various network c functions like cyw43_arch_wifi_connect_timeout_ms #18

Closed willswire closed 5 months ago

willswire commented 5 months ago

I'm trying to get some basic network functionality working, and running into trouble. I've built the wifi modules in pico-examples for pico_w to verify my dev setup, but when pulling over some of that code into Swift, I'm having trouble.

I suspect the issue is with the CMakeLists.txt file, although I'm not sure.

I've modified the necessary target link library entry to properly set CYW43_LWIP, but now I'm getting other errors:

In file included from /Users/willwalker/Developer/pico-swift/pico-sdk/lib/lwip/src/core/mem.c:59:
/Users/willwalker/Developer/pico-swift/pico-sdk/lib/lwip/src/include/lwip/sys.h:95:10: fatal error: arch/sys_arch.h: No such file or directory
   95 | #include "arch/sys_arch.h"
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
[84/180] Building C object CMakeFiles/swift-pico.dir/pico-sdk/lib/tinyusb/src/common/tusb_fifo.c.obj
ninja: build stopped: subcommand failed.

Here is my full project: https://github.com/willswire/pico-swift/tree/implement-networking

willswire commented 5 months ago

I just needed to update my lwipopts.h!

https://github.com/willswire/swift-pico/blob/4a3fb6ed1f00ba3e6b5f1b7083aebd579babc4db/include/lwipopts.h