Lightweight Event-Driven Embedded System Application Framework – Quantum Platform























































































QP™/C Real-Time Embedded Framework (RTEF) is a lightweight implementation tailored for real-time embedded (RTE) systems based on an active object computing model. QP serves as both a software infrastructure for building applications composed of active objects (actors) and a runtime environment for executing active objects in a deterministic manner. Moreover, the QP framework supports hierarchical state machines to specify the behavior of active objects.

1. What is its purpose?

The main goals of QP/C RTEF are:

  • To provide a modern event-driven concurrent model based on best practices in concurrent programming, known as the active object (Actor) computing model, which is fundamentally safer than traditional “shared state concurrency, mutex, and blocking methods” based on conventional real-time operating systems (RTOS).

  • To offer a higher level of abstraction that is closer to the problem domain than “bare” RTOS threads.

  • To provide the right abstraction for applying modern technologies such as visual modeling, hierarchical state machines, and automatic code generation.

  • To bridge the semantic gap between higher-level modeling concepts (such as UML) and traditional programming languages (such as C or C++).

2. What makes it special?

QP™/C Real-Time Embedded Framework (RTEF) is a unique product in the embedded software market. It provides a modern reusable architecture for embedded applications that combines object-oriented design with a specific concurrency model (called active objects (actor)). This architecture is typically safer, faster to respond, and easier to understand than the “free-threading” approach using traditional real-time operating systems (RTOS). It also offers a sufficiently high level of abstraction and the correct abstraction to effectively apply modeling and code generation to deeply embedded systems.

Object-Oriented

Even though it is written in MISRA-compliant ISO-C99, QP™/C is essentially an object-oriented framework, meaning that both the framework itself and applications derived from it are fundamentally composed of classes, with only classes having associated state machines.

Hierarchical State Machines

The behavior of active objects in QP™/C is specified through hierarchical state machines (UML state diagrams). The framework supports manual coding of UML state machines in C, as well as fully automated code generation through free graphical model-based design (MBD) tools based on QM™.

Built-in Kernel

The QP™/C framework can run on bare-metal single-chip microcontrollers, completely replacing traditional RTOS. The framework includes a series of built-in real-time kernels, such as the cooperative QV kernel, preemptive non-blocking QK kernel, and preemptive dual-mode blocking QXK kernel. The QXK kernel provides all the features you would expect from a traditional RTOS kernel and is specifically designed to mix event-driven active objects with traditional blocking code, such as commercial middleware (TCP/IP stacks, UDP stacks, embedded file systems, etc.) or legacy software. Native QP ports and ready-to-use examples are provided for major CPU series.

Efficiency

Despite the higher level of abstraction provided by QP™/C compared to traditional RTOS, it generally outperforms equivalent traditional RTOS products in RAM/ROM footprint and CPU efficiency.

Simplicity

The QP framework is easy to get started with, easy to use, and easy to build. A wealth of provided examples comes with projects for typical embedded toolchains (e.g., GNU, ARM, IAR, etc.). The framework does not impose any proprietary build or configuration processes or tools, just simple makefiles and native projects for demonstration toolchains. While these may not be sufficient for truly complex projects, experience shows that larger teams have their own DevOps (e.g., CI/CD), and imposing specific processes often backfires.

Interoperability

QP/C can also be used with many traditional RTOS and general-purpose operating systems (such as Linux and Windows).

Traceability

QP™/C provides unprecedented bidirectional traceability among all work artifacts, enabling teams to gain complete visibility from requirements to architecture, design, source code, testing, and backups.

Popularity and Maturity

With over 20 years of continuous development, more than 350 commercial licensees, and countless open-source users worldwide, the QP™ framework is one of the most popular products of its kind on the market. They power countless electronic products, from implanted medical devices to complex weapon systems.

Wide Usage

The QP™ Real-Time Embedded Framework meets the high-reliability application needs of various markets, such as medical, consumer, IoT, defense, robotics, industrial, communications, transportation, semiconductor IP, etc. In these application areas, QP™’s elegant software architecture and modern design concepts have significant advantages.

3. Introduction to Components

