Bare metal embedded software development with & without an RTOS

In this Product How-To article, TI’s Joseph Coombs describes the problems developers have in meeting the strict real-time requirements of embedded systems and how use of the company’s StarterWare set of lightweight OS-independent libraries and utilities will help in designs based on TI’s ARM, DSP and ARM/DSP processors.

Despite the widespread use of high-level operating systems and software in the embedded space, many developers must take a low-level, hands-on approach to meet the strict requirements of real-time systems. In extreme cases, even a real-time operating system (RTOS) may represent unacceptable overhead. Even in more forgiving applications, developers often need low-level software to facilitate using a full OS with a particular embedded platform.

StarterWare is a set of lightweight, OS-independent software libraries and utilities that enable bare metal development on TI’s ARM, ARM + DSP, and DSP-only embedded devices. This article will describe the contents of StarterWare and how they can be used for complete application development with minimal overhead and maximum hardware access. I will also explore how StarterWare can be used in conjunction with an OS to add functionality to an existing application without assuming complete control of the overall system.

StarterWare Overview
The use of high-level software, including full-featured OSes and specialized algorithms, is increasingly ubiquitous in embedded development. In spite of this—or even because of it—access to good, low-level software development tools remains a critical concern.

Even the most sophisticated application relies on a solid foundational layer of software that directly accesses the underlying embedded platform. Conversely, the most demanding embedded applications cannot accept the overhead associated with high-level software stacks; in this case low-level or bare metal software is the only option.

Whether due to tight real-time processing constraints or the simple need for an intermediary between high-level software and embedded hardware, all embedded devices require bare metal software support that satisfies a few key requirements.

First and most obvious, the software must provide direct access to hardware functionality such as CPU interrupts and peripheral I/O with minimal overhead and simple, C-language APIs.

Second, it must minimize its own memory footprint and be modular such that individual developers need only use the bits and pieces that they require. Finally, it must be OS-independent; the same software should be usable in embedded Linux device drivers and stand-alone, bare metal applications without any modification beyond a simple recompile.

One example of low-level embedded development software that meets these requirements is StarterWare from Texas Instruments (TI). TI and other embedded processor vendors commonly provide low-level device support packages, but StarterWare is a new effort to provide a complete solution for more complex system-on-chip (SOC) devices. The contents of the StarterWare package are summarized in Figure 1, below.

Figure 1: Summary of StarterWare components

The device abstraction layer (DAL) provides support for peripheral devices as well as CPU features including cache management and interrupt handling. Additionally, StarterWare provides protocol stacks for complicated peripherals so that bare metal applications can perform high-level actions, such as enumerating a USB device or rendering sprite fonts to a display peripheral, all without resorting to cumbersome, high-level software stacks.

StarterWare also ports and makes use of open source software, such as the lwIP network stack, where appropriate. Devices supported by StarterWare include ARM-only, DSP-only, and DSP+ARM SOCs. In the latter case, full support for all features is provided for both cores, and lightweight inter-processor communication (IPC) is also included.

Finally, StarterWare provides copious examples showing the use of its various software components. We will examine one of these examples to illustrate how StarterWare can be used to develop standalone, no-OS applications.