• he/him

programming, video games, dadding. I happen to work for Xbox, but don't represent them.


more blog
dev.to/knutaf
discord
knutaf

knutaf
@knutaf

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:

  1. Work on pure rust wifi support from the ground up
  2. Switch to c or cpp (ew), or
  3. 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.


knutaf
@knutaf

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?


knutaf
@knutaf

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.


knutaf
@knutaf

I'm still stuck here. The program builds and deploys, but once I try to call any wifi functionality, it seems to crash. The map file and objdump seem to show the contents of the firmware image in the final binary, so I don't suspect that. I have no way of debugging a crash like this right now. Thinking of buying a second Pico and setting it up as a debugger probe.


You must log in to comment.

in reply to @knutaf's post:

I believe it's the custom wifi driver part. I have the source and firmware for the driver of the wifi chip, but it's all in c. Some people have started writing a rust version but it's pretty early.

in reply to @knutaf's post: