So raspberry pi Pico W support in rust isn't ready yet. W being the version with a wifi chip on it. The project I wanted to make needs wifi, so I either need to:
- Work on pure rust wifi support from the ground up
- Switch to c or cpp (ew), or
- Try to link in a c static lib and call it from rust.
3 is probably what I'll try to do for now, though I like the idea of trying to improve 1.
Well, idea 3 is going quite badly. After battling cmake for ages, I finally got a static lib that contained at least part of the objs I need. But now I'm encountering a ton of undefined symbol errors and don't know where to get the implementations of things like puts and _bss_start and other stuff.
Another thing I'm worrying about is the wifi firmware is like 224kb, out of 264kb I have available in ram. The driver stores this thing as a static ram allocation. I'll end up with almost no ram left over. Honestly not sure how to deal with this. Why doesn't the firmware get stored in flash and there's a way to load it from flash and send it to the chip at initialization time?
Despite all odds, I feel like I made some progress. Most of the missing symbols were from stuff added in a linker script, so I had to do some reading about how those work. Involved a lot of modifications to memory.x while comparing to a standard Pico link script and link.x.
Then had to provide stub implementations of puts, putchar, etc for now. Finally had to map the firmware image somewhere into flash. Eventually did get this to build and deploy, but now the program doesn't seem to be actually running on the pico, so I'll have to do some incremental changes to a working build of something else to see where I messed it up.
Last night I had mostly given up hope. Tonight some hope has returned.