QP (Quantum Platform) is a lightweight, open-source, state machine-based, event-driven application framework. This framework consists of four parts:

  • Event Processor (QEP);

  • Lightweight Event-Driven Framework (QF);

  • Task Scheduling Microkernel (QV, QK, QXK);

  • Real-Time Tracing Debugger (QS).

(1) QEP

  • Quantum Event Processor is a general-purpose, portable, reusable state machine engine.

  • QEP allows you to directly map UML-style state diagrams to code.

  • QEP provides both traditional simple flat state machines and hierarchical state machines. QEP can directly manipulate event queues and event dispatch mechanisms.

(2) QF

  • QF is a general-purpose, event-driven application framework designed for embedded systems.

  • QF is designed to work with QEP and RTOS.

  • QF includes event queues, active objects, event traversal, etc.

(3) QK

  • QK is a lightweight preemptive real-time kernel.

  • QK is a minimal, RTC-conventional kernel for executing independent tasks.

  • QK must match the version of QF.

(4) QS

  • A powerful debugging tool.

The following block diagram illustrates the usage context, subcomponents, and hierarchy of the QP™ framework:

Lightweight Event-Driven Embedded System Application Framework - Quantum Platform

QEP (Hierarchical Event Processor)

The event processor can also be understood as a state machine engine. When an event needs to be processed, it calls the state function of the current state to handle the event and processes the return value of the state function, performing corresponding state transitions (such as transitioning to the parent state). Furthermore, the state engine also handles the entry (ENTER), exit (EXIT), and initial pseudo-state (INIT) of a state.

QF (Active-Object Framework)

QF is a lightweight, event-driven active objects framework. The main task of this framework is to ensure thread safety for each active object and run-to-completion event handling. It includes direct event delivery, publish-subscribe event forwarding, event queues, and time events (delayed delivery time events).

QV (Cooperative Kernel)

The cooperative kernel (Vanilla kernel) processes events only at time to completion and executes priority-based scheduling for active objects after processing all events. It is implicitly cooperative because active timers do not need to explicitly give up the CPU. Instead, after completing event processing, it simply returns to the QV scheduler.

QK (Preemptive Non-Blocking Kernel)

QK is an ultra-fast preemptive, priority-based, single-stack real-time kernel designed for executing active objects. It always processes high-priority active objects in the event queue, but treats events as one-time function calls (rather than an endless loop like traditional kernels). Nevertheless, if a new event priority is higher than the currently processed event priority, the QK kernel still provides preemptive one-time event processing functionality (just like a preemptive interrupt handler allows interrupts to preempt each other). This means that QK can use a single stack to save the context of all active objects.

QXK (Preemptive Blocking Kernel)

QXK is a simple preemptive, priority-based, blocking real-time kernel designed for mixing active objects with traditional blocking code, such as commercial middleware (TCP/IP stacks, UDP stacks, embedded file systems, etc.) or legacy code.

QS (Software Tracing System)

QS is a software tracing system that allows developers to monitor targets with minimal system resources without stopping or significantly slowing down the live event-driven QP application. QS is an ideal tool for testing, debugging, and optimizing QP applications. QS can even be used to support product manufacturing acceptance testing.

Source: The content is compiled from various online sources, primarily referencing:

https://www.state-machine.com/products/qp

Copyright belongs to the original author or platform, for learning, reference, and academic research only. If there is any infringement, please contact us to delete it. Thank you.

Finally

Alright, that’s all I want to share with you today. The value of technology lies in accumulation and discovery. If you feel you’ve gained something, please like, share, and bookmark.

Lightweight Event-Driven Embedded System Application Framework - Quantum Platform

Recommended Albums Click the blue text to jump

MCU Advanced Series Lightweight Event-Driven Embedded System Application Framework - Quantum Platform

Embedded C Language Advanced Series Lightweight Event-Driven Embedded System Application Framework - Quantum Platform

“Bug Said” Series Lightweight Event-Driven Embedded System Application Framework - Quantum Platform

Album | Comprehensive Guide to Linux Application Programming

Album | Learn Some Networking Knowledge

Album | Handwritten C Language

Album | Handwritten C++ Language

Album | Experience Sharing

Album | Power Control Technology

Album | From MCU to Linux

Lightweight Event-Driven Embedded System Application Framework - Quantum Platform

Leave a Comment