exa_rtos.dox 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684
  1. /*##########################################################################*/
  2. /*! @page exa_rtos Examples for Third-Party RTOS
  3. The main purpose of integrating QP/C with conventional RTOSes is to enable you to incorporate various communication stacks (TCP/IP, USB, CAN, etc.) as well as other middleware, which requires the ability to **block** the task code. Currently the following 3rd-party RTOSes are supported:
  4. - @subpage exa_embos (directory <span class="img folder">examples/embos/</span>)
  5. - @subpage exa_freertos (directory <span class="img folder">examples/freertos/</span>)
  6. - @subpage exa_threadx (directory <span class="img folder">examples/threadx/</span>)
  7. - @subpage exa_uc-os2 (directory <span class="img folder">examples/uc-os2/</span>)
  8. - @subpage exa_zephyr (directory <span class="img folder">examples/zephyr/</span>)
  9. @note
  10. You do **not** need to use a third-party RTOS just to achieve preemptive multitasking with QP/C. The framework contains a selection of built-in real-time kernels, such as the cooperative @ref srs_qv "QV kernel", the preemptive non-blocking @ref srs_qk "QK kernel", and the preemptive, dual-mode, blocking @ref srs_qxk "QXK kernel". Specifically, the QXK kernel has been designed specifically for mixing event-driven active objects with traditional **blocking code**, such as commercial middleware (TCP/IP stacks, UDP stacks, embedded file systems, etc.) or legacy software.
  11. @ifnot LATEX
  12. @nav_next{exa_embos}
  13. @endif
  14. */
  15. /*##########################################################################*/
  16. /*! @page exa_embos embOS
  17. The QP/C examples for SEGGER embOS are as follows:
  18. - ARM Cortex-M
  19. - @subpage embos_dpp_nucleo-h743zi (Cortex-M7) <a class="preview board" href="bd_NUCLEO-H743ZI.jpg" title="NUCLEO-H743ZI"></a><br>(GNU-ARM and IAR EWARM toolsets)
  20. @note
  21. You can hover the mouse cursor over the <span class="board"></span>&nbsp;&nbsp; icon in the list below to see the picture of the board.
  22. @ifnot LATEX
  23. @nav_next{embos_dpp_nucleo-h743zi}
  24. @endif
  25. */
  26. /*##########################################################################*/
  27. /*! @page embos_dpp_nucleo-h743zi DPP on NUCLEO-H743ZI
  28. The @ref dpp "DPP example" for embOS on NUCLEO-H743ZI board is located directory <span class="img folder">examples/embos/arm-cm/dpp_nucleo-h743zi</span>.
  29. @image html bd_NUCLEO-H743ZI.jpg
  30. @image latex bd_NUCLEO-H743ZI.jpg width=4.5in
  31. @caption{NUCLEO-H743ZI}
  32. @ref dpp "Dining Philosophers Problem (DPP)" example for NUCLEO-H743ZI MCU (Cortex-M7).
  33. Toolsets:
  34. - GNU-ARM in directory <span class="img folder">examples/embos/arm-cm/dpp_nucleo-h743zi/gnu</span>. Makefile provided.
  35. @verbatim
  36. make
  37. make CONF=rel
  38. make CONF=spy
  39. @endverbatim
  40. - IAR EWARM in directory <span class="img folder">examples/embos/arm-cm/dpp_nucleo-h743zi/iar</span>. Workspace `dpp.eww` provided.
  41. Features:
  42. - embOS RTOS kernel
  43. - BSP with embOS-specific: OS_TICK_HOOK, OS_Idle(), "kernel unaware" ISRs
  44. - multiple active objects, including 5 instances of the same AO class (Philo)
  45. - [QP/Spy software tracing](https://www.state-machine.com/qtools/qpspy.html) using the virtual COM-port
  46. - bi-directional [QP/Spy](https://www.state-machine.com/qtools/qs.html#qs_rx) (sending commands to the target)
  47. The output is generated at 115200 baud rate.
  48. Here is an example invocation of the QSPY host application to receive the QS data from NUCLEO-H743ZI:
  49. @verbatim
  50. qspy -c COM4
  51. @endverbatim
  52. The actual COM port number might be different on your Windows machine. Please check the Device Manager to find the COM port number.
  53. @ifnot LATEX
  54. @nav_next{exa_freertos}
  55. @endif
  56. */
  57. /*##########################################################################*/
  58. /*! @page exa_freertos FreeRTOS
  59. The QP/C examples for FreeRTOS are as follows:
  60. - ARM Cortex-M
  61. - @subpage freertos_dpp_ek-tm4c123gxl (Cortex-M4F) <a class="preview board" href="bd_EK-TM4C123GXL.jpg" title="EK-TM4C123GXL"></a><br>(ARM-KEIL, GNU-ARM and IAR EWARM toolchains)
  62. - @subpage freertos_dpp_stm32f746g-disco (Cortex-M7) <a class="preview board" href="bd_STM32F746G-Disco.jpg" title="STM32F746G-Discovery"></a><br>(ARM-KEIL, GNU-ARM and IAR EWARM toolchains)
  63. - @subpage freertos_dpp_nucleo-h743zi (Cortex-M7) <a class="preview board" href="bd_NUCLEO-H743ZI.jpg" title="NUCLEO-H743ZI"></a><br>(ARM-KEIL, GNU-ARM and IAR EWARM toolchains)
  64. - @subpage freertos_start-stop_nucleo-h743zi (Cortex-M7) <a class="preview board" href="bd_NUCLEO-H743ZI.jpg" title="NUCLEO-H743ZI"></a><br>(ARM-KEIL, GNU-ARM and IAR EWARM toolchains)
  65. @note
  66. You can hover the mouse cursor over the <span class="board"></span>&nbsp;&nbsp; icon in the list below to see the picture of the board.
  67. @ifnot LATEX
  68. @nav_next{exa_os}
  69. @endif
  70. */
  71. /*##########################################################################*/
  72. /*! @page freertos_dpp_ek-tm4c123gxl DPP on EK-TM4C123GXL
  73. @image html bd_EK-TM4C123GXL.jpg
  74. @image latex bd_EK-TM4C123GXL.jpg width=2.5in
  75. @caption{EK-TM4C123GXL (TivaC LaunchPad)}
  76. @ref dpp "DPP example" for @ref freertos "FreeRTOS" on Texas Instruments TivaC123GXL MCU (Cortex-M4F) with the following toolchains:
  77. - ARM-Keil
  78. - GNU-ARM
  79. - IAR-ARM
  80. Demonstrated features:
  81. - Multiple Active Objects
  82. - Regular "kernel-aware" ISR with "FromISR" APIs
  83. + `QF_TICK_X_FROM_ISR()`
  84. + `QF_PUBLISH_FROM_ISR()`
  85. + `Q_NEW_FROM_ISR()`
  86. + `QACTIVE_POST_FROM_ISR()`
  87. - Hi-priority "kernel-unaware" ISR
  88. - `vApplicationTickHook()`
  89. - QP/Spy output over the virtual COM port (Spy build configuration)
  90. - QP/Spy input over the virtual COM port (bi-directional Spy) (Spy build configuration)
  91. @ifnot LATEX
  92. @nav_next{freertos_dpp_stm32f746g-disco}
  93. @endif
  94. */
  95. /*##########################################################################*/
  96. /*! @page freertos_dpp_stm32f746g-disco DPP on STM32F746G-Discovery
  97. @image html bd_STM32F746G-Disco.jpg
  98. @image latex bd_STM32F746G-Disco.jpg width=4.75in
  99. @caption{STM32F746G-Discovery}
  100. @ref dpp "DPP example" for @ref freertos "FreeRTOS" on STM32F746G-Discovery MCU (Cortex-M7) with the following toolchains:
  101. - ARM-Keil
  102. - GNU-ARM
  103. - IAR-ARM
  104. Demonstrated features:
  105. - Multiple Active Objects
  106. - Regular "kernel-aware" ISR with "FromISR" APIs
  107. + `QF_TICK_X_FROM_ISR()`
  108. + `QF_PUBLISH_FROM_ISR()`
  109. + `Q_NEW_FROM_ISR()`
  110. + `QACTIVE_POST_FROM_ISR()`
  111. - Hi-priority "kernel-unaware" ISR
  112. - `vApplicationTickHook()`
  113. - QP/Spy output over the virtual COM port (Spy build configuration)
  114. - QP/Spy input over the virtual COM port (bi-directional Spy) (Spy build configuration)
  115. @ifnot LATEX
  116. @nav_next{freertos_dpp_nucleo-h743zi}
  117. @endif
  118. */
  119. /*##########################################################################*/
  120. /*! @page freertos_dpp_nucleo-h743zi DPP on NUCLEO-H743ZI
  121. @image html bd_NUCLEO-H743ZI.jpg
  122. @image latex bd_NUCLEO-H743ZI.jpg width=4.5in
  123. @caption{NUCLEO-H743ZI}
  124. @ref dpp "Dining Philosophers Problem (DPP)" example for NUCLEO-H743ZI MCU (Cortex-M7).
  125. Features:
  126. - multiple active objects, including 5 instances of the same AO class (Philo)
  127. - [QP/Spy software tracing](https://www.state-machine.com/qtools/qpspy.html) using the virtual COM-port
  128. - bi-directional [QP/Spy](https://www.state-machine.com/qtools/qs.html#qs_rx) (sending commands to the target)
  129. @ifnot LATEX
  130. @nav_next{freertos_start-stop_nucleo-h743zi}
  131. @endif
  132. */
  133. /*##########################################################################*/
  134. /*! @page freertos_start-stop_nucleo-h743zi Start-Stop on NUCLEO-H743ZI
  135. @image html bd_NUCLEO-H743ZI.jpg
  136. @image latex bd_NUCLEO-H743ZI.jpg width=4.5in
  137. @caption{NUCLEO-H743ZI}
  138. Start-Stop example for NUCLEO-H743ZI MCU (Cortex-M7) demonstrates staring and stopping active objects multiple times
  139. during the runtime, as opposed to starting AOs only at the beginning.
  140. The code for the example is generated automatically by the [QM Model-Based Design tool](https://www.state-machine.com/products/qm/) (QM version 4.5.0 or higher).
  141. The start-stop application consists of two AOs:
  142. - the Launcher AO is started at the beginning and its job is to periodically (re)start another AO
  143. - the Worker AO is NOT started at the beginning, but instead it is instantiated and started by the Launcher AO.
  144. @image html start-stop.png
  145. @image latex start-stop.png width=5.0in
  146. @caption{Launcher and Worker state machines}
  147. The actual visible work is performed by the Worker AO, which blinks the yellow LED (LD1) on the NUCLEO-H743ZI board. After blinking the LED five times, the Worker AO publishes turns the blue LED (LD2), publishes the DONE event and stops itself (by calling QP::QActive::stop() on itself).
  148. The Launcher AO subscribes to the DONE event. Upon reception of this event, The Launcher AO gives the Worker a bit of time (at least one clock tick) to cleanly terminate and then it explicitly destroys the Worker. The Worker destructor turns the blue LED (LD2) off.
  149. Next the Launcher instantiates the Worker AO by means of the placement new operator and then it starts it again to repeat the cycle, which goes no forever.
  150. @remarks
  151. Because this application is intended for embedded real-time systems, it does not use the dynamic memory (heap). Instead it uses statically allocated memory (static mode of FreeRTOS) as well as **placement-new** and explicit destructor call.
  152. It is possible to use the standard **new** and **delete** operators with the standard heap, or some customized memory allocation (overloaded new/delete). This goes beyond the scope of this example.
  153. **Supported Toolchains**<br>
  154. This example contains sub-directories for building it with various toolchains. The following toolchains are supported:
  155. - ARM-Keil MDK
  156. - GNU-ARM
  157. - IAR EWARM
  158. Please refer to the README.txt files in these sub-directories for more information about building and running the examples.
  159. **QP/Spy Support**<br>
  160. This example demonstrates the [QP/Spy software tracing](https://www.state-machine.com/qtools/qpspy.html) in the **Spy build configuration**. The QP/Spy uses the virtual COM port provided by the NUCLEO-H743ZI board. To see the QP/Spy output, you need to launch the qspy host utility, as follows (Windows command prompt):
  161. @verbatim
  162. qspy -u -c COM4
  163. @endverbatim
  164. where COM4 is the particular virtual serial port registered by your NUCLEO board. You need to adjust the COM port number for your machine.
  165. **Programming the NUCLEO Board**<br>
  166. The NUCLEO boards appear as a USB-flash drive in the file system. Programming of the board is done by simply copying the binary into
  167. thy flash drive letter.
  168. For example, assuming that the NUCLEO board appears as drive E:, you program it with the following command:
  169. @verbatim
  170. copy dbg\start-stop.bin E:
  171. @endverbatim
  172. **Demonstrated Features** @n
  173. - multiple active objects (Launcher and Worker)
  174. - instantiating, starting and stopping active objects multiple times
  175. - [QP/Spy software tracing](https://www.state-machine.com/qtools/qpspy.html) using the virtual COM-port
  176. - bi-directional [QP/Spy](https://www.state-machine.com/qtools/qs.html#qs_rx) (sending commands to the target)
  177. @ifnot LATEX
  178. @nav_next{exa_threadx}
  179. @endif
  180. */
  181. /*##########################################################################*/
  182. /*! @page exa_threadx ThreadX
  183. The QP/C examples for ThreadX (Express Logic) are as follows:
  184. - @subpage threadx_dpp_ek-tm4c123gxl (Cortex-M4F) <a class="preview board" href="bd_EK-TM4C123GXL.jpg" title="EK-TM4C123GXL"></a><br>(IAR EWARM toolchain)
  185. - @subpage threadx_dpp_stm32f429-discovery <a class="preview board" href="bd_STM32F4-Discovery.jpg" title="STM32F4-Discovery"></a><br>(IAR EWARM toolchain)
  186. @note
  187. You can hover the mouse cursor over the <span class="board"></span>&nbsp;&nbsp; icon in the list below to see the picture of the board.
  188. @ifnot LATEX
  189. @nav_next{exa_uc-os2}
  190. @endif
  191. */
  192. /*##########################################################################*/
  193. /*! @page threadx_dpp_ek-tm4c123gxl DPP on EK-TM4C123GXL
  194. @image html bd_EK-TM4C123GXL.jpg
  195. @image latex bd_EK-TM4C123GXL.jpg width=2.5in
  196. @caption{EK-TM4C123GXL (TivaC LaunchPad)}
  197. @ref dpp "DPP example" for ThreadX on Texas Instruments TivaC123GXL MCU (Cortex-M4F) with the following toolchain:
  198. - IAR-ARM
  199. Demonstrated features:
  200. - Multiple Active Objects
  201. - QP/Spy output over the virtual COM port (Spy build configuration)
  202. - QP/Spy input over the virtual COM port (bi-directional Spy) (Spy build configuration)
  203. @ifnot LATEX
  204. @nav_next{threadx_dpp_stm32f429-discovery}
  205. @endif
  206. */
  207. /*##########################################################################*/
  208. /*! @page threadx_dpp_stm32f429-discovery DPP on STM32F4-Discovery
  209. The @ref dpp "DPP example" for ThreadX on STM32F4-Discovery board is located directory <span class="img folder">examples/threadx/arm-cm/dpp_stm32f429-discovery</span>.
  210. @image html bd_STM32F4-Disco.jpg
  211. @image latex bd_STM32F4-Disco.jpg width=2.8in
  212. @caption{STM32F4-Discovery}
  213. The sub-directory <span class="img folder">iar</span> contains the workspace and project file that you can open in IAR EWARM IDE.
  214. After you load the DPP example into the STM32F4-Discovery board, the application should start blinking the 4 on-board LEDs. You can press the User button (blue) to PAUSE the philosophers for as long as the button is depressed. The philosophers resume dining when you release the User button. (In the PAUSED state the Table active object stops granting permissions to eat, so eventually all philosophers end in the "hungry" state.)
  215. @section threadx_dpp_stm32f429-discovery_qs QS Software Tracing
  216. The DPP example for ThreadX on STM32F4-Discovery board provides the "Spy" build configuration, which outputs the QS (Quantum Spy) software tracing data through USART2. To get the data out of the board, you need to connect the TTL/RS232 converter as follows:
  217. <center>
  218. STM32F4-Discovery | TTL/RS232 Converter
  219. -------------------|:------------------------
  220. PA2 | TX
  221. PA3 | RX (currently not used)
  222. VDD | VCC
  223. GND | GND
  224. </center>
  225. @image html bd_STM32F4-Disco.jpg
  226. @image latex bd_STM32F4-Disco.jpg width=2.8in
  227. @caption{STM32F4-Discovery}
  228. The output is generated at 115200 baud rate.
  229. Here is an example invocation of the QSPY host application to receive the QS data from STM32F4-Discovery:
  230. @verbatim
  231. qspy -cCOM1
  232. @endverbatim
  233. The actual COM port number might be different on your Windows machine. Please check the Device Manager to find the COM port number.
  234. @ifnot LATEX
  235. @nav_next{exa_uc-os2}
  236. @endif
  237. */
  238. /*##########################################################################*/
  239. /*! @page exa_uc-os2 uC-OS2
  240. The QP/C examples for uC-OS2 are as follows:
  241. - ARM Cortex-M
  242. - @subpage uc-os2_dpp_ek-tm4c123gxl (Cortex-M4F) <a class="preview board" href="bd_EK-TM4C123GXL.jpg" title="EK-TM4C123GXL"></a><br>(ARM-CLANG, GNU-ARM and IAR EWARM toolsets)
  243. - @subpage uc-os2_dpp_nucleo-l053r8 (Cortex-M0+) <a class="preview board" href="bd_NUCLEO-L053R8.jpg" title="NUCLEO-L053R8"></a><br>(ARM-CLANG, GNU-ARM, and IAR EWARM toolsets)
  244. @note
  245. You can hover the mouse cursor over the <span class="board"></span>&nbsp;&nbsp; icon in the list below to see the picture of the board.
  246. @ifnot LATEX
  247. @nav_next{exa_os}
  248. @endif
  249. */
  250. /*##########################################################################*/
  251. /*! @page uc-os2_dpp_ek-tm4c123gxl DPP on EK-TM4C123GXL
  252. @image html bd_EK-TM4C123GXL.jpg
  253. @image latex bd_EK-TM4C123GXL.jpg width=2.5in
  254. @caption{EK-TM4C123GXL (TivaC LaunchPad)}
  255. DPP example for Texas Instruments TivaC123GXL MCU (Cortex-M4F) and ARM-CLANG, GNU-ARM and IAR EWARM toolsets.
  256. @image html under-constr.png
  257. @image latex under-constr.png width=1in
  258. @ifnot LATEX
  259. @nav_next{uc-os2_dpp_nucleo-l053r8}
  260. @endif
  261. */
  262. /*##########################################################################*/
  263. /*! @page uc-os2_dpp_nucleo-l053r8 DPP on STM32-NUCLEO-L053R8
  264. @image html bd_NUCLEO-L053R8.jpg
  265. @image latex bd_NUCLEO-L053R8.jpg width=2.5in
  266. @caption{NUCLEO-L053R8}
  267. DPP example for STM32 L053R8 MCU (Cortex-M0+) and ARM-CLANG, GNU-ARM and IAR EWARM toolsets.
  268. @image html under-constr.png
  269. @image latex under-constr.png width=1in
  270. @ifnot LATEX
  271. @nav_next{exa_zephyr}
  272. @endif
  273. */
  274. /*##########################################################################*/
  275. /*! @page exa_zephyr Zephyr
  276. The QP/C examples for Zephyr are as follows:
  277. - @subpage zephyr_blinky
  278. - @subpage zephyr_dpp
  279. @ifnot LATEX
  280. @nav_next{zephyr_blinky}
  281. @endif
  282. */
  283. /*##########################################################################*/
  284. /*! @page zephyr_blinky Blinky
  285. The "Blinky" example blinks an on-board LED once per second. The blinking is done by an Active Object (Blinky) with a state machine. The example directory contains the following files:
  286. @verbatim
  287. <qpc>/examples/zephyr/blinky
  288. |
  289. +-src/ - project sources
  290. | |
  291. | +-bsp.h
  292. | +-bsp.c
  293. | +-blinky.h
  294. | +-blinky.c
  295. | +-main.c
  296. |
  297. +-CMakeLists.txt - project files
  298. +-prj.conf - project config
  299. +-README.md
  300. @endverbatim
  301. @section zephyr_blinky-build Building and Running
  302. - Linux:
  303. @verbatim
  304. [1] cd <qpc>/examples/zephyr/blinky
  305. [2] source ~/zephyrproject/zephyr/zephyr-env.sh
  306. [3] west build -b <board>
  307. [3a] west build -b nucleo_h743zi
  308. [3b] west build -b nucleo_l053r8
  309. ...
  310. [4] west flush
  311. @endverbatim
  312. `[1]` Open a terminal in the Blinky example directory.<br>
  313. `[2]` If Zephyr project is not in your path, you might need to source the `zephyr-env.sh` shell script.<br>
  314. `[3]` build the example project, where `<board>` is any of the boards supported by Zepyr. The example has been tested with the following boards:<br>
  315. `[3a]` nucleo_h743zi (ARM Cortex-M7)<br>
  316. `[3b]` nucleo_l053r8 (ARM Cortex-M0+)<br>
  317. `[4]` flash the board
  318. @remark
  319. The example has been tested with the following boards:
  320. @image html bd_NUCLEO-L053R8.jpg
  321. @image latex bd_NUCLEO-L053R8.jpg width=2.5in
  322. @caption{NUCLEO-L053R8}
  323. <br>
  324. @image html bd_NUCLEO-H743ZI.jpg
  325. @image latex bd_NUCLEO-H743ZI.jpg width=4.5in
  326. @caption{NUCLEO-H743ZI}
  327. @note
  328. The example should also work with most boards supported by Zephyr.
  329. @section zephyr_blinky-output Sample Output
  330. Once flashed to the board, the application also produces ASCII output to the serial terminal (if supported by the board):
  331. @verbatim
  332. *** Booting Zephyr OS build v2.6.0-rc2-88-g3d39f72a88b3 ***
  333. BSP_ledOff
  334. QF_onStartup
  335. BSP_ledOn
  336. BSP_ledOff
  337. BSP_ledOn
  338. BSP_ledOff
  339. @endverbatim
  340. @section zephyr_blinky-limits Limitations
  341. The simple Blinky example does not support the QS software tracing.
  342. @ifnot LATEX
  343. @nav_next{zephyr_dpp}
  344. @endif
  345. */
  346. /*##########################################################################*/
  347. /*! @page zephyr_dpp DPP
  348. DPP example with multiple active objects.
  349. @verbatim
  350. <qpc>/examples/zephyr/dpp
  351. |
  352. +-src/ - project sources
  353. | |
  354. | +-bsp.h
  355. | +-bsp.c
  356. | +-dpp.h
  357. | +-philo.c
  358. | +-table.c
  359. | +-main.c
  360. |
  361. +-CMakeLists.txt - project files
  362. +-prj.conf - project config
  363. +-README.md
  364. @endverbatim
  365. @section zephyr_dpp-build Building and Running
  366. - Linux:
  367. @verbatim
  368. [1] cd <qpc>/examples/zephyr/dpp
  369. [2] source ~/zephyrproject/zephyr/zephyr-env.sh
  370. [3] west build -b <board>
  371. [3a] west build -b nucleo_h743zi
  372. [3b] west build -b nucleo_l053r8
  373. ...
  374. [4] west flush
  375. @endverbatim
  376. `[1]` Open a terminal in the DPP example directory.<br>
  377. `[2]` If Zephyr project is not in your path, you might need to source the `zephyr-env.sh` shell script.<br>
  378. `[3]` build the example project, where `<board>` is any of the boards supported by Zepyr. The example has been tested with the following boards:<br>
  379. `[3a]` nucleo_h743zi (ARM Cortex-M7)<br>
  380. `[3b]` nucleo_l053r8 (ARM Cortex-M0+)<br>
  381. `[4]` flash the board
  382. @remark
  383. The example has been tested with the following boards:
  384. @image html bd_NUCLEO-L053R8.jpg
  385. @image latex bd_NUCLEO-L053R8.jpg width=2.5in
  386. @caption{NUCLEO-L053R8}
  387. <br>
  388. @image html bd_NUCLEO-H743ZI.jpg
  389. @image latex bd_NUCLEO-H743ZI.jpg width=4.5in
  390. @caption{NUCLEO-H743ZI}
  391. @note
  392. The example should also work with most boards supported by Zephyr.
  393. @section zephyr_dpp-output Sample Output
  394. Once flashed to the board, the application also produces ASCII output to the serial terminal (if supported by the board):
  395. @verbatim
  396. *** Booting Zephyr OS build v2.6.0-rc2-88-g3d39f72a88b3 ***
  397. Philo[4]->thinking
  398. Philo[3]->eating
  399. Philo[1]->thinking
  400. Philo[0]->eating
  401. Philo[4]->hungry
  402. Philo[3]->thinking
  403. Philo[2]->eating
  404. Philo[1]->hungry
  405. Philo[0]->thinking
  406. Philo[4]->eating
  407. Philo[3]->hungry
  408. Philo[0]->hungry
  409. Philo[4]->thinking
  410. Philo[0]->eating
  411. Philo[2]->thinking
  412. Philo[3]->eating
  413. Philo[4]->hungry
  414. Philo[2]->hungry
  415. Philo[3]->thinking
  416. Philo[2]->eating
  417. Philo[0]->thinking
  418. @endverbatim
  419. @section zephyr_dpp-qpspy Using the QP/SPY Software Tracing
  420. The @ref zephyr "QP/C Zephyr port" supports the
  421. [QSPY Software Tracing](https://www.state-machine.com/qtools/qpspy.html)
  422. option and will add the appropriate macros and files to build the "QSPY"
  423. configuration.
  424. If you wish to enable "QSPY" you can provide the option "QSPY"
  425. in the command-line for the build. For example:
  426. @verbatim
  427. west build -b nucleo_h743zi -- -DQSPY=ON
  428. @endverbatim
  429. @note
  430. The QP/Spy software tracing uses the Zephyr's console UART. This means that the Zephyr `printk()` facility cannot be used while QP/Spy is configured.
  431. If yo have built the example with QP/Spy, you might want to watch the QP/Spy output.
  432. @section zephyr_dpp-qspy The QSPY Host Utility
  433. To receive the QP/Spy software tracing output you need to run a special [qspy host application](https://www.state-machine.com/qtools/qspy.html).
  434. @note
  435. You might need to build the `qspy` host utility on your Linux machine. The QSPY utility is available in
  436. [QTools collection](https://github.com/QuantumLeaps/qtools/tree/master/qspy).
  437. To launch the `qspy` host utility, open a separate terminal and run
  438. @verbatim
  439. qspy -c <serial-port>
  440. ```
  441. specific example:
  442. ```
  443. qspy -c /dev/ttyACM0
  444. @endverbatim
  445. @subsection zephyr_dpp-qs-output QSPY Output Example
  446. After resetting the board, you should see output similar to the following:
  447. @verbatim
  448. ########## Trg-RST QP-Ver=701,Build=220810_150847
  449. Obj-Dict 0x20003154->QS_RX
  450. Obj-Dict 0x20000680->AO_Table
  451. Obj-Dict 0x20000180->AO_Philo[0]
  452. Obj-Dict 0x20000280->AO_Philo[1]
  453. Obj-Dict 0x20000380->AO_Philo[2]
  454. Obj-Dict 0x20000480->AO_Philo[3]
  455. Obj-Dict 0x20000580->AO_Philo[4]
  456. Obj-Dict 0x0000A52C->timerID
  457. Usr-Dict 00000100->PHILO_STAT
  458. Usr-Dict 00000101->PAUSED_STAT
  459. Usr-Dict 00000102->COMMAND_STAT
  460. Usr-Dict 00000103->CONTEXT_SW
  461. Obj-Dict 0x20003054->EvtPool1
  462. Obj-Dict 0x20000180->Philo_inst[0]
  463. Obj-Dict 0x2000026C->Philo_inst[0].m_timeEvt
  464. Obj-Dict 0x20000280->Philo_inst[1]
  465. Obj-Dict 0x2000036C->Philo_inst[1].m_timeEvt
  466. Obj-Dict 0x20000380->Philo_inst[2]
  467. Obj-Dict 0x2000046C->Philo_inst[2].m_timeEvt
  468. Obj-Dict 0x20000480->Philo_inst[3]
  469. Obj-Dict 0x2000056C->Philo_inst[3].m_timeEvt
  470. Obj-Dict 0x20000580->Philo_inst[4]
  471. Obj-Dict 0x2000066C->Philo_inst[4].m_timeEvt
  472. Fun-Dict 0x00008929->Philo_initial
  473. Fun-Dict 0x0000890F->Philo_thinking
  474. Fun-Dict 0x00008917->Philo_hungry
  475. Fun-Dict 0x0000891F->Philo_eating
  476. Sig-Dict 00000004,Obj=0x00000000->TIMEOUT_SIG
  477. 0000000327 AO-Subsc Obj=Philo_inst[0],Sig=00000005,Obj=0x20000180
  478. 0000000327 AO-Subsc Obj=Philo_inst[0],Sig=00000009,Obj=0x20000180
  479. ===RTC===> St-Init Obj=Philo_inst[0],State=0x00009B1B->Philo_thinking
  480. ===RTC===> St-Entry Obj=Philo_inst[0],State=Philo_thinking
  481. 0000000328 Init===> Obj=Philo_inst[0],State=Philo_thinking
  482. 0000000334 AO-Subsc Obj=Philo_inst[1],Sig=00000005,Obj=0x20000280
  483. 0000000334 AO-Subsc Obj=Philo_inst[1],Sig=00000009,Obj=0x20000280
  484. ===RTC===> St-Init Obj=Philo_inst[1],State=0x00009B1B->Philo_thinking
  485. ===RTC===> St-Entry Obj=Philo_inst[1],State=Philo_thinking
  486. 0000000334 Init===> Obj=Philo_inst[1],State=Philo_thinking
  487. 0000000340 AO-Subsc Obj=Philo_inst[2],Sig=00000005,Obj=0x20000380
  488. 0000000340 AO-Subsc Obj=Philo_inst[2],Sig=00000009,Obj=0x20000380
  489. ===RTC===> St-Init Obj=Philo_inst[2],State=0x00009B1B->Philo_thinking
  490. ===RTC===> St-Entry Obj=Philo_inst[2],State=Philo_thinking
  491. 0000000340 Init===> Obj=Philo_inst[2],State=Philo_thinking
  492. 0000000346 AO-Subsc Obj=Philo_inst[3],Sig=00000005,Obj=0x20000480
  493. 0000000346 AO-Subsc Obj=Philo_inst[3],Sig=00000009,Obj=0x20000480
  494. ===RTC===> St-Init Obj=Philo_inst[3],State=0x00009B1B->Philo_thinking
  495. ===RTC===> St-Entry Obj=Philo_inst[3],State=Philo_thinking
  496. 0000000346 Init===> Obj=Philo_inst[3],State=Philo_thinking
  497. 0000000352 AO-Subsc Obj=Philo_inst[4],Sig=00000005,Obj=0x20000580
  498. 0000000352 AO-Subsc Obj=Philo_inst[4],Sig=00000009,Obj=0x20000580
  499. ===RTC===> St-Init Obj=Philo_inst[4],State=0x00009B1B->Philo_thinking
  500. ===RTC===> St-Entry Obj=Philo_inst[4],State=Philo_thinking
  501. 0000000352 Init===> Obj=Philo_inst[4],State=Philo_thinking
  502. Obj-Dict 0x20000680->Table::inst
  503. Sig-Dict 00000006,Obj=0x00000000->DONE_SIG
  504. Sig-Dict 00000005,Obj=0x00000000->EAT_SIG
  505. Sig-Dict 00000007,Obj=0x00000000->PAUSE_SIG
  506. Sig-Dict 00000008,Obj=0x00000000->SERVE_SIG
  507. Sig-Dict 00000009,Obj=0x00000000->TEST_SIG
  508. Sig-Dict 00000011,Obj=0x20000680->HUNGRY_SIG
  509. 0000000370 AO-Subsc Obj=Table::inst,Sig=DONE_SIG
  510. 0000000370 AO-Subsc Obj=Table::inst,Sig=PAUSE_SIG
  511. 0000000370 AO-Subsc Obj=Table::inst,Sig=SERVE_SIG
  512. 0000000371 AO-Subsc Obj=Table::inst,Sig=TEST_SIG
  513. 0000000371 PHILO_STAT 0 thinking
  514. 0000000371 PHILO_STAT 1 thinking
  515. 0000000371 PHILO_STAT 2 thinking
  516. 0000000371 PHILO_STAT 3 thinking
  517. @endverbatim
  518. @ifnot LATEX
  519. @nav_next{exa_os}
  520. @endif
  521. */