You are here

Bare metal programming

What is bare metal programming?

Bare metal programming is a way to program a computer with a minimalistic set of [software] tools, the name comes from a reverse sentence:  programming on the bare metal [of the processor].

One can find similar definitions here or there

This mainly means that you avoid the use of an operating system and have to handle the discussion with the underlying hardware directly from the [bare metal] user application. This usually implies that bare metal programming is done using a mix low-level programming language like assembler and C language (and the pile of hardware specification documents).

Why programming on the bare metal?

The main arguments for programming on the bare metal are usually:

  1. Quest for maximum speed of execution
  2. Tackle with memory space scarcity issues
  3. Handle things only the way you want

All arguments could be discussed, we (at ONERA) are trying bare metal for a goal which can be considered of the third case: deterministic execution. When programming embedded time critical software like control command software of an airplane or any other vehicle you have to ensure that the WCET (Worst Case Execution Time) of each task can be computed. The computation of WCET is a difficult task even for simple softwares, thus the less you have to analyze the better the result. If we can avoid operating system then may be we will. That's one of the main characteristic of real-time systems the time instant when you obtain the resulat is as important as the validity of the result itself. More details here or in the video.

How to program on the bare metal?

The way to program on the bare metal depends on the metal you are on. There is no general answer to that besides the fact that it usually leads you to some combination of assembler and C code. Several examples are given in the reference below. We are mostly interested in SCC bare metal programming.

Here are some references about bare metal programming in various context