Setting Up the Environment

To start working with an embedded system, we need to set up an environment. Unlike the environment we use for desktop development, the environment for embedded programming requires two systems:

  • A build system: The system you use to write the code
  • A target system: The system your code is going to be run on

In this chapter, we will learn how to set up these two systems and connect them together. Configurations of build systems may vary significantly— there may be different operating systems, compilers, and IDEs. The variance in target system configurations is even greater since each embedded system is unique. Moreover, while you can use your laptop or desktop as a build system, you do need some sort of embedded board as a target system.

It would be impossible to cover all the possible combinations of build and target systems. Instead, we will just learn how to use one popular configuration:

  • Ubuntu 18.04 as the build system
  • Raspberry Pi as the target system

We will use Docker to run Ubuntu in a virtual environment on your laptop or desktop. Docker supports Windows, macOS, and Linux, but, if you already use Linux, you can use it directly without running a container on top of it.

We will use Quick EMUlator (QEMU) to emulate the Raspberry Pi board. This will teach us how to build applications for embedded boards even without access to the real hardware. Carrying out the initial phases of development in an emulated environment is common and, in many cases, the only possible practical solution, given that the target hardware may not be available when the software development starts.

This chapter will cover the following topics:

  • Setting up the build system in a Docker container
  • Working with emulators
  • Cross-compilation
  • Connecting to an embedded system
  • Debugging embedded applications
  • Using gdbserver for remote debugging
  • Using CMake as a build system
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.96.247