5

For doing bare metal programming, it would be really useful if there was a software emulator for the Raspberry Pi which I could use for debugging and inspection of state. Does such a thing exist?

I've seen some people using qemu with a custom kernel to run Raspbian on the versatilepb platform. But that's not the same thing, because that's not emulating the Raspberry Pi hardware --- it's merely emulating a similar but different ARM board. I need something which actually thinks it's a Pi.

  • I'm guessing the no here has to do with the proprietary nature of the hardware. The only people who could create such an emulator would be Broadcom, and they aren't going to do that. However, the processor is an implementation of a broader standard (ARM 1176), so to the extent that this is not good enough for your purposes you might want to step back and consider the XY problem. If there's no more to it than what you've said here, there is no X therefore you can discard Y. – goldilocks Dec 6 '15 at 23:43
  • What sort of software programming? Apart from the GPIO and the GPU etc implementation, you should be able to simulate it close enough for some programming. – Wilf Dec 7 '15 at 0:21
  • It's all the fiddly bootup stuff, setting up the page tables, configuring devices, making sure the UART is hooked up to interrupts properly, etc. I.e. all the platform-specific stuff which emulating another platform won't help with. – David Given Dec 7 '15 at 0:23
  • 1
    I find it hard to believe the page tables aren't part of the ISA...but then I don't have much of a hat to eat here. – goldilocks Dec 7 '15 at 1:52
  • 2
    You might wanna go through this thread. raspberrypi.org/forums/viewtopic.php?f=72&t=26561 Torlus' qemu branch allows you to emulate Raspi platform without any modification in kernel or rootfs. I was having trouble while running the latest images and kernel with it, but it works fine with older wheezy images and suitable kernel. If you want to go deeper, this could be the first step. Happy hacking. :) – dhruvvyas90 Dec 7 '15 at 5:17
8

QEMU supports a platform called "raspi2" directly since version 2.6 at least. I believe work is ongoing to refine the support for all Pi models including the RPi3. Currently , only older Raspbian images and Windows IoT Core are partially supported.

http://wiki.qemu.org/ChangeLog/2.6

  • 1
    I've tried this out and it works fine --- it's already been invaluable for developing my test program. It seems to support both the Pi and the Pi 2, although figuring out which you have is a bit hard because it doesn't appear to support ATAGS on boot, but I can work round that easily enough. Thanks very much! – David Given Dec 7 '15 at 23:37
  • Very nice... Is there also a download that is already compiled? – Thomas Weller Mar 31 '16 at 19:15
  • Think I found a compiled one, at least for earlier models: sourceforge.net/projects/rpiqemuwindows/?source=typ_redirect – Thomas Weller Mar 31 '16 at 22:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.