Typical Architectures of Embedded Software: Layered and Recursive Models

I am Lao Wen, an embedded engineer who loves learning.Follow me to become even better together!Due to resource constraints, high real-time requirements, and deep coupling with hardware, the software architecture of embedded systems must be tailored to fit.The layered model and recursive model are two widely validated and practical design paradigms that determine the system’s scalability, maintainability, real-time performance, and lifecycle costs. They are key decisions that architects must make during the requirements capture phase.Typical Architectures of Embedded Software: Layered and Recursive Models

1. Overview of Embedded Software Architecture

The embedded software architecture is the result of balancing “application goals + hardware constraints + lifecycle.” It typically consists of the following components:

(1) Boot and Bootloader Layer

(2) Board Support Package (BSP / HAL)

(3) Operating System Layer (RTOS / Bare-metal Scheduler)

(4) Middleware and Driver Framework

(5) Application Business Layer

As system complexity evolves from “single-task-single-chip” to “multi-core-distributed,” architectural paradigms have also undergone an evolution from “unstructured → circular queue → layered → recursive/microkernel → hybrid.”

The current mainstream can be summarized into two typical models: Layered Model and Recursive Model (including microkernel, Client/Server, Container, and other variants).

Typical Architectures of Embedded Software: Layered and Recursive Models

2. Detailed Explanation of Key Points

(1) Layered Architecture

The layered model divides software into several horizontal layers, where each layer only requests services from the lower layer and provides abstract interfaces to the upper layer, forming a pyramid structure of “unidirectional dependency and gradual abstraction.”

Typical layers: Application Layer → Service Layer → OS/Middleware → Driver/HAL → Hardware.

Design points: Inter-layer interfaces must be stable to avoid cross-layer calls; high cohesion within layers and low coupling between layers.

Advantages: Clear structure, easy team division, and testing can be verified layer by layer; suitable for systems with clear functional boundaries and moderate frequency of requirement changes (e.g., home appliance control, industrial HMI).

Limitations: When requirements expand horizontally (adding communication protocols, file systems), the number of layers increases, interfaces become rigid, leading to “layer explosion” and performance degradation.

(2) Recursive Architecture

The recursive model is based on the concept of “minimal core + replaceable/extensible components,” breaking down system functions into independent services or tasks that are recursively called through messages, events, or shared memory.

Common forms: Micro-kernel: retains only task scheduling, interrupt management, and IPC mechanisms, with other drivers, protocol stacks, and file systems as user-space services.

Client/Server: Client tasks request server tasks through ports/messages, and servers can be dynamically loaded.

Plugins/Containers: Runtime loading of shared libraries or scripts to achieve hot-plug functionality.

Design points: Clearly define process/task boundaries and communication contracts; focus on real-time scheduling and memory isolation.

Advantages: Highly extensible, supports dynamic upgrades, strong fault tolerance; suitable for complex functions, easily changing requirements, and long-term evolution systems (e.g., automotive ECUs, smartphones, edge gateways).

Limitations: Message passing incurs additional overhead; debugging cross-process/cross-core issues is challenging; dependent on hardware MPU/MMU.

Typical Architectures of Embedded Software: Layered and Recursive Models

Engineer’s Personal Opinion:

On resource-constrained MCUs, a “two-layer minimal layered (application + driver)” approach can be quickly implemented; when system complexity exceeds 100,000 lines of code or requires OTA upgrades, consider migrating to the recursive model, utilizing RTOS’s process/thread isolation and message queues for flexible expansion.

In the future, as RISC-V, AMP multi-core, and AI inference move to the edge, the “microkernel + container” in the recursive model will become mainstream, but layering will continue to exist in safety-critical areas (e.g., IEC 61508 SIL3).

Both will present a trend of “hybrid architecture”: maintaining layering for critical paths to ensure determinism, while non-critical functions are dynamically loaded as plugins.

https://blog.csdn.net/ZxqSoftWare/article/details/150583628

-END-

Previous Recommendations: Click the image to jump to readTypical Architectures of Embedded Software: Layered and Recursive Models

Two Embedded Software Programming Philosophies: Layered Thinking and Time-Slicing

Typical Architectures of Embedded Software: Layered and Recursive Models

In Embedded Software, how to cleverly use unions or structures to transmit floating-point data?

Typical Architectures of Embedded Software: Layered and Recursive Models

In the field of embedded technology, why is the status of the C language difficult to shake?

I am Lao Wen, an embedded engineer who loves learning.Follow me to become even better together!

Leave a Comment