خرید بک لینک

CMSIS-RTOS (CMSIS-RTOS RTX) Example Program

#include "cmsis_os.h"

/* Renamed main() function */

void app_main (void const *argument) {

// contents of old "main"

}

osThreadDef(app_main, osPriorityNormal, 1, 0);

int main (void) {

// System Initialization

SystemCoreClockUpdate();

// ...

osKernelInitialize();

// initialize peripherals here

/* Create the API v1 thread */

osThreadCreate(osThread(app_main), NULL);

osKernelStart();

for (;;);

}

/*----------------------------------------------------------------------------

*---------------------------------------------------------------------------*/

#include "cmsis_os2.h"

void app_main (void *argument) {

// ...

for (;;) {}

}

int main (void) {

// System Initialization

SystemCoreClockUpdate();

// ...

osKernelInitialize(); // Initialize CMSIS-RTOS

// initialize peripherals here

/* Create the API v2 thread */

osThreadNew(app_main, NULL, NULL); // Create thread with default settings

osKernelStart(); // Start thread execution

for (;;) {}

}

CMSIS-RTOS (CMSIS-RTOS RTX) is based on the RTX kernel and is part of the CMSIS software pack...

Migrate RTX to CMSIS-RTOSv1

- Replace RTX_Conf.c with RTX_Conf_CM.c.

General Differences Between RTX and CMSIS-RTOS RTX

RTX

CMSIS-RTOS RTX

Time slice

RTX is using kernel ticks as the standard unit for measuring periods

CMSIS-RTOS fully relies on milliseconds as this provides a fully qualified timing base without knowing the configuration of a tick

Response time

-no change-

Memory requirements

Code < 4KBytes / User Timer: 8 Bytes

Code < 5KBytes / User Timer: 20 Bytes

Terminology

Tasks / Events

Threads / Signals

Delivery

Integrated in MDK4 releases

Part of CMSIS software pack

System Tasks

Init task created by user

Main runs as first system task / 1 dedicated task for user timers

Priorities

Up to 250 numerical task priorities

Up to 7 named thread priorities

Migrate CMSIS-RTOSv1 to CMSIS-RTOSv2

RTX5 supplies both API layers: CMSIS-RTOS v1 & CMSIS-RTOS v2...

CMSIS-RTOS v2 provides multiple API interfaces:

- CMSIS-RTOS2 is the new C function API that supports dynamic object

- CMSIS-RTOS C API v1 is a C function API that is backward compatible with CMSIS-RTOS v1.

- CMSIS-RTOS C++ API is a C++ class function API

All CMSIS-RTOS C API v1 functions that are implemented in the cmsis_os.h header file.

All CMSIS-RTOS C API v2 functions that are implemented in the cmsis_os2.h header file.

Include "cmsis_os2.h" in all modules where access to API v2 functions is required.

#include "cmsis_os.h" // ARM::CMSIS:RTOS:Keil RTX5

#include "cmsis_os2.h" // ARM::CMSIS:RTOS2:Keil RTX5

برچسب: نویسنده: هستی رستمیان تاريخ: يکشنبه 4 تير 1396 ساعت: 23:15

صفحه بندی