

I think I’ve finally turned a corner with embedded Rust, I tricked a Pi Pico 2 into playing NSF files!
I’m scared of how many thousands of lines of code the NES emulator I had to write was, and for a while it felt like it was never going to be fast enough to run on a 150MHz processor, but some optimization that was within run-to-run variance on the benchmarks on my laptop must have really favoured the pico 2, and now there’s no dropouts!
Lessons learned:
- as far as I can tell, if you overflow stack on these microcontrollers you won’t get a fancy stack overflow error, it will just hard fault (although I suspect sometimes it won’t even fault and will just give you fun UB). Lost a day to that.
- goddamn lifetimes and statics and interior mutability etc. caused me so much grief. There’s a crate called
embedded_allocwhich gives you access toRc,Arc,Vec, etc by actually letting you define a heap. I highly recommend this although remember that when aVecneeds to grow it needs 3x it’s previous size in memory, because it creates a newVecwith 2x previous capacity, copies from the oldVec, then drops it. - I didn’t end up using both cores (yet) but Embassy doesn’t appear to support the doorbell IRQs or the inter-core FIFO queues, so if you want those you need to use
rp-hal. - The embedded-sdmmc library certainly takes some getting used to. You need to implement long file name support yourself, no file sorting (do it yourself but use a master branch), use RawFile instead of File because it seems to be so ready to drop my files when I look the other way, etc.



if it helps I think you’re a genuinely kind person and I enjoy spending time with you. You have value and belong here