exa_os.dox 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*! @page exa_os Examples for Workstations (Windows/POSIX)
  2. <p>The examples in the <span class="img folder">qpc/examples/workstation</span> directory are designed for workstations (running Windows, Linux, or MacOS). Currently, the following examples are provided:
  3. </p>
  4. - <span class="img folder">blinky</span> &mdash; Simple "Blinky" active object (command-line)
  5. - <span class="img folder">calc</span> &mdash; Calculator example from Chapter 2 of [PSiCC2](https://www.state-machine.com/psicc2)
  6. - <span class="img folder">calc1</span> &mdash; Improved Calculator example from Chapter 2 of [PSiCC2](https://www.state-machine.com/psicc2)
  7. - <span class="img folder">calc1_sub</span> &mdash; Calculator example with sub-machines
  8. - <span class="img folder">comp</span> &mdash; Orthogonal Component design pattern
  9. - <span class="img folder">defer</span> &mdash; Deferred Event design pattern
  10. - <span class="img folder">dpp</span> &mdash; DPP application from Chapter 9 of [PSiCC2](https://www.state-machine.com/psicc2) (**Spy**)
  11. - <span class="img folder">dpp_comp</span> &mdash; DPP with Orthogonal-Component pattern (**Spy**)
  12. - <span class="img folder">dpp-gui</span> &mdash; DPP (with GUI on Windows) (**Spy**)
  13. - <span class="img folder">game-gui</span> &mdash; "Fly 'n' Shoot" game from Chapter 1 of [PSiCC2](https://www.state-machine.com/psicc2) (**Spy**)
  14. - <span class="img folder">history_qhsm</span> &mdash; Transition-to-History (with ::QHsm class)
  15. - <span class="img folder">history_qmsm</span> &mdash; Transition-to-History (with ::QMsm class)
  16. - <span class="img folder">qhsmtst</span> &mdash; Test State Machine based on ::QHsm from Chapter 2 of [PSiCC2](https://www.state-machine.com/psicc2) (**Spy**)
  17. - <span class="img folder">qmsmtst</span> &mdash; Test State Machine based on ::QMsm (**Spy**)
  18. - <span class="img folder">reminder</span> &mdash; Reminder design pattern from Chapter 5 of PSiCC2
  19. - <span class="img folder">reminder2</span> &mdash; Reminder design pattern different version
  20. @remark
  21. The examples marked with (**Spy**) provide the @ref exa_os-spy "Spy Configuration".
  22. @section exa_win_posix Windows and POSIX Workstations
  23. All examples in the <span class="img folder">qpc/examples/workstation</span> directory work both on Windows as well as on POSIX (Linux, MacOS). On each of these operating systems you use the same cross-platform `Makefile` co-located with each example. The provided cross-platform `Makefiles` assume the **GNU GCC toolchain**. The `Makefile` discovers the host operating system and chooses the appropriate QP port version:
  24. - On Windows &mdash; @ref win32 "win32" or @ref win32-qv "win32-qv"; and
  25. - On POSIX &mdash; @ref posix "posix" or @ref posix-qv "posix-qv" (Linux, MacOS, etc.)
  26. @note
  27. On Windows, the **make** utility and the GNU GCC toolchain (**MinGW**) are provided in the [<b>QTools collection</b>](https://www.state-machine.com/qtools), which is available for a separate download. The code can be also built with other tools as well, such as the Microsoft Visual Studio 2013 and newer.
  28. @image html blinky_win32.png
  29. @image latex blinky_win32.png width=4.0in
  30. @caption{Blinky example on Windows}
  31. <br>
  32. @image html blinky_posix.png
  33. @image latex blinky_posix.png width=4.0in
  34. @caption{Blinky example on Linux}
  35. @section exa_os-qv Single-Threaded and Multi-Threaded QP/C Ports
  36. Each of the examples can be linked to either the single-threaded QP/C ports (@ref win32-qv or @ref posix-qv) or multi-threaded ports (@ref win32 or @ref posix). The choice is made in the `Makefiles`, by editing the line, which defines the `QP_PORT_DIR` symbol. For instance, the following lines select the @ref win32-qv port and leave the @ref win32 port commented-out:
  37. <br>
  38. @verbatim
  39. QP_PORT_DIR := $(QPC)/ports/win32-qv
  40. #QP_PORT_DIR := $(QPC)/ports/win32
  41. @endverbatim
  42. To reverse the selection, you need to move the comment `#` character.
  43. @remarks
  44. The single-threaded QP/C ports (@ref win32-qv "win32-qv" and @ref posix-qv "posix-qv") are recommended for **emulating** software intended for deeply-embedded targets ("dual-targeting" the embedded software development).@n
  45. @attention
  46. Examples in the <span class="img folder">workstation</span> directory can also be used on the **embedded versions** of the desktop operating systems, such as **Embedded Linux** and **Windows Embedded**. For the embedded applications, the **multi-threaded** @ref ports_os "QP ports" ( @ref posix "posix" and @ref win32 "win32", respectively) are recommended.
  47. @section exa_os_conf Debug, Release, and Spy Build Configurations
  48. The `Makefiles` for the examples generally support the following three build configurations.
  49. @subsection exa_os-dbg Debug Configuration
  50. This is the default build configuration, with full debugging information and minimal optimization. To build this configuration, type:
  51. <br>
  52. @verbatim
  53. make
  54. @endverbatim
  55. To clean this build, type
  56. @verbatim
  57. make clean
  58. @endverbatim
  59. The object files and the executable is located in the <span class="img folder">build</span> sub-directory.
  60. @subsection exa_os-rel Release Configuration
  61. This configuration is built with no debugging information and high optimization. Single-stepping and debugging might be difficult due
  62. to the lack of debugging information and optimized code. To build this configuration, type:
  63. @verbatim
  64. make CONF=rel
  65. @endverbatim
  66. To clean this build, type
  67. @verbatim
  68. make CONF=rel clean
  69. @endverbatim
  70. The object files and the executable is located in the <span class="img folder">build_rel</span> directory.
  71. @subsection exa_os-spy Spy Configuration
  72. This configuration is built with the QP's Q-SPY trace functionality. The QP/Spy output is performed by a TCP/IP socket and requires launching the QSPY host application with the -t option. To build this configuration, type:
  73. @verbatim
  74. make CONF=spy
  75. @endverbatim
  76. To clean this build, type
  77. @verbatim
  78. make CONF=spy clean
  79. @endverbatim
  80. The object files and the executable are located in the <span class="img folder">build_spy</span> sub-directory.
  81. @note
  82. The Spy build configuration requires launching the [QSPY host utility](https://www.state-machine.com/qtools/qspy.html) with the `-t` command-line option **before** running the example. This is so that the example code can output the QS software tracing to the TCP/IP socket of QSPY.
  83. @remark
  84. Only specific examples support the Spy build configuration. The examples that don't support it, will report an error or will fail the linking stage.
  85. @image html dpp_win.png
  86. @image latex dpp_win.png width=5.0in
  87. @caption{DPP with QSPY example on Windows (QSPY running in a separate command-prompt)}
  88. <br>
  89. @image html dpp_posix.png
  90. @image latex dpp_posix.png width=6.0in
  91. @caption{DPP with QSPY example on Linux (QSPY running in a separate command-prompt)}
  92. @ifnot LATEX
  93. @nav_next{exa_mware}
  94. @endif
  95. */