Welcome

Computers are found in many places. We use them in our offices and in our homes, and we carry them in our pockets. Some computers are visible, such as laptops or desktop computers. Many computers are hidden, invisible to us, inside other systems. These built-in computers are referred to as embedded computers.

There are embedded computers in your phone, performing tasks such as making phone calls and helping you to connect to the Internet. There are also embedded computers in your TV, in your car, and most likely also in your washing machine. These types of systems, in which there are embedded computers, are often referred to as embedded systems.

This is a book about embedded systems. It shows you how to do programming for embedded systems. The book assumes that you have some previous experience from programming. The book also assume that you have a basic understanding of how a computer processor works.

Read more

The Bare Metal

As a first step in the development of embedded software, it may be of interest to create and run a simple program. It could also be of interest to create a minimal program, which is possible to run without using an operating system. Performing such an exercise will illustrate the necessary steps for writing, compiling, and executing a program on the chosen hardware platform. It will also, since the goal is to run without an operating system, provide insight into the mechanisms used by the hardware to start a stand-alone, small, program.

The program to be executed is a program, of the Hello World-type. It is written in C, as many embedded programs are, and its source code is shown in Figure 1.

#include "console.h"

int main(void)
{
    console_put_string("Hello from a bare metal C-program!\n"); 
    return 0; 
}

Figure 1. A program to be run on a processor, without any operating system. The program in Figure 1 uses a function console_put_string. The function console_put_string prints a string. The string is given as argument to the function. The actual printing needs to be done so that the user can see the printed string. This can be accomplished by sending the string to an appropriate output unit.

Read more

Hello world

As a first task, we analyse a small Hello world program, written in C. We generate assembly code from the C code, and use the generated assembly code as a way to understand more about the underlying hardware. Our goal is to understand the instruction set for the chosen processor.

Read more