|
| 1 | +#+TITLE: qp-arduino README |
| 2 | +#+AUTHOR: Peter Polidoro |
| 3 | +#+EMAIL: peter@polidoro.io |
| 4 | + |
| 5 | +* Brought to you by |
| 6 | + |
| 7 | +[[./extras/img/logo_ql_400.png]] |
| 8 | + |
| 9 | +[[./extras/img/logo_qp-arduino.png]] |
| 10 | + |
| 11 | +* Documentation |
| 12 | + |
| 13 | +This README provides a quick overview of QP for Arduino. |
| 14 | + |
| 15 | +More detailed documentation for qpcpp, qm, and qtools can be found at: |
| 16 | + |
| 17 | +https://QuantumLeaps.github.io/qp-arduino/ |
| 18 | + |
| 19 | +Please refer to the companion website to this project at: |
| 20 | + |
| 21 | +https://www.state-machine.com/arduino |
| 22 | + |
| 23 | +* Repository Information |
| 24 | +- Name: qp-arduino |
| 25 | +- Description: QP real-time embedded framework for Arduino (ARM Cortex-M) |
| 26 | +- Version: 6.9.5 |
| 27 | +- qpcpp version: 6.9.3 |
| 28 | +- qm version: 5.1.3 |
| 29 | +- qtools version: 6.9.3 |
| 30 | +- Release Date: 2025-03-14 |
| 31 | +- Creation Date: 2017-01-30 |
| 32 | +- License: GPLv3 |
| 33 | +- URL: https://github.com/QuantumLeaps/qp-arduino |
| 34 | +- Author: Quantum Leaps |
| 35 | +- Repository Maintainer: Peter Polidoro |
| 36 | +- Email: peter@polidoro.io |
| 37 | +- Copyright: Quantum Leaps, LLC |
| 38 | +- References: |
| 39 | + - https://www.state-machine.com/ |
| 40 | + - https://github.com/QuantumLeaps/qp-arduino-example |
| 41 | + - https://sourceforge.net/p/qpc/discussion/668726 |
| 42 | + |
| 43 | +* Description |
| 44 | + |
| 45 | +The Quantum Leaps’ QP™ real-time embedded frameworks (RTEFs) and the QM™ |
| 46 | +modeling tool complement the Arduino platform and provide everything you need to |
| 47 | +program Arduino graphically with event-driven active objects and modern |
| 48 | +hierarchical state machines. |
| 49 | + |
| 50 | +* Provided Libary and Examples |
| 51 | + |
| 52 | +This repository contains one external library for ARM Cortex-M based Arduinos: |
| 53 | + |
| 54 | +- =qp-arduino= -- QP/C++ framework for Arduinos based on ARM Cortex-M |
| 55 | + |
| 56 | +* Installation |
| 57 | + |
| 58 | +The QP adaptation for Arduino may be used either with the |
| 59 | +[[https://www.arduino.cc/en/software][Arduino IDE]] or with |
| 60 | +[[https://platformio.org/install/cli][PlatformIO]]. |
| 61 | + |
| 62 | +The intended way of working with the examples is to use the |
| 63 | +[[https://www.state-machine.com/products/qm/][QM modeling tool]] to modify the |
| 64 | +models (=.qm= files) and then to generate code from these models. |
| 65 | + |
| 66 | +In this scenario, the Arduino IDE or PlatformIO are used only to build and |
| 67 | +upload the code to the Arduino board(s). |
| 68 | + |
| 69 | +** Arudino IDE |
| 70 | + |
| 71 | +Download and setup the Arduino IDE if necessary: |
| 72 | + |
| 73 | +https://www.arduino.cc/en/software |
| 74 | + |
| 75 | +This libary may be installed by either using the Arduino IDE libary manager or |
| 76 | +by downloading this repository into the Sketchbook location directly. |
| 77 | + |
| 78 | +Assumming that you have installed the QP library in your =<Sketchbook>= |
| 79 | +directory, the examples provided in each QP library show up in the Arduino IDE |
| 80 | +under the menu: |
| 81 | + |
| 82 | +=File|Examples|Examples from Custom Libraries= |
| 83 | + |
| 84 | +NOTE: The preferences in the Arduino IDE should be set up to =Use external |
| 85 | +editor= so that the IDE will update the code each time it is re-generated by the |
| 86 | +QM modeling tool. |
| 87 | + |
| 88 | +The Arduino IDE serial monitor may be used to observe the output of the dpp |
| 89 | +examples. |
| 90 | + |
| 91 | +*** Arduino IDE Libary Manager |
| 92 | + |
| 93 | +In the Arduino IDE libary manager, search for qp-arduino and install the latest |
| 94 | +version. |
| 95 | + |
| 96 | +*** Downloading into Sketchbook Location |
| 97 | + |
| 98 | +This repository can be downloaded into the Sketchbook location either as a |
| 99 | +single zip archive or cloned to a local git repository. |
| 100 | + |
| 101 | +You need to unzip the zip archive, or clone the git repository, into your |
| 102 | +Arduino =<Sketchbook>= directory. To find out where your =<Sketchbook>= |
| 103 | +directory is, or to configure a different location for your =<Sketchbook>= |
| 104 | +directory, you need to open the Arduino IDE and select =File|Preferences= menu. |
| 105 | +The Sketchbook location will be shown at the top of the Preferences dialog box. |
| 106 | +Once you identify the =<Sketchbook>= directory, you simply unzip the whole zip |
| 107 | +archive, or clone the git repository, to this directory, renaming the directory |
| 108 | +qp-arduino if necessary. |
| 109 | + |
| 110 | +After the installation, your Arduino =<Sketchbook>= directory should look as |
| 111 | +follows: |
| 112 | + |
| 113 | +#+BEGIN_SRC sh |
| 114 | +<Sketchbook>/ |
| 115 | +└── libraries |
| 116 | + └── qp-arduino |
| 117 | + ├── examples |
| 118 | + │ ├── blinky-sam |
| 119 | + │ ├── blinky2-sam |
| 120 | + │ ├── blinky_bsp-sam |
| 121 | + │ ├── blinky_bsp-teensy4 |
| 122 | + │ ├── dpp_bsp-sam |
| 123 | + │ └── dpp_bsp-teensy4 |
| 124 | + └── src |
| 125 | + └── qp-arduino |
| 126 | +#+END_SRC |
| 127 | + |
| 128 | +**** Zip File |
| 129 | + |
| 130 | +https://github.com/QuantumLeaps/qp-arduino/archive/refs/heads/main.zip |
| 131 | + |
| 132 | +**** Git |
| 133 | + |
| 134 | +#+BEGIN_SRC sh |
| 135 | +git clone https://github.com/QuantumLeaps/qp-arduino.git |
| 136 | +#+END_SRC |
| 137 | + |
| 138 | +** PlatformIO |
| 139 | + |
| 140 | +PlatformIO can be used as an alternative to the Arduino IDE for compiling and |
| 141 | +uploading Arduino code to embedded boards using a command line interface. |
| 142 | + |
| 143 | +Download and setup PlatformIO if necessary: |
| 144 | + |
| 145 | +https://platformio.org/install/cli |
| 146 | + |
| 147 | +To use this libary with PlatformIO, simply add the repository URL to your |
| 148 | +platformio.ini file. |
| 149 | + |
| 150 | +#+BEGIN_QUOTE |
| 151 | +lib_deps = |
| 152 | + https://github.com/QuantumLeaps/qp-arduino.git |
| 153 | +#+END_QUOTE |
| 154 | + |
| 155 | +To compile and run an example in this repository, clone the repository to any |
| 156 | +directory you prefer: |
| 157 | + |
| 158 | +#+BEGIN_SRC sh |
| 159 | +git clone https://github.com/QuantumLeaps/qp-arduino.git |
| 160 | +#+END_SRC |
| 161 | + |
| 162 | +Navigate inside the qp-arduino directory where the platformio.ini file is |
| 163 | +contained. |
| 164 | + |
| 165 | +Modify the platformio.ini file to compile the example that you prefer. |
| 166 | + |
| 167 | +Compile and upload the example with a command like this: |
| 168 | + |
| 169 | +#+BEGIN_SRC sh |
| 170 | +pio run -e teensy41 -t upload |
| 171 | +#+END_SRC |
| 172 | + |
| 173 | +To use the serial monitor to observe the output of the dpp examples run: |
| 174 | + |
| 175 | +#+BEGIN_SRC sh |
| 176 | +pio device monitor |
| 177 | +#+END_SRC |
| 178 | + |
| 179 | +** QM |
| 180 | + |
| 181 | +QM™ (QP Modeler) is a freeware model-based design (MBD) and automatic code |
| 182 | +generation tool for designing software based on modern finite state machines |
| 183 | +(UML statecharts) and the QP™ Real-Time Embedded Frameworks. QM™ is available |
| 184 | +for Windows, Linux and macOS hosts. The QM™ modeling tool is offered under a |
| 185 | +simple click-through EULA license. |
| 186 | + |
| 187 | +QM may be downloaded and installed from: |
| 188 | + |
| 189 | +https://www.state-machine.com/products/qm |
| 190 | + |
| 191 | +Or it may be downloaded and installed on the command line: |
| 192 | + |
| 193 | +#+BEGIN_SRC sh |
| 194 | +cd ~ && rm -rf qp && mkdir qp && cd qp |
| 195 | +curl -OL https://github.com/QuantumLeaps/qm/releases/download/v5.1.3/qm_5.1.3-linux64.zip |
| 196 | +unzip qm_5.1.3-linux64.zip && rm qm_5.1.3-linux64.zip && mv qm qm-5.1.3 |
| 197 | +chmod u+x qm-5.1.3/bin/qm && chmod u+x qm-5.1.3/bin/qm.sh |
| 198 | +alias qm='~/qp/qm-5.1.3/bin/qm.sh' |
| 199 | +#+END_SRC |
| 200 | + |
| 201 | +** QTools |
| 202 | + |
| 203 | +QTools™ is a collection of various open source host-based tools for working with |
| 204 | +the QP frameworks, such as: QP/Spy™ software tracing and testing system, QUTest™ |
| 205 | +unit testing harness, QView™ monitoring and visualizing, and QWin™ GUI toolkit |
| 206 | +for prototyping embedded systems on Windows. The QTools collection for Windows |
| 207 | +provides also the MinGW C/C++ compiler (GNU GCC) and GNU make for Windows, as |
| 208 | +well as the related file utilities (rm, touch, etc.) |
| 209 | + |
| 210 | +QTools may be downloaded and installed from: |
| 211 | + |
| 212 | +https://www.state-machine.com/products/qtools |
| 213 | + |
| 214 | +Or they may be downloaded and installed on the command line: |
| 215 | + |
| 216 | +#+BEGIN_SRC sh |
| 217 | +cd ~/qp |
| 218 | +curl -OL https://github.com/QuantumLeaps/qtools/releases/download/v6.9.3/qtools-posix_6.9.3.zip |
| 219 | +unzip qtools-posix_6.9.3.zip && rm qtools-posix_6.9.3.zip && mv qtools qtools-6.9.3 |
| 220 | +cd qtools-6.9.3/qspy/posix |
| 221 | +make |
| 222 | +alias qspy='~/qp/qtools-6.9.3/bin/qspy' |
| 223 | +#+END_SRC |
| 224 | + |
| 225 | +* QP/Spy Software Tracing Support |
| 226 | + |
| 227 | +The qpcpp_arm-cm library now supports the |
| 228 | +[[https://www.state-machine.com/software-tracing][QP/Spy software tracing]]. |
| 229 | +This feature is also demonstrated in the qpcpp examples (with the BSP). |
| 230 | + |
| 231 | +To activate the software tracing, you would need to un-comment the =QS_ON= macro |
| 232 | +at the top of bsp.cpp source file. |
| 233 | + |
| 234 | +NOTE: Because the QP/Spy output is binary, you cannot watch it with a standard |
| 235 | +serial terminal. Instead, you need to use the |
| 236 | +[[https://www.state-machine.com/qtools/qspy.html][QSPY host utility]]. |
| 237 | + |
| 238 | +** QView Demonstration |
| 239 | + |
| 240 | +Once QP/Spy tracing is enabled, this communication with the target system can be |
| 241 | +used to for [[https://www.state-machine.com/qtools/qview.html][QView |
| 242 | +visualization and monitoring]] |
| 243 | + |
| 244 | +The =dpp_bsp-teensy4= example demonstrates the [QView monitoring]. To see this |
| 245 | +feature, you need to upload the dpp_bsp-teensy4 code to the Arduino Teensy 4 |
| 246 | +board and then you need to launch QView. |
| 247 | + |
| 248 | +---- |
| 249 | +# Licensing |
| 250 | + |
| 251 | +The QP/C++ real-time embedded framework (RTEF) for Arduino are licensed |
| 252 | +under the modified GPLv3 license with the |
| 253 | +[QP-Arduino Exception](https://www.state-machine.com/licenses/QP-Arduino_GPL_Exception.txt) |
| 254 | +(see also the file [QP-Arduino_GPL_Exception.txt](./QP-Arduino_GPL_Exception.txt) |
| 255 | +in the root of the archive). |
| 256 | + |
| 257 | +Specifically, the Arduino GPLv3 Exception removes the requirement to expose your |
| 258 | +proprietary source code as long as you deploy it on an Arduino-Certified |
| 259 | +board. |
| 260 | + |
| 261 | +The [QM model-based design tool](https://www.state-machine.com/qm/) is freeware. |
| 262 | +The QM tool is provided under the terms of a simple |
| 263 | +[End-User License Agreement (EULA)](https://www.state-machine.com/qm/license.html). |
| 264 | + |
| 265 | +* Support Questions |
| 266 | + |
| 267 | +Please submit any questions or comments to the free QP support forum at: |
| 268 | + |
| 269 | +https://sourceforge.net/p/qpc/discussion/668726 |
0 commit comments