Embedded Software Architecture (Part 2)

Arjun Singh
3 min readJul 9, 2023

--

Today let’s discuss Embedded software layered architecture. It refers to the organization of software components in a hierarchical manner, where each layer performs a specific set of functions and interacts with adjacent layers through well-defined interfaces. This approach promotes modularity, reusability, and ease of maintenance in embedded systems.

Below is an example image of layered architecture. As you can notice it has multiple layers. Depending upon the requirements various stacks can have different number of layers.

Now let’s consider a real world example of an embedded system for controlling a smart home security system. The embedded software can be designed using a layered architecture approach, consisting of the following layers:

  1. Application Layer: This layer represents the highest level of the software stack and contains the application-specific functionality. In our example, it could include modules for handling user authentication, managing security devices (such as door locks, cameras, and motion sensors), and implementing security rules.

2. Services Layer: The services layer provides common services and utilities required by the application layer. It includes functionalities such as communication protocols (e.g., Wi-Fi, Bluetooth), data storage, and device drivers. For instance, this layer may include a Wi-Fi driver module to establish a connection with a smartphone application.

3. Middleware Layer: The middleware layer acts as a bridge between the services layer and the hardware layer. It provides higher-level abstractions and communication mechanisms to simplify the interaction with hardware components. For example, it might include a middleware module that abstracts the details of interacting with a specific camera module, allowing the application layer to use a unified interface for accessing any connected camera.

4. Hardware Abstraction Layer (HAL): The HAL layer provides a standardized interface for accessing and controlling hardware peripherals, such as GPIO (General Purpose Input/Output) pins, timers, and analog-to-digital converters. It abstracts the low-level details of hardware access, making it easier to port the software to different hardware platforms.

5. Device Driver Layer: The device driver layer contains specific drivers for each hardware component in the system. These drivers provide the necessary functions to control and interact with the underlying hardware at a low level. In our example, it might include drivers for controlling the door locks, cameras, and motion sensors.

By organizing the software into these layers, the embedded system benefits from several advantages. For example:

  • Modularity: Each layer has a well-defined set of responsibilities, allowing developers to focus on specific aspects of the system without affecting other layers. This facilitates code reuse and simplifies maintenance.
  • Portability: The layered architecture allows the software to be easily ported to different hardware platforms by replacing or adapting the lower layers specific to each platform while keeping the higher layers intact.
  • Scalability: New features or components can be added to the system by extending or modifying the appropriate layer, without affecting the rest of the system.
  • Testability: Layers can be tested independently, enabling efficient unit testing and reducing the complexity of system-level testing.

Overall, the layered architecture provides a structured and organized approach for designing embedded software, promoting flexibility, maintainability, and reusability in embedded systems.

--

--

Arjun Singh

Enbedded Software Developer with 7+ years of experience.