Skip to content

What’s the Right OS for Your Embedded Device?

Choosing the ideal software stack for your embedded device is a decision that influences both its performance and long-term value. With so many tools available, the burden of figuring out where to start can feel overwhelming. This blog aims to help you streamline your software selection, focusing primarily on the lowest level of the software stack: the operating system.

The case for Linux in embedded systems

Linux, with its robustness and flexibility, is a popular choice for many embedded developers. However, it is not suited for all applications. While Linux can handle device responses within a reasonable timeframe, it lacks guarantees for time-critical responsiveness. This limitation makes Linux unsuitable for products requiring deterministic control over hardware responses, which can be crucial in sectors like automotive and industrial automation.

When to consider an RTOS

For projects demanding precise, time-critical operations, a real-time operating system (RTOS) like QNX Neutrino, GreenHills INTEGRITY, or VxWorks may be necessary. These systems provide deterministic performance essential for managing hardware that requires strict timing. Despite some unique commands and APIs, all three are POSIX compliant, offering a Linux-like environment and the ability to compile most Linux source code without significant changes.

Enhancing Linux for time-critical tasks

If you have time-critical constraints but you’d really prefer Linux over an RTOS, there are a few enhancements you can consider:

  • Real-time patches: There are real-time patches and/or compiler flags for Linux that can add some “RTOS-like” features to your existing Linux environment. However, they add complexity to your distro and patch management, and since they can also impose some constraints on your Linux code, we generally avoid this solution.
  • Hypervisors: Implementing a hypervisor beneath the OS can allow critical tasks to run in parallel with Linux, either on a separate RTOS or in an OS-less “bare metal” environment.
  • Onboard hardware: Using companion processors like an ARM M4 or a DSP available on some SoCs can be a good way to keep your time-sensitive tasks out of Linux.
  • Microcontrollers: Adding a dedicated microcontroller that can manage time-critical or power-efficient tasks adds BOM cost but is a valid solution for critical tasks when your SoC doesn’t have a companion processor.
  • Dedicated core: Allocating a specific core for real-time tasks can make it significantly easier to ensure performance, at the cost of focusing the overall system load on the remaining cores.

While these solutions add complexity and require careful integration, they can help you to add real-time capabilities beyond what Linux can achieve alone.

Managing file systems in embedded devices

The choice of an embedded file system impacts both functionality and performance. Considerations include:

  • Location: Deciding whether to run the file system directly on Soc flash or use removable storage.
  • Type: Choosing from a wide variety of file systems like ext4, JFS, Btrfs, and more lets you choose your combination of benefits versus size, speed, and resilience limitations.
  • Writability: Balance your overall architecture to take advantage of writeable volumes for logs and user data as well as read-only volumes for everything else to prevent corruption and enhance security.

Distribution and board support

Choosing the right Linux distribution and board support package (BSP) is crucial. While some board vendors provide Linux distributions, not all are suitable for production use. Building your own Linux using tools like Yocto and Buildroot can offer greater control and customization, so you can cater the build specifically to your project’s needs.

Real-world experience and practical considerations

Each decision in the software stack from the OS to the application layer involves numerous considerations. By understanding the trade-offs and leveraging suitable technologies and strategies, developers can create robust, efficient, and future-proof embedded devices. The key is to align the technology with the specific requirements and constraints of your project.

This paper is a short distillation of our whitepaper, Embedded Linux: Choosing Your Software Stack. In it, you’ll find more details on the topics above as well as other such as optimizing browser performance, mobile UI design, and flash filesystem considerations.

About KDAB

If you like this article and want to read similar material, consider subscribing via our RSS feed.

Subscribe to KDAB TV for similar informative short video content.

KDAB provides market leading software consulting and development services and training in Qt, C++ and 3D/OpenGL. Contact us.

Leave a Reply

Your email address will not be published. Required fields are marked *