Exploring Simulators and Emulators for Embedded Development
By Jeff Tranter | Wednesday, January 10, 2018
Various tools that can be lumped together under the category of simulators and emulators can be useful during development, especially for embedded systems. A number of products use virtualization to run one operating system on top of another one. This allows you to run Linux on top of Windows, for example, or vice versa.
This is often useful for embedded development where you might want to develop on a Windows desktop, but need to run a cross-compiler or SDK that is only supported under desktop Linux.
Virtualization allows you to run Linux in a virtual machine under Windows, and still have access to other Windows applications. It can also be used to allow you to run a number of different environments, such as multiple Linux distributions or Windows versions, for test purposes. It is even possible to run a virtual machine of an embedded platform.
Thanks to Qt's cross-platform support, a common strategy for embedded development is to start on a desktop platform, often before the embedded hardware is available. You can implement and demonstrate much of the user interface on a desktop, and simulate any necessary hardware interface using simple stubs or interfaces with simulated data. Then, when the embedded hardware becomes available, you can recompile and run the software on the real hardware.
I'll describe a few popular virtualization products in this blog post.
Ubuntu Linux running Qt Creator in a VirtualBox Virtual Machine
VirtualBox (1) is an open source hypervisor for x86 computers, developed by Oracle Corporation. It can run on a number of host operating systems including Linux, macOS, and Windows, and supports running guest virtual machines running Windows, Linux, BSD, OS/2, Solaris, and some other platforms.
VMware, Inc. (2) is a subsidiary of Dell Technologies that sells several virtualization products under the name VMWare. It was the first commercial company to virtualize the x86 architecture. VMware's desktop software runs on Microsoft Windows, Linux, and macOS, and they sell an enterprise version for servers. Most versions of VMWare are commercial products that must be purchased. VMware Workstation Player has reduced functionality as compared to VMWware Workstation, and is free for non-commercial use.
Yocto Linux Running in a QEMU Virtual Machine
QEMU, short for Quick Emulator, (3) is a free and open-source hypervisor that performs hardware virtualization. It emulates CPUs through dynamic binary translation and provides a set of device models, enabling it to run a variety of unmodified guest operating systems. The Yocto embedded framework supports QEMU as an target for building and running an embedded Linux distribution.
Windows Subsystem for Linux (WSL)
The Windows Subsystem for Linux is a feature of Windows 10 that allows you to run native Linux programs directly on Windows, alongside other Windows applications. I covered this in detail an earlier blog post (4).
Qt for Device Creation
The Qt Company's commercial version of embedded Qt, Qt for Device Creation, supports an emulator (5) as one of the target systems you can build for. The emulator runs under VirtualBox.
Virtualization, emulation and simulation can be powerful techniques for reducing your development effort and getting projects completed sooner. In our embedded Qt training classes, we provide students with a virtual machine configured with a desktop Linux image that has Qt, Qt Creator, and a suitable cross-compiler set up for the embedded hardware that we use. This saves significant time in setup and ensures everyone has the same environment, while supporting students who bring along a laptop running Linux, Windows, or macOS.
Read other installments in our Qt Developer's Bag of Tricks series here.