QM  5.2.3
Model-Based Design Tool
Loading...
Searching...
No Matches
QM™ Examples

QM™ TutorialUser Interface

QM™ model examples and projects for ARM Cortex-M, POSIX (Linux, Embedded Linux), and Windows (including QWIN GUI Kit for Prototyping Embedded Systems on Windows) are included in the QP™ Baseline Distributions available for download from SourceForge.net.

Specifically:

Finding the QM™ Examples in the QP™ Distribution

The following directory chart shows QM™ example models and projects in the QP/C Baseline Distribution. The QP/C++ and QP-nano Baseline Distributions have a similar structure.

Note
The QM model files have the extension .qm. After installing QM, you can open the models in QM by double-clicking on the .qm files in Windows Explorer.
<qp>/ // QP/C, QP/C++, or QP-nano installation folder
+-examples/ // all examples
| +-workstation/ // examples for host workstations (Windows, Linux, macOS)
| | +-blinky/ // Blinky example
| | | +-blinky.qm // QM model
| | | +-~~~ //
| | +-calc/ // Calculator example (as published in PSiCC2 book)
| | | +-calc.qm // QM model
| | | +-~~~ //
| | +-calc1/ // improved Calculator example
| | | +-calc1.qm // QM model
| | | +-~~~ //
| | +-calc1_sub/ // improved Calculator with sub-machines example
| | | +-calc1_sub.qm // QM model
| | | +-~~~ //
| | +-comp/ // "Orthogonal Component" example
| | | +-comp.qm // QM model
| | | +-~~~ //
| | +-dpp/ // Dining Philosophers Problem (DPP) example
| | | +-dpp.qm // QM model
| | | +-~~~ //
| | +-dpp-comp/ // DPP with "Orthogonal Component" example
| | | +-dpp.qm // QM model
| | | +-~~~ //
| | +-dpp-gui/ // Dining Philosophers Problem (DPP) with GUI =====++
| | | // ||
| | +-game-gui/ // "Fly 'n' Shoot" game example with GUI =====++ ||
| | | // || ||
| | +-history_qhsm/ // Transition to history with QHsm example || ||
| | | +-history.qm // QM model || ||
| | | +-~~~ // || ||
| | +-history_qmsm/ // Transition to history with QMsm example || ||
| | | +-history.qm // QM model || ||
| | | +-~~~ // || ||
| | +-~~~ // || ||
| | +-qhsmtst/ // QHsmTst example (from the PSiCC2 book) || ||
| | | +-qhsmtst.qm // QM model || ||
| | | +-~~~ // || ||
| | +-qmsmtst/ // QMsmTst example || ||
| | | +-qmsmtst.qm // QM model || ||
| | | +-~~~ // || ||
| | // || ||
| +-arm-cm/ // examples for ARM Cortex-M || ||
| | +-blinky_ek-tm4c123gxl/ // Blinky example for EK-TM4C123GXL || ||
| | | +-qk/ // examples for the preemptive QK kernel || ||
| | | | +-arm/ // ARM-Keil toolset || ||
| | | | | +-dbg/ // debug build directory || ||
| | | | | | +-blinky-qk.axf // Blinky image for debugging || ||
| | | | | | +-blinky-qk.bin // Blinky image for flash download || ||
| | | | | +-~~~ // || ||
| | | | | +-blinky-qk.uvprojx // Keil uVision project || ||
| | | | | +~~~ // || ||
| | | | +-gnu/ // GNU-ARM toolset || ||
| | | | | +-dbg/ // debug build directory || ||
| | | | | | +-blinky-qk.elf // Blinky image for debugging || ||
| | | | | | +-blinky-qk.bin // Blinky image for flash download || ||
| | | | | +-~~~ // || ||
| | | | | +-Makefile // makefile to build the project || ||
| | | | | +~~~ // || ||
| | | | +-iar/ // IAR EWARM toolset || ||
| | | | | +-dbg/ // debug build directory || ||
| | | | | | +-blinky-qk.bin // Blinky image for flash download || ||
| | | | | +-~~~ // || ||
| | | | | +-blinky-qk.ewp // IAR EW project || ||
| | | | | +-blinky-qk.eww // IAR EW workspace || ||
| | | | | +-~~~ // || ||
| | | +-qv/ // examples for the cooperative QV kernel || ||
| | | | +-arm/ // ARM-Keil toolset || ||
| | | | | +-dbg/ // debug build directory || ||
| | | | | | +-blinky-qv.axf // Blinky image for debugging || ||
| | | | | | +-blinky-qv.bin // Blinky image for flash download || ||
| | | | | +-~~~ // || ||
| | | | | +-blinky-qv.uvprojx // Keil uVision project || ||
| | | | | +~~~ // || ||
| | | | +-gnu/ // GNU-ARM toolset || ||
| | | | | +-dbg/ // debug build directory || ||
| | | | | | +-blinky-qv.elf // Blinky image for debugging || ||
| | | | | | +-blinky-qv.bin // Blinky image for flash download || ||
| | | | | +-~~~ // || ||
| | | | | +-Makefile // makefile to build the project || ||
| | | | | +~~~ // || ||
| | | | +-iar/ // IAR EWARM toolset || ||
| | | | | +-dbg/ // debug build directory || ||
| | | | | | +-blinky-qv.bin // Blinky image for flash download || ||
| | | | | +-~~~ // || ||
| | | | | +-blinky-qv.ewp // IAR EW project || ||
| | | | | +-blinky-qv.eww // IAR EW workspace || ||
| | | | | +-~~~ // || ||
| | | +-win32/ // examples for Windows || ||
| | | | +-dbg/ // debug build directory (MinGW) || ||
| | | | +-blinky.exe // Blinky executable || ||
| | | | +-Debug/ // debug build directory (Visual C++) || ||
| | | | | +-blinky.exe // Blinky executable || ||
| | | | +-~~~ // || ||
| | | | +-Makefile // makefile to build the project (MinGW) || ||
| | | | +-dpp_gui.sln // Visual Studio solution file || ||
| | | | +-dpp_gui.vcxproj // Visual Studio project file || ||
| | | | +-~~~ // || ||
| | | +-win32-qv/ // examples for Windows (single-threaded) || ||
| | | | +-~~~ // || ||
| | | | | // || ||
| | +-dpp-qk_ek-tm4c123gxl/ // DPP example for EK-TM4C123GXL || ||
| | | +-qk/ // examples for the preemptive QK kernel || ||
| | | | +-arm/ // ARM-Keil toolset || ||
| | | | | +-~~~ // || ||
| | | | | +-dpp-qk.uvprojx // Keil uVision project || ||
| | | | | +~~~ // || ||
| | | | +-gnu/ // examples for GNU-ARM || ||
| | | | | +-~~~ // || ||
| | | | | +-Makefile // makefile to build the project || ||
| | | | | +~~~ // || ||
| | | | +-iar/ // examples for the IAR EWARM || ||
| | | | | +-dpp-qk.ewp // IAR EW project || ||
| | | | | +-dpp-qk.eww // IAR EW workspace || ||
| | | | | +-~~~ // || ||
| | | +-qv/ // examples for the cooperative QV kernel || ||
| | | | +-arm/ // ARM-Keil toolset || ||
| | | | | +-~~~ // || ||
| | | | | +-dpp-qv.uvprojx // Keil uVision project || ||
| | | | | +~~~ // || ||
| | | | +-gnu/ // examples for GNU-ARM || ||
| | | | | +-~~~ // || ||
| | | | | +-Makefile // makefile to build the project || ||
| | | | | +~~~ // || ||
| | | | +-iar/ // examples for the IAR EWARM || ||
| | | | | +-dpp-qv.ewp // IAR EW project || ||
| | | | | +-dpp-qv.eww // IAR EW workspace || ||
| | | | | +-~~~ // || ||
| | | +-win32-gui/ // examples for Windows with GUI (QWin) <=====|===++
| | | | +-dbg/ // debug build directory (MinGW) ||
| | | | +-dpp.exe // DPP executable ||
| | | | +-Debug/ // debug build directory (Visual C++) ||
| | | | | +-dpp.exe // DPP executable ||
| | | | +-~~~ // ||
| | | | +-Makefile // makefile to build the project (MinGW) ||
| | | | +-dpp_gui.sln // Visual Studio solution file ||
| | | | +-dpp_gui.vcxproj // Visual Studio project file ||
| | | | +-~~~ // ||
| | | +-dpp.qm // QM model of DPP ||
| | | +-~~~ // ||
| | +-game_efm32-slstk3401a/ // game for EFM32-SLSTK3401A ||
| | | +-qk/ // examples for the preemptive QK kernel ||
| | | | +-arm/ // ARM-Keil toolset ||
| | | | +-gnu/ // examples for GNU-ARM ||
| | | | +-iar/ // examples for IAR EWARM ||
| | | +-qv/ // examples for the cooperative QV kernel ||
| | | | +-arm/ // ARM-Keil toolset ||
| | | | +-gnu/ // examples for GNU-ARM ||
| | | | +-iar/ // examples for IAR EWARM ||
| | | +-win32-gui/ // examples for Windows with GUI (QWin) <=====++
| | | | +-~~~ //
| | | +-game.qm // QM model of the game

