Closed scottfeldman closed 4 months ago
Here's a run with tcpecho example:
sfeldma@nuc:~/work/drivers$ tinygo flash -monitor -target pico -size short -ldflags="-X 'main.ssid=test' -X 'main.pass=testtest'" -stack-size=32kb ./examples/net/tcpecho
code data bss | flash ram
429600 16432 5112 | 446032 21544
Connected to /dev/ttyACM0. Press Ctrl-C to exit.
time=1970-01-01T00:00:01.003Z level=INFO msg=Init:start
time=1970-01-01T00:00:02.543Z level=INFO msg=Init:done took=1.538638s
time=1970-01-01T00:00:02.544Z level=INFO msg=joinWpa2 ssid=test len(pass)=8
time=1970-01-01T00:00:05.989Z level=INFO msg=rxEvent event=AUTH status=0 reason=0 flags=0 dev.linkstate=1
time=1970-01-01T00:00:05.990Z level=INFO msg=rxEvent event=SET_SSID status=0 reason=0 flags=0 dev.linkstate=2
MAC: 28:cd:c1:01:13:7c
Link is UP
dhcp ongoing...
GC stats 5
TotalAlloc= 208476 Frees=0 Mallocs=3757 GCSys=3702 Sys= 240608
HeapIdle=28000 HeapInuse=208896 HeapReleased=0 HeapSys= 236896
time=1970-01-01T00:00:06.003Z level=INFO msg=DHCP:tx msg=Discover
time=1970-01-01T00:00:06.049Z level=INFO msg=DHCP:rx msg=Offer
time=1970-01-01T00:00:06.050Z level=INFO msg=DHCP:tx msg=Request
time=1970-01-01T00:00:06.055Z level=INFO msg=DHCP:rx msg=Ack
DHCP complete IP: 10.0.0.170
Interface is UP
1970/01/01 00:00:06 Socket not implemented
Requires changes to tinygo-org/devices and soypat/seqs repos:
https://github.com/tinygo-org/drivers/compare/dev...scottfeldman:cyw43439?expand=1 https://github.com/soypat/seqs/pull/6
Heya Scott. In the end we've taken a different approach to the Netlink interface, namely one that does not require third party interfaces and can depend exclusively on the standard library. Here is the interface the cyw43439.Device type implements, which contains most of the functionality of the Netlink type you proposed
https://github.com/soypat/netif/blob/e7dfef0020a669328a65683e3e6115b4b7426af0/netif.go#L20-L43
Notably there is no async event callbacks, but there is the NetFlags method which can be polled to know of the device's current status. This is more straightforward and in-line with the non-async design of the rest of the methods.
In an effort to get drivers/examples/net example apps to run against cyw43439 + seqs/stack, implement Netlinker interface on cyw43439.
Implement enough to get link UP and get a DHCP IP addr. Socket() on function are not implemented, just stubbed out.