The QP-nano distribution contains many example projects to demonstrate various QP-nano features. Each example project is described on its own dedicated page that you can find using several criteria (see Cross-Reference). The example projects have the following main goals:
Starting with QP-nano release 5.4.0, all examples are bundled into the QP-nano download, as opposed to being distributed as separate QP Development Kits (QDKs). The main benefit is of this approach is that it greatly reduces chances of mistakes in combining the mainline QP-nano code with various QDKs. The downside is that the QP-nano distribution becomes quite large and that examples can't be added or updated independently from the QP-nano baseline code.
All examples are located in sub-directories of the examples top-level folder, with the hierarchical organization outlined below:
arm-cm — Native examples for ARM-Cortex-M (bare-metal) [A]
workstation — Examples for Workstations [B]
A Native examples are located in sub-directories named after the CPU architecture, such as arm-cm for ARM Cortex-M. Under that directory, the sub-directories blinky_ek-tm4c123gxl contain the specific example on the specified board, such as "Blinky" on the EK-TM4C123GXL board here. In the specific example folder, you find sub-folders for the QK and QV kernels, respectively.
B Examples for Workstations are located in sub-directory workstation. These examples can be built on Windows, Linux and MacOS.
To demonstrate QP-nano features on an embedded board, you need to create an application that does "something interesting". Instead of inventing this "something interesting" for each and every example, the example projects implement one of the three example applications, which are described on the separate pages:
With the exception of the game application, all other example applications can be implemented on a board with just a couple of LEDs. The "Fly 'n' Shoot" Game application is a bit more involved and requires a small graphic display on the board.
Beyond these basic applications for demonstrating and testing the various QP-nano ports, the QP-nano distribution contains all examples described in the book Practical UML Statecharts in C/C++, 2nd Edition
While some provided examples can run on your desktop computer, most embedded example projects require special hardware in form of Development Boards, which you need to acquire to be able to run the examples. The boards chosen for the examples are generally inexpensive and self-contained with no need for external hardware (such as external JTAG debuggers or power supplies).
Most provided examples require special embedded cross-development tools, such as embedded compilers, linkers, debuggers and IDEs, which you need to acquire independently from the QP-nano distribution. Generally, the examples work with the free (size limited) evaluation versions of the commercial tools. The examples list the versions of tools they were developed and tested with. Please refer to the cross-reference section Development Tools to see which embedded toolsets are used.
QP examples QP ports are provided in the following three build configurations:
Many example projects contain code auto-generated by the QM modeling tool. Such projects always contain the corresponding QM model file, which you can open in QM, modify, and re-generate the code.
The QP-nano example projects often need to use various additional code, such as MCU register definition files, startup code, device drivers, etc., which are provided by Third-Party vendors. All such code is located in the 3rd_party top-level folder.
The code in the 3rd_party folder comes from various sources, and Quantum Leaps, LLC expressly makes no claims of ownership to any of this code, even though some of the code might be customized or modified by Quantum Leaps.
README.txt
or LICENSE.txt
files included in the respective sub-folders.Perhaps the most important fact of life to remember is that in embedded systems nothing works until everything works. This means that you should always start with a working system and gradually evolve it, changing one thing at a time and making sure that it keeps working every step of the way.
Keeping this in mind, the provided QP-nano application examples, such as the super-simple Blinky, or a bit more advanced Dining Philosophers Problem (DPP) or "Fly 'n' Shoot" Game, allow you to get started with a working project rather than starting from scratch. You should also always try one of the provided example projects on the same evaluation board that it was designed for, before making any changes.
Only after convincing yourself that the example project works "as is", you can think about creating your own projects. At this point, the easiest and recommended way is to copy the existing working example project folder (such as the Blinky example) and rename it.
After copying the project folder, you still need to change the name of the project/workspace. The easiest and safest way to do this is to open the project/workspace in the corresponding IDE and use the Save As... option to save the project under a different name. You can do this also with the QM model file, which you can open in QM and "Save As" a different model.
To work with QP-nano effectively, you need to learn a bit more about active objects and state machines. Below is a list of links to enable you to further your knowledge: