CMSIS-RTOS
Version 1.03
Real-Time Operating System: API and RTX Reference Implementation.
|
The CMSIS-RTOS RTX functions provide delays in units of milliseconds that are derived from the RTX Timer Tick. It is therefore recommended to configure the RTX Timer Tick to generate a 1 millisecond interval. Configuring a longer RTX Timer Tick may reduce energy consumption, but has impacts on the granularity of the timeouts.
Name | #define | Description |
---|---|---|
Use Cortex-M SysTick timer as RTX Kernel Timer | OS_SYSTICK | Selects the Cortex-M SysTick timer as RTX kernel timer. In this case, the RTX kernel configures the SysTick timer clock source as processor clock. Therefore the value OS_CLOCK should be identical with the value of the CMSIS variable SystemCoreClock. |
RTOS Kernel Timer input clock frequency [Hz] | OS_CLOCK | Specifies the Cortex-M processor clock frequency in Hz. This value is used to calculate the RTX kernel timer reload value. |
RTX Timer tick interval value [us] | OS_TICK | Specifies the RTX Timer Tick interval in microseconds (us). This value is used to calculate timeout values. When the SysTick core timer is enabled the value is also used to configure the SysTick timer. It is recommended to configure the RTX Timer tick to 1000 us which results in a timeout granularity of 1 millisecond. |
With #define OS_SYSTICK 0 an alternative timer is selected as RTX kernel timer.
Four functions in the RTX_Conf_CM.c file need to be adapted for using an alternative hardware timer.
Configuration Code:
The function OS_Tick_Handler handles the RTX tick interval interrupts. It is used if you are using an alternate timer as the RTX tick timer.
The OS_Tick_Handler is an interrupt handler function, which runs the OS task scheduler. It is called by the Nested Vectored Interrupt Controller (NVIC) on the alternate timer's interrupt, and cannot be called as a regular C-function. It must be entered into the Interrupt Table in startup file. The default Cortex-M interrupt vector must be replaced by OS_Tick_Handler.