QP/C++ Real-Time Event Framework
repository·master·Indexed 19 days ago
https://github.com/quantumleaps/qpcppA real-time event framework (RTEF) based on the Active Object model and Hierarchical State Machines for deterministic, event-driven execution in embedded systems. It supports C++17 and provides various kernels including Cooperative QV, Preemptive QK, and Dual-mode QXK. The framework includes ports for ARM Cortex-M (v6, v7, v8), MSP430, POSIX, Win32-API, ThreadX, and Zephyr RTOS. Commercial 'Extras' provide additional features like the QS software tracing component (QP Spy) and QUTest trace-based test harness.
What's inside QP/C++
- Qube is a simple console-based application designed to exercise QP active object components. It allows developers to interact with active objects under development by posting or publishing events to them via a console interface.
Supported ARM Cortex-M Architectures for QP/C Ports
masterThe native QP/C ports support the following ARM Cortex-M architectures:
- ARMv6-M: ARM Cortex-M0/M0+
- ARMv7-M: ARM Cortex-M3/M4/M7
- ARMv8-M: ARM Cortex-M23/M33
What are QP/C++ Extras and how to obtain them
masterThe open source GPL distribution of QP/C++ can be augmented with QP/C++ Extras, which provide advanced features including:
- QS software tracing component (QP Spy): For software tracing.
- QXK real-time kernel component: A real-time kernel.
- Static-analysis automation: Scripts for the PC-Lint-Plus static analysis tool.
- Test suite: Demonstrates 100% lines of code and 100% MC/DC code coverage using the QUTest trace-based test harness.
Licensing QP/C++ Extras are commercially licensed and available to commercial licensees with an active Support Term.
- Existing Licensees: Contact Quantum Leaps technical support to obtain Extras matching your public QP/C++ version.
- Evaluation: Extras are available for evaluation upon request.
What is the QP/C++ Real-Time Event Framework?
masterQP/C++ is a lightweight implementation of the asynchronous, event-driven Active Object (Actor) model designed for real-time embedded systems (e.g., microcontrollers).
Key features include:
- Software Infrastructure: For building applications consisting of Active Objects.
- Runtime Environment: Executes Active Objects in a deterministic, real-time fashion.
- Hierarchical State Machines (HSM): Supports specifying Active Object behavior using UML 2.5 statecharts.
- Implementation Modes: Supports manual C++ coding or automatic code generation using the QM model-based design tool.
How to use the QPCPP Zephyr Module
masterTo start a new project using the QPCPP Zephyr Module, you can use the
qpcpp-zephyr-apprepository as a template. Clone the repository with submodules to ensure all necessary components are included.Replace
<my-project>with your desired project name.git clone https://github.com/QuantumLeaps/qpcpp-zephyr-app <my-project> --recurse-submodules --depth 1Access documentation for the Win32-API port
masterThe Win32-API port is designed for single-threaded Windows environments. Detailed documentation, including usage and implementation specifics, is maintained in the QP/C Manual at the following URL:
https://www.state-machine.com/qpcpp/win32-qv.htmlAccess documentation for the POSIX port
masterThe POSIX port of QP/C++ is designed for multi-threaded environments using p-threads. Detailed documentation, including configuration and usage specifics for this port, is maintained in the QP/C Manual.
For complete technical details, refer to the official online manual.
https://www.state-machine.com/qpcpp/posix.htmlAccess Win32-API documentation for QP/C++
masterThe Win32-API port for QP/C++ provides multi-threading support using Win32 threads. Detailed documentation for this specific port, including implementation details and usage, is maintained in the QP/C Manual at the following URL:
https://www.state-machine.com/qpcpp/win32.htmlQuick Start: Integrate QP/C++ using CMake
masterTo integrate QP/C++ into your project using CMake, follow these steps:
- Download the import script: Copy
qpcpp_sdk_import.cmakefrom the QuantumLeaps 3rd_party repository into your project root. - Configure
CMakeLists.txt: Use the blueprint below to set up your project. Ensureinclude(qpcpp_sdk_import)is called before theproject()command. - Configure: Run
cmake -B Build . - Build: Run
cmake --build Build
# 1. Minimum version and policies cmake_minimum_required(VERSION 3.23 FATAL_ERROR) cmake_policy(VERSION 3.23...3.28) cmake_policy(SET CMP0083 NEW) cmake_policy(SET CMP0105 NEW) cmake_policy(SET CMP0116 NEW) cmake_policy(SET CMP0128 NEW) # 2. Import QP/C++ (Must be before project()) set(QPCPP_SDK_PATH ${CMAKE_SOURCE_DIR}/Source/qpcpp-sdk) include(qpcpp_sdk_import) # 3. Define your project project(myProject VERSION "1.0.0" DESCRIPTION "my 1st qpcpp project" LANGUAGES C CXX) # 4. Define targets add_executable(qpcppApp main.cpp qpcppApp.cpp) # 5. Initialize QP/C++ SDK include(${QPCPP_SDK_PATH}/qpcpp_sdk_init.cmake) set(QPCPP_PROJECT qpcPrj) set(QPCPP_CFG_KERNEL QV) set(QPCPP_CFG_GUI TRUE) set(QPCPP_CFG_PORT win32) set(QPCPP_CFG_LIB_TYPE static) # For QP/C++ 8.0.0+, specify your local qp_config.hpp path set(QPCPP_CFG_QPCONFIG_H_INCLUDE_PATH ${CMAKE_CURRENT_LIST_DIR}/include) qpcpp_sdk_init() # 6. Link the library target_link_libraries(qpcppApp PRIVATE qpcpp)- Download the import script: Copy
Access MSP430 Port documentation
masterDetailed documentation for the MSP430 port, including configuration and usage specific to the MSP430 architecture, is maintained in the QP/C Manual. You can find the specific manual for this port at the following URL:
https://www.state-machine.com/qpcpp/msp430.htmlBuild with Debug, Release, and Spy configurations
masterQP/C++ supports three primary build configurations:
Debug: Includes debug symbols and minimal optimizations.Release: Optimized build without debug support.Spy: Similar toDebug, but withQSpysupport activated.
Requirements for
Spyconfiguration: To use theSpyconfiguration, the fileqs.cppmust exist in thesrc/qsfolder of the QP/C++ source. If it is missing, the system will disableSpysupport and throw an error if you attempt to build with--config=Spy.Building with Multi-Config Generators (e.g., Ninja Multi-Config, MS Visual Studio): Generate the project once, then specify the configuration during the build step:
cmake --build <build_directory> --config <Debug|Release|Spy>Building with Single-Config Generators (e.g., Makefile, Ninja): You must specify the configuration during the generation step using
CMAKE_BUILD_TYPE:cmake -B Build -DCMAKE_BUILD_TYPE=DebugInstall QP/C++ via Git
masterTo obtain the latest version of QP/C++ from GitHub, clone the repository including all submodules with a shallow clone to save time and space:
git clone https://github.com/QuantumLeaps/qpcpp --recurse-submodules --depth 1