1 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
7 <a target="_blank" href="https://www.freertos.org/">FreeRTOS</a> is one of the market leading real-time operating systems
8 (RTOS) for embedded microcontrollers. It is professionally developed,
9 <a target="_blank" href="https://www.freertos.org/FreeRTOS-Coding-Standard-and-Style-Guide.html">strictly quality controlled</a>,
11 <a target="_blank" href="https://forums.freertos.org/">supported</a>
12 <a target="_blank" href="https://www.freertos.org/FreeRTOS_Support_Forum_Archive/freertos_support_forum_archive_index.html/">(archive)</a>,
13 free to <a target="_blank" href="https://www.freertos.org/a00114.html">use in commercial products</a> without a requirement to
14 expose proprietary source code, and has
15 <a target="_blank" href="https://www.freertos.org/differences-between-officially-supported-and-contributed-FreeRTOS-code.html">no IP infringement</a>
18 <a href="https://arm-software.github.io/CMSIS_6/latest/RTOS2/html/index.html"><b>CMSIS-RTOS v2</b></a> is a common API for real-time
19 operating systems (RTOS). It provides a standardized programming interface that is portable to many RTOS and enables software
20 components that can work across multiple RTOS systems. It supports the Armv8-M architecture, dynamic object creation, for
21 multi-core systems, and has a binary compatible interface across ABI compliant compilers.
23 Using this software pack, users can choose between a native FreeRTOS implementation or one that is adhering to the
24 CMSIS-RTOS2 API and using FreeRTOS under the hood. The CMSIS-RTOS2 API enables programmers to create portable application
25 code to be used with different RTOS kernels (for example
26 <a class="el" href="https://www2.keil.com/mdk5/cmsis/rtx/">Keil RTX5</a>).
28 This documentation shows you:
29 - how to \ref cre_freertos_proj "create a new microcontroller project" using FreeRTOS from scratch.
30 - Various \ref examples show you the usage of FreeRTOS in native and CMSIS-RTOS2 mode.
31 - the \ref tech_data of this implementation.
38 The CMSIS-FreeRTOS implementation is provided free of charge by Arm under the <a href="LICENSE">Apache 2.0 license</a>.<br/>
39 The FreeRTOS kernel source files are released under the <a href="LICENSE.md">MIT open source license</a>.
42 ARM::CMSIS-FreeRTOS Pack
43 ------------------------
45 The <b>ARM::CMSIS-FreeRTOS</b> pack contains the following:
47 File/Directory |Content
48 :--------------------------|:---------------------------------------------------------------------------------
49 \b CMSIS/Documentation | This documentation.
50 \b CMSIS/RTOS2 | CMSIS-RTOS2 compliant implementation of FreeRTOS.
51 \b Config | FreeRTOS configuration header file.
52 \b License | FreeRTOS license agreement.
53 \b Source | FreeRTOS kernel source code.
54 \b ARM.CMSIS-FreeRTOS.pdsc | Package description file in CMSIS-Pack format.
57 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
59 \page cre_freertos_proj Create a FreeRTOS project
61 You can basically choose between two option when creating a FreeRTOS project:
62 -# \ref native_freertos using the FreeRTOS API and kernel.
63 -# \ref cmsis_freertos using the CMSIS-RTOS2 API with an underlying FreeRTOS kernel.
65 \section native_freertos Create a native FreeRTOS project
67 The steps to create a microcontroller application using FreeRTOS are:
68 - Create a new project and select a microcontroller device.
69 - In the Manage Run-Time Environment window, select <b>\::Device:Startup</b>, <b>\::RTOS:CORE</b> and
70 <b>\::RTOS:Config</b> in the \b FreeRTOS variant and an applicable <b>\::RTOS:Heap</b> scheme (for more
71 information on the heap schemes, visit the FreeRTOS documentation):
73 \image html manage_rte_freertos_native.png
76 - If the <b>Validation Output</b> requires other components to be present, try to use the \b Resolve button.
77 - Click \b OK. In the \b Project window, you will see the files that have been automatically added to you project, such as
78 \b %FreeRTOSConfig.h, the source code files, as well as the system and startup files:
80 \image html project_window_freertos_native.png
82 \subsection native_freertos_config Configure FreeRTOS
84 When you have created the native FreeRTOS project, you can configure the real-time operating system using the
85 \b FreeRTOSConfig.h file. Please refer to the
86 <a href="https://www.freertos.org/a00110.html" target="_blank">FreeRTOS documentation</a> for more information on the specific
89 \image html freertos_config_h_native.png
92 \subsection native_freertos_config_prio Interrupt priority configuration
94 FreeRTOS implements critical sections using the
95 <a href="https://developer.arm.com/documentation/dui0552/a/the-cortex-m3-processor/programmers-model/core-registers?lang=en" target="_blank">BASEPRI</a>
96 register (available in Armv7-M and Armv8-M architecture based devices) which masks only a subset of interrupts. This is
97 configured via the \c configMAX_SYSCALL_INTERRUPT_PRIORITY setting. Therefore, it is needed to properly configure this
98 setting. It is also needed to set appropriate interrupt priorities for interrupt service routines (ISR) that use RTOS
99 functions. This can especially impact drivers which typically use peripheral interrupts. Normally, these use the RTOS
100 directly or indirectly through registered callbacks.
102 Arm Cortex-M cores store interrupt priority values in the most significant bits of the interrupt priority registers which
103 can have a maximum of eight bits. Many implementations offer only three priority bits. These three bits are shifted up to be
104 bits five, six and seven respectively.
105 \c configMAX_SYSCALL_INTERRUPT_PRIORITY must not be 0 and can be xxx00000. This results in the following table:
107 | configMAX_SYSCALL_INTERRUPT_PRIORITY | Upper three bits | Priority |
108 |:---------------------------------------:|:----------------:|:-----------:|
109 | 32 | 001 | 1 (Highest) |
115 | 224 | 111 | 7 (Lowest) |
119 If you set \c configMAX_SYSCALL_INTERRUPT_PRIORITY to 32, then the priority of an interrupt service routine that uses RTOS
120 functions must then be higher or equal to 1. This ensures that this interrupt will be masked during critical a section.
122 A WiFi driver using the SPI interface registers a callback to SPI which is executed in an interrupt context. The callback
123 function in the WiFi driver uses RTOS functions. Therefore, the SPI interrupt priority must be set to a value equal or
124 higher to the FreeRTOS preempt priority, for example 1.
126 \note For a detailed description of how FreeRTOS is using Cortex-M code registers, refer to
127 <a href="https://www.freertos.org/RTOS-Cortex-M3-M4.html" target="_blank">Running the RTOS on a ARM Cortex-M Core</a>.
130 \subsection native_freertos_er Add Event Recorder Visibility
131 - To use the Event Recorder together with FreeRTOS, add the software component <b>\::Compiler:Event Recorder</b> to your project.
132 - Open \ref native_freertos_config "FreeRTOSConfig.h" and
133 - verify the header file \b freertos_evr.h is included
134 - add Event Recorder configuration definitions (see \ref cmsis_freertos_evr_config)
135 - Call <b>EvrFreeRTOSSetup()</b> in your application code (ideally in \c main()).
136 - If you are using simulation mode, add an initialization file with the following content:
138 MAP 0xE0001000, 0xE0001007 READ WRITE
139 signal void DWT_CYCCNT (void) {
142 _WWORD(0xE0001004, states);
147 - Build the application code and download it to the debug hardware or run it in simulation.
149 Once the target application generates event information, it can be viewed in the µVision debugger using the <b>Event Recorder</b>.
152 \section cmsis_freertos Create a CMSIS-FreeRTOS project
154 The steps to create a microcontroller application using CMSIS-FreeRTOS are:
155 - Create a new project and select a microcontroller device.
156 - In the Manage Run-Time Environment window, select <b>\::Device:Startup</b>, <b>\::CMSIS::RTOS2 (API)\::FreeRTOS</b>,
157 <b>\::RTOS:CORE</b> in the \b FreeRTOS variant, <b>\::RTOS:Config</b> in the \b CMSIS \b RTOS2 variant,
158 <b>\::RTOS:Timers</b>, <b>\::RTOS:Event Groups</b>, and an applicable <b>\::RTOS:Heap</b>
159 scheme (for more information on the heap schemes, visit the FreeRTOS documentation):
161 \image html manage_rte_freertos_rtos2.png
164 - If the <b>Validation Output</b> requires other components to be present, try to use the \b Resolve button.
165 - Click \b OK. In the \b Project window, you will see the files that have been automatically added to you project, such as
166 \b %FreeRTOSConfig.h, the source code files, as well as the system and startup files:
168 \image html project_window_freertos_rtos2.png
171 \subsection cmsis_freertos_config Configure CMSIS-FreeRTOS
173 When you have created the CMSIS-FreeRTOS project, you can configure the real-time operating system using the
174 \b FreeRTOSConfig.h file. It can be opened using the Configuration Wizard view:
176 \image html freertos_config_h_cmsis_rtos.png
178 The following settings are available:
180 Name | \#define | Description |
181 -------------------------------|--------------------------------------|-----------------------------------------------------------------------|
182 Minimal stack size [words] | configMINIMAL_STACK_SIZE | Stack for idle task and default task stack in words. |
183 Total heap size [bytes] | configTOTAL_HEAP_SIZE | Heap memory size in bytes. |
184 Kernel tick frequency [Hz] | configTICK_RATE_HZ | Kernel tick rate in Hz. |
185 Timer task stack depth [words] | configTIMER_TASK_STACK_DEPTH | Stack for timer task in words. |
186 Timer task priority | configTIMER_TASK_PRIORITY | Timer task priority. |
187 Timer queue length | configTIMER_QUEUE_LENGTH | Timer command queue length. |
188 Preemption interrupt priority | configMAX_SYSCALL_INTERRUPT_PRIORITY | Maximum priority of interrupts that are safe to call FreeRTOS API. |
189 Use time slicing | configUSE_TIME_SLICING | Enable setting to use time slicing. |
190 Idle should yield | configIDLE_SHOULD_YIELD | Control Yield behavior of the idle task. |
191 Check for stack overflow | configCHECK_FOR_STACK_OVERFLOW | Enable or disable stack overflow checking. |
192 Use idle hook | configUSE_IDLE_HOOK | Enable callback function call on each idle task iteration. |
193 Use tick hook | configUSE_TICK_HOOK | Enable callback function call during each tick interrupt. |
194 Use daemon task startup hook | configUSE_DAEMON_TASK_STARTUP_HOOK | Enable callback function call when timer service starts. |
195 Use malloc failed hook | configUSE_MALLOC_FAILED_HOOK | Enable callback function call when out of dynamic memory. |
196 Queue registry size | configQUEUE_REGISTRY_SIZE | Define maximum number of queue objects registered for debug purposes. |
198 \note Refer to \ref native_freertos_config_prio for more information on the usage of \c configMAX_SYSCALL_INTERRUPT_PRIORITY.
200 <b> Event Recorder Configuration </b>
202 The following settings are available (see \ref cmsis_freertos_evr_config for details):
204 Name | \#define | Description |
205 -------------------------------|--------------------------------------|-----------------------------------------------------------------------------------------|
206 Initialize Event Recorder | configEVR_INITIALIZE | Initialize Event Recorder before FreeRTOS kernel start. |
207 Setup recording level filter | configEVR_SETUP_LEVEL | Enable configuration of FreeRTOS events recording level. |
208 Task functions | configEVR_LEVEL_TASKS | Define event recording level bitmask for events generated from Tasks functions. |
209 Queue functions | configEVR_LEVEL_QUEUE | Define event recording level bitmask for events generated from Queue functions. |
210 Timer functions | configEVR_LEVEL_TIMERS | Define event recording level bitmask for events generated from Timer functions. |
211 Event Groups functions | configEVR_LEVEL_EVENTGROUPS | Define event recording level bitmask for events generated from Event Groups functions. |
212 Heap functions | configEVR_LEVEL_HEAP | Define event recording level bitmask for events generated from Heap functions. |
213 Stream Buffer functions | configEVR_LEVEL_STREAMBUFFER | Define event recording level bitmask for events generated from Stream Buffer functions. |
216 \subsection cmsis_freertos_er Add Event Recorder Visibility
217 - To use the Event Recorder together with FreeRTOS, add the software component <b>\::Compiler:Event Recorder</b> to your project.
218 - Open \ref native_freertos_config "FreeRTOSConfig.h" and
219 - verify the header file \b freertos_evr.h is included
220 - modify Event Recorder configuration definitions (see \ref cmsis_freertos_evr_config) to change default configuration
221 - Call <b>osKernelInitialize()</b> in your application code (ideally in \c main()) to setup Event Recorder according to configuration settings.
222 - If you are using simulation mode, add an initialization file with the following content:
224 MAP 0xE0001000, 0xE0001007 READ WRITE
225 signal void DWT_CYCCNT (void) {
228 _WWORD(0xE0001004, states);
233 - Build the application code and download it to the debug hardware or run it in simulation.
235 Once the target application generates event information, it can be viewed in the µVision debugger using the <b>Event Recorder.</b>
238 \section freertos_interfaces Create a mixed-interface project
240 Using CMSIS-RTOS2 API and native FreeRTOS API simultaneously is possible and some projects do require using the native FreeRTOS API and the CMSIS-RTOS2 API at the same time.
241 Such project should be \ref cmsis_freertos "created as CMSIS-FreeRTOS project".
243 Depending on the application requirements, FreeRTOS kernel can be started either by using FreeRTOS native API or by using CMSIS-RTOS2 API.
245 \subsection freertos_interface_rtos2 Start the kernel using CMSIS-RTOS2 API
249 Application thread: Initialize and start the Application
251 void app_main (void *argument) {
260 Main function: Initialize and start the kernel
263 SystemCoreClockUpdate();
265 // Initialize CMSIS-RTOS2
266 osKernelInitialize();
268 // Create application main thread
269 osThreadNew(app_main, NULL, NULL);
271 // Start the kernel and execute the first thread
280 After the kernel is started using CMSIS-RTOS2 API, FreeRTOS native API can be used with the following restrictions:
281 - vTaskStartScheduler must not be called
284 \subsection freertos_interface_native Start the kernel using native API
288 Application main thread: Initialize and start the application
290 void app_main (void *argument) {
299 Main function: Initialize and start the kernel
302 SystemCoreClockUpdate();
304 // Setup the Event Recorder (optionally)
307 // Create application main thread
308 xTaskCreate (app_main, "app_main", 64, NULL, tskIDLE_PRIORITY+1, NULL);
310 // Start the kernel and execute the first thread
311 vTaskStartScheduler();
319 After the kernel is started using FreeRTOS native API, CMSIS-RTOS2 API can be used without restrictions.
321 \section cmsis_freertos_evr_config Configure Event Recorder
323 This section describes the configuration settings for the <a href="https://arm-software.github.io/CMSIS-View/latest/evr.html" target="_blank">Event Recorder</a>
324 annotations. For more information refer to section \ref native_freertos_er "Add Event Recorder Visibility to native FreeRTOS project" or
325 \ref cmsis_freertos_er "Add Event Recorder Visibility to CMSIS-FreeRTOS project".
327 Use below definitions to configure Event Recorder initialization and recording level filter setup.
330 #define configEVR_INITIALIZE
333 Value | Description |
334 -------|---------------------------------------|
335 0 | Disable Event Recorder initialization |
336 1 | Enable Event Recorder initialization |
338 Definition configEVR_INITIALIZE enables Event Recorder initialization during execution of function \ref EvrFreeRTOSSetup. Default value is \token{1}.
341 #define configEVR_SETUP_LEVEL
344 Value | Description |
345 -------|---------------------------------------|
346 0 | Disable recording level filter setup |
347 1 | Enable recording level filter setup |
349 Definition configEVR_SETUP_LEVEL enables setup of recording level filter for events generated by FreeRTOS. Recording level is configured during execution of function \ref EvrFreeRTOSSetup. Default value is \token{1}.
352 #define configEVR_LEVEL_TASKS
353 #define configEVR_LEVEL_QUEUE
354 #define configEVR_LEVEL_TIMERS
355 #define configEVR_LEVEL_EVENTGROUPS
356 #define configEVR_LEVEL_HEAP
357 #define configEVR_LEVEL_STREAMBUFFER
360 Value | Description |
361 -------|---------------------------------------------------|
362 0x00 | Disable event generation |
363 0x01 | Enable generation of error events |
364 0x05 | Enable generation of error and operational events |
365 0x0F | Enable generation of all events |
367 Definitions configEVR_LEVEL_x set the recording level bitmask for events generated by each function group. They are taken into account only when recording level filter setup is enabled. Default value is \token{0x05}.
370 \section dbg_cmsisfreertos Debug a CMSIS-FreeRTOS project
372 \note The following only applies when used with <a href="https://www2.keil.com/mdk5" target="_blank">Arm Keil MDK</a>. If
373 you are using a different toolchain, please consult its user's manual.
375 Apart from the debug capabilities that \ref cmsis_freertos_evr_config "Event Recorder" offers, Keil MDK also supports thread
376 aware breakpoints, just like for the standard CMSIS-RTOS.
381 BS FuncN1, 1, "break = (CURR_TID == tid_phaseA) ? 1 : 0"
382 BS FuncN1, 1, "break = (CURR_TID == tid_phaseA || CURR_TID == tid_phaseD) ? 1 : 0"
383 BS \\Blinky\Blinky.c\FuncN1\179, 1, "break = (CURR_TID == tid_phaseA || CURR_TID == tid_phaseD) ? 1 : 0"
387 - For more information on conditional breakpoints in Keil MDK, consult the
388 <a href="https://www.keil.com/support/man/docs/uv4/uv4_db_dbg_breakpnts.htm" target="_blank">user's manual</a>.
389 - Enabling <a href="https://www.keil.com/support/man/docs/uv4/uv4_ui_view.htm" target="_blank">Periodic Window Update</a> is
390 required to capture register values for active running threads while executing. When turned off, only the current FreeRTOS
391 thread can be unwound after execution has been stopped.
395 - You cannot specify individual breakpoints on the same address. The following is not possible:
397 BS ThCallee, 1, "break = (CURR_TID==tid_phaseA) ? 1 : 0"
398 BS ThCallee, 1, "break = (CURR_TID==tid_phaseD) ? 1 : 0"
402 BS ThCallee, 1, "break= (CURR_TID==tid_phaseA || CURR_TID==tid_phaseD) ? 1 : 0"
405 - If you don't want to use
406 <a href="https://www.keil.com/support/man/docs/uv4/uv4_ui_view.htm" target="_blank">Periodic Window Update</a>, obtain the
407 thread and unwind information by adding a function that gets called from each thread of interest:
409 _attribute_((noinline)) int FuncN1 (int n1) {
413 Then, specify a thread aware breakpoint using an "invalid" thread ID:
415 BS FuncN1, 1, "break = (CURR_TID == tid_phaseA + 1) ? 1 : 0"
417 <tt>'tid_phaseA'</tt> would be valid, <tt>'tid_phaseA + 1'</tt> is not but will still capture the most recent registers and
418 store them to the actual thread context each time a thread aware breakpoint is checked.
420 - Function inlining typically causes thread aware breakpoints to fail. To avoid this, prepend the <tt>'noinline'</tt>
421 attribute to the function that is used to stop when the current FreeRTOS thread id matches:
423 _attribute_((noinline)) int FuncN1 (int n1) {
427 This helps to make thread aware breakpoints far less dependent on the compiler optimization level.
429 - Thread aware breakpoints should be setup using a
430 <a href="https://www.keil.com/support/man/docs/uv4/uv4_db_scripting.htm" target="_blank">debug script</a>. Reason being
431 that thread aware breakpoints are of a 'hybrid' type, that is a combined address and condition expression that works best
432 when run from a debug script.
436 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
438 \page examples Example projects
440 This pack contains two example projects:
441 - \ref examples_native
442 - \ref examples_cmsis
444 The first example shows how to use FreeRTOS standalone, whereas the second example shows how to use the CMSIS-RTOS2 API with
445 an underlying FreeRTOS.
447 The examples simulate a step-motor driver. Four phase variables are simulating the activation of the four output driver
448 stages. The state changes are shown in the Watch window variable \c g_phases. All four phases are displayed in the Logic
451 \image html blinky_example_simu.png
454 \section examples_native Blinky example using FreeRTOS natively
456 This example shows how to use FreeRTOS natively in a µVision project. This makes your code portable and you can
457 choose to use a different RTOS kernel anytime during development (even only for evaluation purposes).
459 To open the example, go to Pack Installer, select \b ARM in the \b Devices tab, and click on \b Copy next to the
460 <b>Native FreeRTOS Blinky (uVision Simulator)</b> project on the \b Examples tab. Select the location on your hard drive
461 where you want to copy the project to and press OK. µVision opens.
464 \section examples_cmsis Blinky example using CMSIS-FreeRTOS
466 This example shows how to use the CMSIS-RTOS2 API with an underlying FreeRTOS. This makes your code portable and you can
467 choose to use a different RTOS kernel anytime during development (even only for evaluation purposes).
469 To open the example, go to Pack Installer, select \b ARM in the \b Devices tab, and click on \b Copy next to the
470 <b>CMSIS-RTOS2 FreeRTOS Blinky (uVision Simulator)</b> project on the \b Examples tab. Select the location on your hard drive
471 where you want to copy the project to and press OK. µVision opens.
474 \section examples_cmsis_a9 Blinky example using CMSIS-FreeRTOS running on Arm Cortex-A9
476 This example shows how to use the CMSIS-RTOS2 API with an underlying FreeRTOS running on an NXP i.MX6 equipped with an Arm
477 Cortex-A9 code. This example only works in <a href="https://www.keil.com/mdk5/ds-mdk">DS-MDK</a>, the Eclipse-based
478 development environment from Arm. For information on setting up the target connection, please refer to
479 <a href="https://www2.keil.com/mdk5/ds-mdk/imx6sxsabrereference">NXP i.MX 6SoloX SABRE Reference</a>.
481 \note you need to have the i.MX6 device family pack installed to see the example in the \b Examples tab of Pack Installer.
483 To open the example, open the Pack Installer perspective, select \b NXP in the \b Devices tab, and click on \b Copy next to
484 the <b>CMSIS-RTOS2 FreeRTOS Blinky CA9 (MCIMX6SX-SABRE)</b> project on the \b Examples tab.
486 \image html copy_a9_example.png
488 Confirm the default location in the Eclipse Workspace by pressing Copy.
490 \image html copy_a9_example_ws.png
492 Right-click on the project and select \b Build \b Project. Then, right-click on the project and select \b Debug \b As and
493 then \b Debug \b Configurations. The Debug Configurations dialog opens:
495 \image html dbg_conf.png
497 The project is already set up for running from the SDRAM of the i.MX6 SABRE board. Press \b Debug. DS-MDK will switch to the
498 debug perspective. After a successful connection to the target, press \b F8 to run the application. In the \b App \b Console
499 you will see the output of the phases:
501 \image html dbg_output.png
505 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
507 \page tech_data Technical data and limitations
509 This lists the technical data of CMSIS-FreeRTOS.
512 \section td_limitations Limitations
514 The following list briefly describes the limitations and unsupported features of the CMSIS-RTOS2 wrapper for FreeRTOS:
515 - Static memory allocation will only work if \a all memory (from attributes structure) is provided statically. In order to
516 allocate object memory statically, you need to:
517 - provide the memory for control blocks and stack in the \c osThreadAttr_t structure for threads.
518 - provide the memory for control blocks and message data in the \c osMessageQueueAttr_t structure for memory queues.
519 - provide the memory for control blocks for other objects in the object's attributes structure.
520 - Each timer object requires additional 8 bytes of memory:
521 - to allocate all memory statically, provide the memory for control block of size (sizeof(StaticTimer_t) + 8 bytes)
522 - otherwise, additional 8 bytes of dynamic memory will be used
523 - \c osKernelSuspend and \c osKernelResume are not supported.
524 - \c osThreadDetach, \c osThreadJoin() and attribute \c osThreadJoinable are not supported (\c osThreadNew returns NULL when
525 osThreadJoinable attribute is specified).
526 - \c osThreadGetStackSize is not implemented.
527 - Event flags are limited to 24 bits.
528 - \c osEventFlagsGetName is not implemented.
529 - \c osEventFlagsWait cannot be called from an ISR.
530 - Priority inherit protocol is used as default mutex behavior (\c osMutexNew creates priority inherit mutex object by default
531 and ignores \c osMutexPrioInherit attribute when specified).
532 - Robust mutex objects are not supported (\c osMutexNew returns NULL when \c osMutexRobust attribute is specified).
533 - \c osMutexGetName is not implemented and always returns NULL.
534 - \c osSemaphoreGetName is not implemented and always returns NULL.
535 - \c osMessageQueueGetName is not implemented and always returns NULL.
536 - \c osMessageQueuePut and \c osMessageQueueGet always ignore message priority.
537 - <tt>Process Isolation (Functional Safety)</tt> functions are not implemented.
539 \section td_validation Validation suite results
542 <a target="_blank" href="https://arm-software.github.io/CMSIS_6/latest/RTOS2/html/rtosValidation.html">CMSIS-RTOS2 validation suite</a> that can
543 be used to test a real-time operating system for compliance to the standard. The test suite has been executed successfully on the
544 CMSIS-FreeRTOS implementation (<a href="cmsis_rtos2_validation.txt">see results</a>).
546 The following table explains the exceptions:
548 <table class="doxtable" summary="Validation Exceptions">
556 <td>TC_osKernelGetState_2</td>
557 <td>not executed</td>
558 <td>unsupported feature</td>
560 Test attempts to call \c osKernelGetState after a \c osKernelSuspend call. osKernelSuspend is not implemented.
564 <td>TC_osKernelLock_2</td>
565 <td>not executed</td>
566 <td>unsupported feature</td>
568 Test attempts to call \c osKernelLock after a \c osKernelSuspend call. \c osKernelSuspend is not implemented.
572 <td>TC_osKernelUnlock_2</td>
573 <td>not executed</td>
574 <td>unsupported feature</td>
576 Test attempts to call \c osKernelUnlock after a \c osKernelSuspend call. \c osKernelSuspend is not implemented.
580 <td>TC_osKernelSuspend_1</td>
581 <td>not executed</td>
582 <td>unsupported feature</td>
584 Test validates \c osKernelSuspend which is not implemented.
588 <td>TC_osKernelResume_1</td>
589 <td>not executed</td>
590 <td>unsupported feature</td>
592 Test validates \c osKernelResume which is not implemented.
596 <td>TC_osThreadNew_3</td>
597 <td>not executed</td>
598 <td>unsupported feature</td>
600 Test attempts to create joinable thread using \c osThreadJoinable attribute. FreeRTOS does not support joinable threads.
604 <td>TC_osThreadGetName_1</td>
608 Test attempt to retrieve a name on an unnamed thread. An empty string is returned instead of NULL pointer.
612 <td>TC_osThreadGetState_3</td>
613 <td>not executed</td>
614 <td>unsupported feature</td>
616 Test attempts to retrieve a state of a terminated joinable thread. FreeRTOS does not support joinable threads.
620 <td>TC_osThreadDetach_1</td>
621 <td>not executed</td>
622 <td>unsupported feature</td>
624 Test validates \c osThreadDetach which is not implemented.
628 <td>TC_osThreadDetach_2</td>
629 <td>not executed</td>
630 <td>unsupported feature</td>
632 Test validates \c osThreadDetach which is not implemented.
636 <td>TC_osThreadJoin_1</td>
637 <td>not executed</td>
638 <td>unsupported feature</td>
640 Test validates \c osThreadJoin which is not implemented.
644 <td>TC_osThreadJoin_2</td>
645 <td>not executed</td>
646 <td>unsupported feature</td>
648 Test validates \c osThreadJoin which is not implemented.
652 <td>TC_osThreadJoin_3</td>
653 <td>not executed</td>
654 <td>unsupported feature</td>
656 Test validates \c osThreadJoin which is not implemented.
660 <td>TC_osThreadGetStackSize_1</td>
661 <td>not executed</td>
662 <td>unsupported feature</td>
664 Test validates \c osThreadGetStackSize which is not implemented.
668 <td>TC_ThreadReturn</td>
669 <td>not executed</td>
670 <td>unsupported feature</td>
672 Test attempts to terminate a thread by just returning from a thread. FreeRTOS threads may not return.
676 <td>TC_osEventFlagsSet_1</td>
680 Test attempts to set event flags by calling \c osEventFlagsSet multiple times without leaving ISR handler.<br>
681 To process ISR requests, FreeRTOS uses timer deamon which wakes-up after ISR execution.
685 <td>TC_osEventFlagsClear_1</td>
689 Test attempts to clear event flags by calling \c osEventFlagsClear multiple times without leaving ISR handler.<br>
690 To process ISR requests, FreeRTOS uses timer deamon which wakes-up after ISR execution.
694 <td>TC_osEventFlagsWait_1</td>
696 <td>unsupported feature</td>
698 Test attempts to wait for flags from ISR with zero timeout (try-semantic). FreeRTOS does not support such operation.
702 <td>TC_osEventFlagsGetName_1</td>
703 <td>not executed</td>
704 <td>unsupported feature</td>
706 Test validates \c osEventFlagsGetName which is not implemented.
710 <td>TC_osMutexNew_4</td>
711 <td>not executed</td>
712 <td>unsupported feature</td>
714 Test attempts to create a robust mutex. FreeRTOS implementation does not support robust mutexes.
718 <td>TC_osMutexGetName_1</td>
719 <td>not executed</td>
720 <td>unsupported feature</td>
722 Test validates \c osMutexGetName which is not implemented.
726 <td>TC_MutexRobust</td>
727 <td>not executed</td>
728 <td>unsupported feature</td>
730 Test attempts to validate robust mutex behavior. FreeRTOS implementation does not support robust mutexes.
734 <td>TC_MutexOwnership</td>
735 <td>not executed</td>
736 <td>unsupported feature</td>
738 Test attempts to release a mutex from a thread which is not the mutex owner.<br>
739 FreeRTOS implementation does not verify ownership on mutex release.
743 <td>TC_osSemaphoreGetName_1</td>
744 <td>not executed</td>
745 <td>unsupported feature</td>
747 Test validates \c osSemaphoreGetName which is not implemented.
751 <td>TC_osMessageQueueGetName_1</td>
752 <td>not executed</td>
753 <td>unsupported feature</td>
755 Test validates \c osMessageQueueGetName which is not implemented.
760 \section td_troubleshooting Troubleshooting
762 Users looking for help shall check <a href="https://freertos.org/FAQHelp.html">subsection of the full FreeRTOS FAQ</a>.
763 It contains many useful information that also apply when using FreeRTOS in context of CMSIS-FreeRTOS.
765 Additionally, please take a look at the following:
769 <b>Interrupts are disabled when main is called or before the kernel is started</b>
771 Before the FreeRTOS kernel is started, threads (i.e. tasks) may be created together with other objects like
772 mutexes, semaphores, message queues etc. When functions like xTaskCreate, xSemaphoreCreateMutex, xQueueCreate and
773 others get called, they prevent interrupt handlers from calling FreeRTOS API functions in order to keep FreeRTOS kernel
774 variables and state machine consistent
775 (see also here <a href="https://freertos.org/FAQHelp.html">Interrupts are not executing</a>).
777 In cases when interrupts may be executed after object creation and before the FreeRTOS kernel is started they can be re-enabled:
779 portENABLE_INTERRUPTS();
781 Make sure that the interrupts you execute in such case do not call FreeRTOS API.
788 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
790 \page functionOverview Function Overview
793 \section rtos_api2 CMSIS-RTOS2 API
795 Overview of all CMSIS-RTOS C API v2 functions that are implemented in CMSIS-FreeRTOS.
797 Kernel Information and Control
798 ------------------------------
799 See <a href="https://arm-software.github.io/CMSIS_6/latest/RTOS2/html/group__CMSIS__RTOS__KernelCtrl.html">API reference</a> for details about Kernel Information and Control functions.
800 - \b osKernelInitialize: supported
801 - \b osKernelGetInfo: supported
802 - \b osKernelGetState: supported
803 - \b osKernelStart: supported
804 - \b osKernelLock: supported
805 - \b osKernelUnlock: supported
806 - \b osKernelRestoreLock: supported
807 - \b osKernelSuspend: \token{not implemented}
808 - \b osKernelResume: \token{not implemented}
809 - \b osKernelProtect: \token{not implemented}
810 - \b osKernelDestroyClass: \token{not implemented}
811 - \b osKernelGetTickCount: supported
812 - \b osKernelGetTickFreq: supported
813 - \b osKernelGetSysTimerCount: supported
814 - \b osKernelGetSysTimerFreq: supported
818 See <a href="https://arm-software.github.io/CMSIS_6/latest/RTOS2/html/group__CMSIS__RTOS__ThreadMgmt.html">API reference</a> for details about Thread Management functions.
819 - \b osThreadNew: supported
820 - \b osThreadGetName: supported
821 - \b osThreadGetClass: \token{not implemented}
822 - \b osThreadGetZone: \token{not implemented}
823 - \b osThreadGetId: supported
824 - \b osThreadGetState: supported
825 - \b osThreadGetStackSize: \token{not implemented}
826 - \b osThreadGetStackSpace: supported
827 - \b osThreadSetPriority: supported
828 - \b osThreadGetPriority: supported
829 - \b osThreadYield: supported
830 - \b osThreadSuspend: supported
831 - \b osThreadResume: supported
832 - \b osThreadDetach: \token{not implemented}
833 - \b osThreadJoin: \token{not implemented}
834 - \b osThreadExit: supported
835 - \b osThreadTerminate: supported
836 - \b osThreadFeedWatchdog: \token{not implemented}
837 - \b osThreadProtectPrivileged: \token{not implemented}
838 - \b osThreadSuspendClass: \token{not implemented}
839 - \b osThreadResumeClass: \token{not implemented}
840 - \b osThreadTerminateZone: \token{not implemented}
841 - \b osThreadGetCount: supported
842 - \b osThreadEnumerate: supported
846 See <a href="https://arm-software.github.io/CMSIS_6/latest/RTOS2/html/group__CMSIS__RTOS__ThreadFlagsMgmt.html">API reference</a> for details about Thread Flags functions.
847 - \b osThreadFlagsSet: supported
848 - \b osThreadFlagsClear: supported
849 - \b osThreadFlagsGet: supported
850 - \b osThreadFlagsWait: supported
852 Generic Wait Functions
853 ----------------------
854 See <a href="https://arm-software.github.io/CMSIS_6/latest/RTOS2/html/group__CMSIS__RTOS__Wait.html">API reference</a> for details about Generic Wait functions.
855 - \b osDelay: supported
856 - \b osDelayUntil: supported
860 See <a href="https://arm-software.github.io/CMSIS_6/latest/RTOS2/html/group__CMSIS__RTOS__TimerMgmt.html">API reference</a> for details about Timer Management functions.</a>
861 - \b osTimerNew: supported
862 - \b osTimerGetName: supported
863 - \b osTimerStart: supported
864 - \b osTimerStop: supported
865 - \b osTimerIsRunning: supported
866 - \b osTimerDelete: supported
870 See <a href="https://arm-software.github.io/CMSIS_6/latest/RTOS2/html/group__CMSIS__RTOS__EventFlags.html">API reference</a> for details about Event Flags functions.
871 All event flags are limited to 24 bits.
872 - \b osEventFlagsNew: supported
873 - \b osEventFlagsGetName: \token{not implemented}
874 - \b osEventFlagsSet: supported
875 - \b osEventFlagsClear: supported
876 - \b osEventFlagsGet: supported
877 - \b osEventFlagsWait: cannot be called from an ISR.
878 - \b osEventFlagsDelete: supported
882 See <a href="https://arm-software.github.io/CMSIS_6/latest/RTOS2/html/group__CMSIS__RTOS__MutexMgmt.html">API reference</a> for details about Mutex Management functions.\n
883 Priority inherit protocol is used as default mutex behavior (osMutexNew creates priority inherit mutex object by default
884 and ignores osMutexPrioInherit attribute when specified).\n
885 Robust mutex objects are not supported (osMutexNew returns NULL when osMutexRobust attribute is specified).\n
886 - \b osMutexNew: supported
887 - \b osMutexGetName: \token{not implemented}
888 - \b osMutexAcquire: supported
889 - \b osMutexRelease: supported
890 - \b osMutexGetOwner: supported
891 - \b osMutexDelete: supported
895 See <a href="https://arm-software.github.io/CMSIS_6/latest/RTOS2/html/group__CMSIS__RTOS__SemaphoreMgmt.html">API reference</a> for details about Semaphore functions.
896 - \b osSemaphoreNew: supported
897 - \b osSemaphoreGetName: \token{not implemented}
898 - \b osSemaphoreAcquire: supported
899 - \b osSemaphoreRelease: supported
900 - \b osSemaphoreGetCount: supported
901 - \b osSemaphoreDelete: supported
905 See <a href="https://arm-software.github.io/CMSIS_6/latest/RTOS2/html/group__CMSIS__RTOS__PoolMgmt.html">API reference</a> for details about Memory Pool functions.
906 - \b osMemoryPoolNew: supported
907 - \b osMemoryPoolGetName: supported
908 - \b osMemoryPoolAlloc: supported
909 - \b osMemoryPoolFree: supported
910 - \b osMemoryPoolGetCapacity: supported
911 - \b osMemoryPoolGetBlockSize: supported
912 - \b osMemoryPoolGetCount: supported
913 - \b osMemoryPoolGetSpace: supported
914 - \b osMemoryPoolDelete: supported
918 See <a href="https://arm-software.github.io/CMSIS_6/latest/RTOS2/html/group__CMSIS__RTOS__Message.html">API reference</a> for details about Message Queue functions.
919 - \b osMessageQueueNew: supported
920 - \b osMessageQueueGetName: \token{not implemented}
921 - \b osMessageQueuePut: ignores message priority.
922 - \b osMessageQueueGet: ignores message priority.
923 - \b osMessageQueueGetCapacity: supported
924 - \b osMessageQueueGetMsgSize: supported
925 - \b osMessageQueueGetCount: supported
926 - \b osMessageQueueGetSpace: supported
927 - \b osMessageQueueReset: supported
928 - \b osMessageQueueDelete: supported
931 /* ======================================================================================================================== */
932 // Group creation for Reference
934 \addtogroup freertos_specific CMSIS-FreeRTOS Specifics
935 \brief This section describes CMSIS-FreeRTOS specifics.
937 CMSIS-FreeRTOS interfaces to the
938 <a href="https://arm-software.github.io/CMSIS-View/latest/evr.html" target="_blank"><b>Event Recorder</b></a>
939 to provide event information which helps you to understand and analyze the operation. Refer to \ref freertos_evr for more