/*##########################################################################*/ /*! @page exa_rtos Examples for Third-Party RTOS 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. - @subpage exa_embos (directory examples/embos/) - @subpage exa_threadx (directory examples/threadx/) - @subpage exa_ti-rtos (directory examples/ti-rtos/) - @subpage exa_ucos-ii (directory examples/ucos-ii/) @note 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. @next{exa_embos examples} */ /*##########################################################################*/ /*! @page exa_embos embOS @htmlonly @endhtmlonly The QP/C examples for SEGGER embOS are as follows: - ARM Cortex-M - @subpage embos_dpp_stm32f429-discovery (Cortex-M4F) STM32F4-Discovery @note You can hover the mouse cursor over the    icon in the list below to see the picture of the board. @next{exa_threadx examples} */ /*##########################################################################*/ /*! @page embos_dpp_stm32f429-discovery DPP on STM32F4-Discovery The @ref dpp "DPP example" for embOS on STM32F4-Discovery board is located directory examples/embos/arm-cm/dpp_stm32f429-discovery. @image html bd_STM32F4-Discovery.jpg STM32F4-Discovery board The sub-directory iar 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.) ------------------------------------------------------------------------------ @section embos_dpp_stm32f429-discovery_qs QS Software Tracing 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:
STM32F4-Discovery | TTL/RS232 Converter -------------------|:------------------------ PA2 | TX PA3 | RX (currently not used) VDD | VCC GND | GND
@image html bd_STM32F4-Discovery_RS232.jpg STM32F4-Discovery board connected to RS232 level shifter The output is generated at 115200 baud rate. Here is an example invocation of the QSPY host application to receive the QS data from STM32F4-Discovery: @verbatim qspy -cCOM1 @endverbatim The actual COM port number might be different on your Windows machine. Please check the Device Manager to find the COM port number. @next{exa_threadx examples} */ /*##########################################################################*/ /*! @page exa_threadx ThreadX The QP/C examples for ThreadX (Express Logic) are as follows: - @subpage threadx_dpp_stm32f429-discovery STM32F4-Discovery
(IAR EWARM toolset) @note You can hover the mouse cursor over the    icon in the list below to see the picture of the board. @next{exa_ti-rtos examples} */ /*##########################################################################*/ /*! @page threadx_dpp_stm32f429-discovery DPP on STM32F4-Discovery The @ref dpp "DPP example" for ThreadX on STM32F4-Discovery board is located directory examples/threadx/arm-cm/dpp_stm32f429-discovery. @image html bd_STM32F4-Discovery.jpg STM32F4-Discovery board The sub-directory iar contains the workspace and project file that you can open in IAR EWARM IDE. @attention Due to the limitations of the ThreadX library for Windows, the DPP example can only instantiate one `Philo[0]` active object. 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.) ------------------------------------------------------------------------------ @section threadx_dpp_stm32f429-discovery_qs QS Software Tracing 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:
STM32F4-Discovery | TTL/RS232 Converter -------------------|:------------------------ PA2 | TX PA3 | RX (currently not used) VDD | VCC GND | GND
@image html bd_STM32F4-Discovery_RS232.jpg STM32F4-Discovery board connected to RS232 level shifter The output is generated at 115200 baud rate. Here is an example invocation of the QSPY host application to receive the QS data from STM32F4-Discovery: @verbatim qspy -cCOM1 @endverbatim The actual COM port number might be different on your Windows machine. Please check the Device Manager to find the COM port number. @next{exa_ti-rtos examples} */ /*##########################################################################*/ /*! @page exa_ti-rtos TI-RTOS @htmlonly @endhtmlonly The QP/C examples for TI-RTOS are as follows: - ARM Cortex-M - @subpage ti-rtos_dpp_ek-tm4c123gxl (Cortex-M4F) */ /*##########################################################################*/ /*! @page exa_ti-rtos TI-RTOS @htmlonly @endhtmlonly The QP/C++ examples for TI-RTOS are as follows: - ARM Cortex-M - @subpage ti-rtos_dpp_ek-tm4c123gxl (Cortex-M4F)
(TI-CCS and IAR EWARM toolsets) @note You can hover the mouse cursor over the    icon in the list below to see the picture of the board. @next{exa_ucos-ii examples} */ /*##########################################################################*/ /*! @page ti-rtos_dpp_ek-tm4c123gxl DPP on EK-TM4C123GXL The @ref dpp "DPP example" for TI-RTOS on EK-TM4C123GXL board is located directory examples/ti-rtos/arm-cm/dpp_ek-tm4c123gxl. @image html bd_EK-TM4C123GXL.jpg EK-TM4C123GXL board @attention The TI-RTOS requires its own tooling (XDCTOOLS) and is too big to fit into the 3rd_party/ 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 C:/TI). Please refer to the TI Application Note "TI-RTOS for TivaC Getting Started Guide" (Literature Number: SPRUHU5D) for more information. The sub-directory ccs contains the project files that you can **import** into the TI CCS IDE. The sub-directory iar 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.) ------------------------------------------------------------------------------ @section ti-rtos_main main.c for TI-RTOS 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. @code{c} int main() { static QEvt const *tableQueueSto[N_PHILO]; static QEvt const *philoQueueSto[N_PHILO][N_PHILO]; static QSubscrList subscrSto[MAX_PUB_SIG]; static QF_MPOOL_EL(TableEvt) smlPoolSto[2*N_PHILO]; /* small pool */ uint8_t n; Philo_ctor(); /* instantiate all Philosopher active objects */ Table_ctor(); /* instantiate the Table active object */ QF_init(); /* initialize the framework and the underlying RT kernel */ BSP_init(); /* initialize the Board Support Package */ /* initialize publish-subscribe... */ QF_psInit(subscrSto, Q_DIM(subscrSto)); /* initialize event pools... */ QF_poolInit(smlPoolSto, sizeof(smlPoolSto), sizeof(smlPoolSto[0])); /* start the active objects... */ for (n = 0U; n < N_PHILO; ++n) { QACTIVE_START(AO_Philo[n], /* AO to start */ (uint_fast8_t)(n + 1), /* QP priority of the AO */ philoQueueSto[n], /* event queue storage */ Q_DIM(philoQueueSto[n]), /* queue length [events] */ [1] (void *)0, /* stack storage (not used) */ [2] 0U, /* size of the stack [bytes] */ (QEvt *)0); /* initialization event */ } QACTIVE_START(AO_Table, /* AO to start */ (uint_fast8_t)(N_PHILO + 1), /* QP priority of the AO */ tableQueueSto, /* event queue storage */ Q_DIM(tableQueueSto), /* queue length [events] */ [3] (void *)0, /* stack storage (not used) */ [4] 0U, /* size of the stack [bytes] */ (QEvt *)0); /* initialization event */ return QF_run(); /* run the QF application */ } @endcode ------------------------------------------------------------------------------ @section ti-rtos_bsp BSP for TI-RTOS @note TI-RTOS is configured specifically for the DPP application by means of the configuration file `dpp.cfg`, which is included in the ccs/ and iar/ 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? */ static QEvt const pauseEvt = { PAUSE_SIG, 0U, 0U}; [3] QF_PUBLISH(&pauseEvt, &l_tickHook); } else { /* the button is released */ static QEvt const serveEvt = { SERVE_SIG, 0U, 0U}; [4] QF_PUBLISH(&serveEvt, &l_tickHook); } } } /*..........................................................................*/ [5] void myIdleFunc() { /* idle callback (see dpp.cfg) */ QF_CRIT_STAT_TYPE key; ~ ~ ~ #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular Cortex-M3 MCU. */ __asm (" WFI"); /* Wait-For-Interrupt */ #endif } /* QF callbacks ============================================================*/ [6] void QF_onStartup(void) { [7] static Clock_Struct clk0Struct; Clock_Params clkParams; [8] Clock_Params_init(&clkParams); [9] clkParams.startFlag = TRUE; [10] clkParams.period = 1000U/BSP_TICKS_PER_SEC; /* Construct a periodic Clock Instance */ [11] Clock_construct(&clk0Struct, &clk0Fxn, clkParams.period, &clkParams); } @endcode @note Currently, the BSP does not demonstrate the QS (Q-SPY) tracing. Demonstrating the QS tracing for this example is planned in the future. @next{exa_ucos-ii examples} */ /*##########################################################################*/ /*! @page exa_ucos-ii uC/OS-II @htmlonly @endhtmlonly The QP/C examples for uC/OS-II are as follows: - ARM Cortex-M - @subpage ucos-ii_dpp_ek-tm4c123gxl (Cortex-M4F)
(ARM-KEIL and IAR EWARM toolsets) - @subpage ucos-ii_dpp_nucleo-l152re (Cortex-M3)
(ARM-KEIL and IAR EWARM toolsets) @note You can hover the mouse cursor over the    icon in the list below to see the picture of the board. @next{exa_os examples} */ /*##########################################################################*/ /*! @page ucos-ii_dpp_ek-tm4c123gxl DPP on EK-TM4C123GXL @image html bd_EK-TM4C123GXL.jpg EK-TM4C123GXL board DPP example for Texas Instruments TivaC123GXL MCU (Cortex-M4F) and IAR EWARM toolsets. @image html under_construction.jpg @next{exa_os examples} */ /*##########################################################################*/ /*! @page ucos-ii_dpp_nucleo-l152re DPP on NUCLEO-L152RE @image html bd_nucleo-l152re.jpg NUCLEO-L152RE board DPP example for Texas Instruments STM32 L152RET6 MCU (Cortex-M3) and IAR EWARM toolsets. @image html under_construction.jpg @next{exa_os examples} */