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.
You do **not** need to use a traditional RTOS just to achieve preemptive multitasking with QP. The @ref comp_qk "preemptive QK kernel", available as part of the QP package, supports preemptive priority-based multitasking and is fully compatible with Rate Monotonic Scheduling to achieve guaranteed, hard real-time performance. The preemptive, run-to-completion QK kernel perfectly matches the run-to-completion execution semantics of active objects, yet it is simpler, faster, and more efficient than any traditional blocking kernel.
The @ref dpp "DPP example" for embOS on STM32F4-Discovery board is located directory <span class="img folder">examples/embos/arm-cm/dpp_stm32f429-discovery</span>.
The sub-directory <span class="img folder">iar</span> contains the workspace and project file that you can open in IAR EWARM IDE.
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.)
The DPP example for embOS 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:
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>.
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.)
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:
The @ref dpp "DPP example" for TI-RTOS on EK-TM4C123GXL board is located directory <span class="img folder">examples/ti-rtos/arm-cm/dpp_ek-tm4c123gxl</span>.
The TI-RTOS requires its own tooling (XDCTOOLS) and is too big to fit into the <span class="img folder">3rd_party/</span> directory in the QP/C++ distribution. Therefore, you need to **download and install TI-RTOS** on your machine before you can build any examples (preferably in the default location <span class="img folder">C:/TI</span>). Please refer to the TI Application Note "TI-RTOS for TivaC Getting Started Guide" (Literature Number: <a href="http://www.ti.com/lit/ug/spruhu5d/spruhu5d.pdf" target="_blank" class="extern">SPRUHU5D</a>) for more information.
The sub-directory <span class="img folder">ccs</span> contains the project files that you can **import** into the TI CCS IDE.
The sub-directory <span class="img folder">iar</span> contains the workspace and project file that you can open in IAR EWARM IDE.
After you load the DPP example into the EK-TM4C123GXL board, the application should start blinking the on-board three-color LED (located below the Reset button). You can press the SW1 button (lower-left corner) 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.)
The `main.c` for TI-RTOS is actually identical as for the built-in QV/QK/QXK kernels. In particular, you do **not need to provide stack space** to active objects, because they execute in the context of lightweight TI-RTOS Swis (Software Interrupts), which don't need private stacks.
TI-RTOS is configured specifically for the DPP application by means of the configuration file `dpp.cfg`, which is included in the <span class="img folder">ccs/</span> and <span class="img folder">iar/</span> directories. This file is processed in the custom build step for TI-RTOS.
The highlights of the Board Support Package (BSP) for TI-RTOS are explained below:
@code{c}
/* Clock function used in the application ==================================*/
[1] void clk0Fxn(UArg arg0) {
~ ~ ~
[2] QF_TICK_X(0U, &l_tickHook); /* process time events for rate 0 */
/* Perform the debouncing of buttons...
~ ~ ~
if (tmp != 0U) { /* debounced SW1 state changed? */
if (buttons.depressed == 0U) { /* is SW1 depressed? */
<li><span class="tag">1</span> The function `clk0Fxn()` provides the TI-RTOS clock service (configured later in step [11]);
</li>
<li><span class="tag">2</span> The TI-RTOS clock function calls the QF_TICK_X() service to process the QP time events;
</li>
<li><span class="tag">3-4</span> The TI-RTOS clock function might post or publish events to active objects;
</li>
<li><span class="tag">5</span> The TI-RTOS is configured (in the `dpp.cfg` file) to call the `myIdle()` function from the TI-RTOS idle loop; In the Release build configuration this function can put the CPU into a low-power sleep mode. In the Spy build configuration, the idle callback can perform QS software tracing output to the host.
</li>
<li><span class="tag">6</span> The QF_onStartup() function configures and starts interrupts. Here the function also configures and starts TI-RTOS clock service;
</li>
<li><span class="tag">7</span> The TI-RTOS `Clock_Struct` is allocated statically;
</li>
<li><span class="tag">8</span> The Clock Parameters are initialized to default;
</li>
<li><span class="tag">9</span> The Clock service is started;
</li>
<li><span class="tag">10</span> The Clock period is set to fire the desired number of times per second (`BSP_TICKS_PER_SEC`). <span class="highlight">NOTE: The system clock rate in microseconds is configured in the TI-RTOS configuration file `dpp.cfg`</span>;
</li>
<li><span class="tag">11</span> The Clock service is constructed in the statically allocated memory;
</li>
</ul>
@note
Currently, the BSP does not demonstrate the QS (Q-SPY) tracing. Demonstrating the QS tracing for this example is planned in the future.