2

How do you develop for the Raspberry Pi. I'd rather use my own laptop but this speed comparison leads me to believe most developers get one or twe RPi and just develop directly on the device: How does speed of QEMU emulation compare to a real Raspberry Pi board?

I'd like to stay portable to I can do some RPi coding in my lunch hour. Is this an option?

What are my options?

  • can I plug a RPi into my MacBook pro?
  • can I emulate an Raspberry pi 2 as fast or faster than a physical one ?
  • can I cross compile? (is it any faster? And if do cross compile how do debug? on a RPi or on an emulator?
  • assuming I can't 'plug a RPi into my MacBook pro', and emulation is too slows: how do developers 'go mobile' with aO
4
  • What language are you planning on doing development in? What kind of software are you planning on writing?
    – ThomasW
    Commented Mar 3, 2015 at 2:13
  • C/c++ initially, Racket later
    – Stephen
    Commented Mar 3, 2015 at 8:37
  • OSX and linux are both (mostly) POSIX compliant, so you should be able to write C/C++ code using a normal IDE on your laptop and deploy it on the pi later. If you are using something linux specific (such as the smbus API for I2C devices), you might be able to import the appropriate headers somewhere. It won't then compile and run on the laptop, which may perplex some of the IDE's error tracking.
    – goldilocks
    Commented Mar 3, 2015 at 14:21
  • QEMU cant handle more than 256mb RAM currently for ARM and might cause more problems. If RAM is not a problem then yes, QEMU will increase compile time but sometimes things go wrong with complex compilations. Cross compiling is a bit of a nightmare. Repositories get compiled using special ARM devices with quad or octa core processors and dedicated RAM... because allot of weird things happen during cross compilation.
    – Piotr Kula
    Commented Mar 18, 2015 at 20:10

3 Answers 3

3

If you were looking to go mobile, SSH or VNC are the best options for working without a separate monitor. Both of these require the Mac and the Pi to be connected to the same WIFI/Ethernet network, however I have read somewhere you can directly attach them with an Ethernet cable. Something worth looking up.

SSH is the best option if you are only using the command line. The SSH server is already installed on the Pi, you just have to enable it. As you have a Mac, a SSH client should be built into the command line of your computer. The Raspberry Pi website has instructions for using SSH with the Pi. See here.

VNC however is suited if you wish to use the graphical desktop of the Pi. There is a client that can be used with the RPi already installed, however this takes some time to set up and an external application is recommended. The VNC server will also need installing/setting up on the Pi. For instructions on setting up the server on the RPi, see here. For information on setting up the Mac client, see the mac link at the bottom of the page.

Also, in case you were wandering, I use my Pi connected to a TV, however I have tried VNC and SSH out.

I hope this helps!

3
  • 1
    None of the mentioned approaches require both the Mac and the Pi to be "on the same network". They actually could be in different LANs and still be connected if those networks are routable. This may require some port forwarding on the LAN-WAN routing equipment thought. Also, ssh can pretty well forward X (the GUI for that matter), it just requires a X server running both on the client and the host. But I admit that setting up VNC is usually easier.
    – Ghanima
    Commented Mar 3, 2015 at 8:34
  • That is correct, it is possible. However since he is at work I assumed the pi and the MacBook will be connected to the same network so I did not explain these possibilities. Commented Mar 3, 2015 at 8:53
  • And all of them still need the two devices to be connected to a network. Or by Ethernet cable, as I said. Commented Mar 3, 2015 at 8:58
2

Defining what a decent speed is is not possible. Perhaps for the type of development and for the need when testing the developed software, a qemu VM is perfect for you. Just try it and see for yourself if the time it takes is acceptable or not.

Then depending on the type of development you want to do, portability might be an issue or not. What is your programming language? If it's C it might be less portable than if it's Python. Then what 3rd party library do you plan to use? Are they portable?

So depending on what you do, you could develop it on your laptop without qemu, directly under your OS of choice (Linux, OS X or even Windows) and then test it either in qemu or a real RPi. Even for C development it is possible to cross-compile it from a x86_64 machine to run on a ARM board.

Only limitations you could encounter is when you want to use really specific RPi interfaces which you can't emulate (or have the same library to interface to them) on your laptop, such as the GPIO pins, SPI bus, etc.

So your question is too vague to have 1 answer. It all depends of what you want to do and how you are going to do it and how you are going to test it.

1
  • 1
    I agree, 'Decent speed' is a poor choice of words- I should have said 'as fast or faster than a rpi2'
    – Stephen
    Commented Sep 2, 2015 at 20:44
0

You can create a local route cycle on your desktop with wired Internet port. All the pi has to do is connect to your computer with that cable. And its up to you to feed the Internet to the pi.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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