From 76177aa280494bb36d7a0bcbda1078d4db717020 Mon Sep 17 00:00:00 2001 From: Ali Labbene Date: Mon, 9 Dec 2019 11:25:19 +0100 Subject: Official ARM version: v4.5 --- Documentation/RTOS/html/_using_o_s.html | 134 ++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 Documentation/RTOS/html/_using_o_s.html (limited to 'Documentation/RTOS/html/_using_o_s.html') diff --git a/Documentation/RTOS/html/_using_o_s.html b/Documentation/RTOS/html/_using_o_s.html new file mode 100644 index 0000000..7f85ccd --- /dev/null +++ b/Documentation/RTOS/html/_using_o_s.html @@ -0,0 +1,134 @@ + + + + + +Using a CMSIS-RTOS Implementation +CMSIS-RTOS: Using a CMSIS-RTOS Implementation + + + + + + + + + + + + +
+
+ + + + + + + +
+
CMSIS-RTOS +  Version 1.02 +
+
CMSIS-RTOS API: Generic RTOS interface for Cortex-M processor-based devices.
+
+
+ +
+
    + +
+
+ + +
+
+ +
+
+
+ +
+
+
+
Using a CMSIS-RTOS Implementation
+
+
+

A CMSIS-RTOS implementation is typically provided as a library. To add the RTOS functionality to an existing CMSIS-based application, the RTOS library (and typically a configuration file) needs to be added. The available functionality of the RTOS library is defined in the header file cmsis_os.h that is specific for each CMSIS-RTOS implementation.

+
+CMSIS_RTOS_Files.png +
+CMSIS-RTOS File Structure
+

Depending on the CMSIS-RTOS implementation, execution may start with the main function as the first thread. This has the benefit that an application programmer may use other middleware libraries that create threads internally, but the remaining part of the user application just uses the main thread. Therefore, the usage of the RTOS can be invisible to the application programmer, but libraries can use CMSIS-RTOS features.

+

Once the files are added to a project, the user can start working with the CMSIS-RTOS functions. A code example is provided below:

+

Code Example

+
#include "cmsis_os.h" // CMSIS-RTOS header file
+
+
void job1 (void const *argument) { // thread function 'job1'
+
while (1) {
+
: // execute some code
+
osDelay (10); // delay execution for 10 milliseconds
+
}
+
}
+
+
osThreadDef(job1, osPriorityAboveNormal, 1, 0); // define job1 as thread function
+
+
void job2 (void const *argument) { // thread function 'job2'
+
osThreadCreate(osThread(job1),NULL); // create job1 thread
+
while (1) {
+
: // execute some code
+
}
+
}
+
+
osThreadDef(job2, osPriorityNormal, 1, 0); // define job2 as thread function
+
+
void job3 (void const *argument) { // thread function 'job3'
+
while (1) {
+
: // execute some code
+
osDelay (20); // delay execution for 20 milliseconds
+
}
+
}
+
+
osThreadDef(job3, osPriorityNormal, 1, 0); // define job3 as thread function
+
+
int main (void) { // program execution starts here
+
osKernelInitialize (); // initialize RTOS kernel
+
: // setup and initialize peripherals
+ + +
osKernelStart (); // start kernel with job2 execution
+
}
+
+
+ + + + -- cgit