19 karma · joined December 4, 2022
1) Record & Replay: Record an execution and replay it back. You can even attach GDB while replaying, and go back in time while debugging with "reverse-next" and "reverse-continue": https://qemu-project.gitlab.io/qemu/system/replay.html
2) The QEMU monitor, especially the "gva2gpa" and "xp" commands which are very useful to debug stuff with virtual memory
3) "-d mmu,cpu_reset,guest_errors,unimp": Basically causes QEMU to log when your code does something wrong. Also check "trace:help", there's a bunch of useful stuff to debug drivers
I used an STM32F401 (the "blackpill" board). Shoved it into a gameboy case I got from aliexpress and connected an ILI9341 display, a PCB for the buttons I found online from some hobbist selling them and 4 AA batteries in series. The screen wasn't really the same as the gameboy's one in dimensions so it all looked very janky, but it was cool enough to impress people.
I had no audio, I was able to play simple GB games quite well but I had some significant slowdowns with stuff like Super Mario Land 2 or the later pokemon. I had 3 big problems: - First, I didn't use DMA at all. That's because I picked a display controller with 8 data GPIOs because at the time I thought "8 lines vs 1? its gonna be faster right?". Dumb me, I didn't consider that DMA existed... - Second, I wanted to scale the image to fit the entire screen. I couldn't fit the scaled framebuffer in memory though, so I had to keep the original size but send each pixel to the screen 4 times - Last, I read games from an SD-card. I had a tiny in-memory cache for recently read data blocks, but you could see when I got a cache miss. It wasn't often though so it wasn't bad at all.
I agree, it was an incredibly fun project