In software development, the client usually supplies a specification sheet — listing what functions the software should perform in the finished product. In this case, the instructions from the editorial board here at Elektor was pretty basic — "Make it so…"
Fair enough but before any work can begin it’s always helpful to get a basic specification of what expected from the software.
It turned out that what was needed was a Linux application running on a Raspberry Pi to provide control for some FM radio hardware and also to display RDS information if it is available in the received signal. It goes without saying that it needs to be finished by… yesterday.
At this point, I chose to implement the project using the Qt framework. Qt is available under a dual-licensing model, as the source code will be open source, I did not need to decide between GPL and commercial versions of Qt. Using the GPL version, you can even build applications that don’t use open source code — it is advisable to study the terms of the license agreement for Qt more closely. The commercial Qt license includes additional tools useful for embedded applications.
Qt is a cross-platform frameworkthat can be used to create applications in C ++/QML that ideally run on multiple platforms based on common code. This includes the usual suspects such as Windows, Linux, Android, iOS, QNX and some embedded Linux variants. Using this framework saves work in a number of places since you don’t have to bother about the peculiarities of different operating systems. In addition to the many other libraries available in the framework, those designed for GUI use are especially helpful for speedy code development. What is generally true of the framework is also applicable to the Raspberry Pi; my own experience based on the use of Qt for some previous projects (from a console application up to a small GUI tool) has demonstrated its usefulness. The elegant thing about Qt is that the experience gained in developing various projects say for the RPi is transferrable to any of the other supported platforms.
A fresher frameworkWhole books could be devoted to describing the Qt framework. This applies to many aspects of the system such as operation of the tools, development of applications and the design of graphical user interfaces. You could begin by installing a ready-made version of Qt directly on the RPi environment. This may seem like the obvious path to take but this version of Qt is now over two years old. In the world of software that time span roughly equates to two millennia. The alternative is the classic CIY (Compile It Yourself). With the benefits of all the latest security updates and patches it is always preferable, where possible, to use the most up to date version available.
The Qt framework also includes Qt creator. This useful tool just gets better with each new version. Earlier versions have proved to be a little buggy. Qt Creator also runs on the RPi, but RAM and access to the display is limited and the version is now quite old. You can build a Qt environment yourself using the latest PC version. This will allow you to develop RPi applications that do not use specialities of the RPi hardware to directly compile on a PC and test it there. With just one click and the right settings, you can then copy the software that you developed and tested on a PC to the RPi and run it there. This works well and allows remote code debugging, breakpoint setting and display of program variables.
Instructions (to code Nirvana)Online tutorials and You Tube ‘how-to’s are where many people start when considering installing a new programming environment. This path can often be frustrating if you get stuck somewhere, because a step has been glossed over or maybe you’ve missed one setting or suddenly realise that the tutorial was written for an earlier version of RPi's operating system and gives problems with the latest version. To make things a whole lot easier I’ve written a manual describing the steps necessary to set up Qt for the Raspberry Pi running in a cross-compiler development environment on a PC.
Since the latter is easier running under Linux, the Ubuntu PC Operating system is used. Don’t worry: you won’t need to buy an extra PC just for RPi development (the problem here is often not a question of the additional expense but more about desk space availability). All you need is to run a virtual machine (VirtualBox) on your PC which will use up about 60 GB of space on your hard drive.
In addition to setting up the environment, a small demo program is also described as an example to test the setup. You can also load the FM radio project into Qt and see how the different parts work together. This guide should be a starting point and show how to work with all the various tools — without needing to worry about and the setup of important details.
Elektor StoreFM Radio HAT PCB for the RPi (160520-1 V2.0)
➔ Do you want to read more ElektorLabs articles? Become an Elektor member now!