Example Models

Most QP™ example application contain the QM™ models (.qm) that you can open in the QM™ tool to explore, and modify. For example, the following screen shot shows the model game.qm opened in QM.

Dining Philosophers Problem (DPP) Example

The Dining Philosophers Problem (DPP) application is used in most QP™ examples for various processors and operating systems. This example application is described in the Application Note "Dining Philosophers Problem (DPP) Example".

Dining Philosophers Problem (DPP) model

"Fly 'n' Shoot" Game Example

The "Fly 'n' Shoot" game example demonstrates several state machines (active objects) executing concurrently to realize a simple game. This example application is described in @webref{doc/PSiCC2.pdf,Chapter 1 of the Practical UML Statecharts in C/C++, 2nd Ed. book}, which is available online in the book excerpts.

Fly 'n' Shoot game model

Running the Examples

All provided QM™ examples contain pre-built executables/images that you can immediately execute (on Windows/Linux) or download to the target board (EK-TM4C123GXL or EK-LM3S811 boards).

Windows

The examples for Windows come in two flavors: simple console applications and GUI simulations of an embedded board. Both types can be run by double-clicking on the executable (e.g., dpp.exe or game-gui.exe). You interact with the console applications by typing on your keyboard, where the legend of the recognized keys is displayed at the beginning of the run. The GUI simulations respond to mouse clicks and keyboard as described in the App Notes for the example applications.


Linux

The examples for Linux are provided as simple console applications. You run them from the terminal window, typing the name of the program. You interact with the console applications by typing on your keyboard, where the legend of the recognized keys is displayed at the beginning of the run.

DPP example in a Linux terminal

EK-TM4C123GXL and EK-LM3S811 (ARM Cortex-M)

The examples for the EK-TM4C123GXL and EK-LM3S811 boards are provided for the ARM-KEIL MDK, GNU-ARM (Sourcery CodeBench), and IAR EWARM toolsets. Free evaluation versions of all these toolsets are available for download from the respective websites. Pre-compiled images for flash download are provided in all example projects.


Rebuilding the Examples

In order to rebuild the examples from source code you need to:

  • Install the baseline code of the QP framework type you want to use.
  • Install the ARM development toolset you want to use (ARM-KEL, GNU-ARM, or IAR).
  • Define an environment variable to point to the location of the QP baseline code (QPC for QP/C, QPCPP for QP/C++, and QPN for QP-nano).

For example, if you want to rebuild a QP/C example project, you need to download and install the QP/C baseline code and you need to define the environment variable QPC. Assuming that you have installed QP/C into the directory C:\qp\qpc, you should define the environment variable QPC to C:\qp\qpc.

QM™ TutorialUser Interface